From f33c9e36ecc78d06822cc4036ca33ca257df5a87 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Mon, 17 Sep 2018 13:56:07 -0700 Subject: [PATCH] Add additional security measure to prevent disconnecting notarized blocks --- src/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 41de90556..bb8be2e5f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2672,6 +2672,15 @@ bool static DisconnectTip(CValidationState &state) { CBlock block; if (!ReadBlockFromDisk(block, pindexDelete)) return AbortNode(state, "Failed to read block"); + + int32_t prevMoMheight; uint256 notarizedhash,txid; + komodo_notarized_height(&prevMoMheight,¬arizedhash,&txid); + if ( block.GetHash() == notarizedhash ) + { + fprintf(stderr,"DisconnectTip trying to disconnect notarized block at ht.%d\n",(int32_t)pindexDelete->nHeight); + return(false); + } + // Apply the block atomically to the chain state. uint256 anchorBeforeDisconnect = pcoinsTip->GetBestAnchor(); int64_t nStart = GetTimeMicros();