Merge branch 'beta' into dev
This commit is contained in:
29
src/main.cpp
29
src/main.cpp
@@ -3810,9 +3810,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C
|
||||
uint8_t pubkey33[33]; uint256 hash;
|
||||
// These are checks that are independent of context.
|
||||
hash = block.GetHash();
|
||||
|
||||
// Check that the header is valid (particularly PoW). This is mostly
|
||||
// redundant with the call in AcceptBlockHeader.
|
||||
// Check that the header is valid (particularly PoW). This is mostly redundant with the call in AcceptBlockHeader.
|
||||
if (!CheckBlockHeader(futureblockp,height,pindex,block,state,fCheckPOW))
|
||||
{
|
||||
if ( *futureblockp == 0 )
|
||||
@@ -3996,16 +3994,13 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn
|
||||
return true;
|
||||
}
|
||||
|
||||
//static uint256 komodo_requestedhash;
|
||||
//static int32_t komodo_requestedcount;
|
||||
|
||||
bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidationState& state, CBlockIndex** ppindex)
|
||||
{
|
||||
static uint256 zero;
|
||||
const CChainParams& chainparams = Params();
|
||||
AssertLockHeld(cs_main);
|
||||
|
||||
// Check for duplicate
|
||||
// Check for duplicate
|
||||
uint256 hash = block.GetHash();
|
||||
BlockMap::iterator miSelf = mapBlockIndex.find(hash);
|
||||
CBlockIndex *pindex = NULL;
|
||||
@@ -4044,12 +4039,6 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat
|
||||
BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock);
|
||||
if (mi == mapBlockIndex.end())
|
||||
{
|
||||
//fprintf(stderr,"AcceptBlockHeader hashPrevBlock %s not found\n",block.hashPrevBlock.ToString().c_str());
|
||||
/*if ( komodo_requestedhash == zero )
|
||||
{
|
||||
komodo_requestedhash = block.hashPrevBlock;
|
||||
komodo_requestedcount = 0;
|
||||
}*/
|
||||
LogPrintf("AcceptBlockHeader hashPrevBlock %s not found\n",block.hashPrevBlock.ToString().c_str());
|
||||
return(false);
|
||||
//return state.DoS(10, error("%s: prev block not found", __func__), 0, "bad-prevblk");
|
||||
@@ -4057,12 +4046,6 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat
|
||||
pindexPrev = (*mi).second;
|
||||
if (pindexPrev == 0 )
|
||||
{
|
||||
/*fprintf(stderr,"AcceptBlockHeader failed no pindexPrev %s\n",block.hashPrevBlock.ToString().c_str());
|
||||
if ( komodo_requestedhash == zero )
|
||||
{
|
||||
komodo_requestedhash = block.hashPrevBlock;
|
||||
komodo_requestedcount = 0;
|
||||
}*/
|
||||
LogPrintf("AcceptBlockHeader hashPrevBlock %s no pindexPrev\n",block.hashPrevBlock.ToString().c_str());
|
||||
return(false);
|
||||
}
|
||||
@@ -4154,7 +4137,6 @@ bool AcceptBlock(int32_t *futureblockp,CBlock& block, CValidationState& state, C
|
||||
}
|
||||
|
||||
int nHeight = pindex->nHeight;
|
||||
|
||||
// Write block to history file
|
||||
try {
|
||||
unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
|
||||
@@ -4280,8 +4262,8 @@ bool ProcessNewBlock(bool from_miner,int32_t height,CValidationState &state, CNo
|
||||
bool checked; uint256 hash; int32_t futureblock=0;
|
||||
auto verifier = libzcash::ProofVerifier::Disabled();
|
||||
hash = pblock->GetHash();
|
||||
//fprintf(stderr,"process newblock %s\n",hash.ToString().c_str());
|
||||
if ( chainActive.Tip() != 0 )
|
||||
|
||||
if ( chainActive.Tip() != 0 )
|
||||
komodo_currentheight_set(chainActive.Tip()->nHeight);
|
||||
checked = CheckBlock(&futureblock,height!=0?height:komodo_block2height(pblock),0,*pblock, state, verifier,0);
|
||||
{
|
||||
@@ -6164,10 +6146,9 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
return error("non-continuous headers sequence");
|
||||
}
|
||||
int32_t futureblock;
|
||||
//fprintf(stderr,"headers msg nCount.%d\n",(int32_t)nCount);
|
||||
if (!AcceptBlockHeader(&futureblock,header, state, &pindexLast)) {
|
||||
int nDoS;
|
||||
if (state.IsInvalid(nDoS))
|
||||
if (state.IsInvalid(nDoS) && futureblock == 0)
|
||||
{
|
||||
if (nDoS > 0 && futureblock == 0)
|
||||
Misbehaving(pfrom->GetId(), nDoS/nDoS);
|
||||
|
||||
Reference in New Issue
Block a user