add node ban for pushing attacking chain

This commit is contained in:
blackjok3r
2019-04-11 21:59:04 +08:00
parent a766a16bb3
commit d3ae00c331

View File

@@ -3904,7 +3904,8 @@ bool static DisconnectTip(CValidationState &state, bool fBare = false) {
if ( block.GetHash() == notarizedhash ) if ( block.GetHash() == notarizedhash )
{ {
fprintf(stderr,"DisconnectTip trying to disconnect notarized block at ht.%d\n",(int32_t)pindexDelete->GetHeight()); fprintf(stderr,"DisconnectTip trying to disconnect notarized block at ht.%d\n",(int32_t)pindexDelete->GetHeight());
return(false); return state.DoS(100, error("AcceptBlock(): DisconnectTip trying to disconnect notarized blockht.%d",(int32_t)pindexDelete->GetHeight()),
REJECT_INVALID, "past-notarized-height");
} }
} }
// Apply the block atomically to the chain state. // Apply the block atomically to the chain state.
@@ -4240,7 +4241,8 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
if ( pindexFork->GetHeight() < notarizedht ) if ( pindexFork->GetHeight() < notarizedht )
{ {
fprintf(stderr,"pindexFork->GetHeight().%d is < notarizedht %d, so ignore it\n",(int32_t)pindexFork->GetHeight(),notarizedht); fprintf(stderr,"pindexFork->GetHeight().%d is < notarizedht %d, so ignore it\n",(int32_t)pindexFork->GetHeight(),notarizedht);
return false; return state.DoS(100, error("ActivateBestChainStep(): pindexFork->GetHeight().%d is < notarizedht %d, so ignore it",(int32_t)pindexFork->GetHeight(),notarizedht),
REJECT_INVALID, "past-notarized-height");
} }
// - On ChainDB initialization, pindexOldTip will be null, so there are no removable blocks. // - On ChainDB initialization, pindexOldTip will be null, so there are no removable blocks.
// - If pindexMostWork is in a chain that doesn't have the same genesis block as our chain, // - If pindexMostWork is in a chain that doesn't have the same genesis block as our chain,