@@ -1374,9 +1374,13 @@ bool CBlock::CheckBlock() const
13741374 // that can be verified before saving an orphan block.
13751375
13761376 // Size limits
1377- if (vtx.empty () || vtx.size () > MAX_SIZE || ::GetSerializeSize (*this , SER_NETWORK) > MAX_SIZE )
1377+ if (vtx.empty () || vtx.size () > MAX_BLOCK_SIZE || ::GetSerializeSize (*this , SER_NETWORK) > MAX_BLOCK_SIZE )
13781378 return error (" CheckBlock() : size limits failed" );
13791379
1380+ // Check proof of work matches claimed amount
1381+ if (!CheckProofOfWork (GetHash (), nBits))
1382+ return error (" CheckBlock() : proof of work failed" );
1383+
13801384 // Check timestamp
13811385 if (GetBlockTime () > GetAdjustedTime () + 2 * 60 * 60 )
13821386 return error (" CheckBlock() : block timestamp too far in the future" );
@@ -1393,9 +1397,9 @@ bool CBlock::CheckBlock() const
13931397 if (!tx.CheckTransaction ())
13941398 return error (" CheckBlock() : CheckTransaction failed" );
13951399
1396- // Check proof of work matches claimed amount
1397- if (! CheckProofOfWork ( GetHash (), nBits) )
1398- return error (" CheckBlock() : proof of work failed " );
1400+ // Check that it's not full of nonstandard transactions
1401+ if (GetSigOpCount () > MAX_BLOCK_SIGOPS )
1402+ return error (" CheckBlock() : too many nonstandard transactions " );
13991403
14001404 // Check merkleroot
14011405 if (hashMerkleRoot != BuildMerkleTree ())
@@ -1418,13 +1422,9 @@ bool CBlock::AcceptBlock()
14181422 CBlockIndex* pindexPrev = (*mi).second ;
14191423 int nHeight = pindexPrev->nHeight +1 ;
14201424
1421- // Check size
1422- if (nHeight > 79400 && ::GetSerializeSize (*this , SER_NETWORK) > MAX_BLOCK_SIZE)
1423- return error (" AcceptBlock() : over size limit" );
1424-
1425- // Check that it's not full of nonstandard transactions
1426- if (nHeight > 79400 && GetSigOpCount () > MAX_BLOCK_SIGOPS)
1427- return error (" AcceptBlock() : too many nonstandard transactions" );
1425+ // Check proof of work
1426+ if (nBits != GetNextWorkRequired (pindexPrev))
1427+ return error (" AcceptBlock() : incorrect proof of work" );
14281428
14291429 // Check timestamp against prev
14301430 if (GetBlockTime () <= pindexPrev->GetMedianTimePast ())
@@ -1435,10 +1435,6 @@ bool CBlock::AcceptBlock()
14351435 if (!tx.IsFinal (nHeight, GetBlockTime ()))
14361436 return error (" AcceptBlock() : contains a non-final transaction" );
14371437
1438- // Check proof of work
1439- if (nBits != GetNextWorkRequired (pindexPrev))
1440- return error (" AcceptBlock() : incorrect proof of work" );
1441-
14421438 // Check that the block chain matches the known block chain up to a checkpoint
14431439 if ((nHeight == 11111 && hash != uint256 (" 0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d" )) ||
14441440 (nHeight == 33333 && hash != uint256 (" 0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6" )) ||
@@ -2415,6 +2411,12 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
24152411 CWalletTx order;
24162412 vRecv >> hashReply >> order;
24172413
2414+ if (!mapArgs.count (" -allowreceivebyip" ) || mapArgs[" -allowreceivebyip" ] == " 0" )
2415+ {
2416+ pfrom->PushMessage (" reply" , hashReply, (int )2 , string (" " ));
2417+ return true ;
2418+ }
2419+
24182420 // / we have a chance to check the order here
24192421
24202422 // Keep giving the same key to the same ip until they use it
@@ -2435,6 +2437,12 @@ bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
24352437 vRecv >> hashReply >> wtxNew;
24362438 wtxNew.fFromMe = false ;
24372439
2440+ if (!mapArgs.count (" -allowreceivebyip" ) || mapArgs[" -allowreceivebyip" ] == " 0" )
2441+ {
2442+ pfrom->PushMessage (" reply" , hashReply, (int )2 );
2443+ return true ;
2444+ }
2445+
24382446 // Broadcast
24392447 if (!wtxNew.AcceptWalletTransaction ())
24402448 {
0 commit comments