@@ -3489,8 +3489,9 @@ static bool ActivateBestChainStep(CValidationState& state, const CChainParams& c
34893489 if (!ConnectTip (state, chainparams, pindexConnect, pindexConnect == pindexMostWork ? pblock : std::shared_ptr<const CBlock>(), connectTrace, disconnectpool)) {
34903490 if (state.IsInvalid ()) {
34913491 // The block violates a consensus rule.
3492- if (!state.CorruptionPossible ())
3492+ if (!state.CorruptionPossible ()) {
34933493 InvalidChainFound (vpindexToConnect.back ());
3494+ }
34943495 state = CValidationState ();
34953496 fInvalidFound = true ;
34963497 fContinue = false ;
@@ -4308,7 +4309,7 @@ bool ProcessNewBlockHeaders(const std::vector<CBlockHeader>& headers, CValidatio
43084309}
43094310
43104311/* * Store block on disk. If dbp is non-nullptr, the file is known to already reside on disk */
4311- static bool AcceptBlock (const std::shared_ptr<const CBlock>& pblock, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool fRequested , const CDiskBlockPos* dbp, bool * fNewBlock )
4312+ static bool AcceptBlock (const std::shared_ptr<const CBlock>& pblock, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool fRequested , const CDiskBlockPos* dbp, bool * fNewBlock , bool fFromLoad = false )
43124313{
43134314 const CBlock& block = *pblock;
43144315
@@ -4358,11 +4359,17 @@ static bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidation
43584359 // Dont force the CheckBlock asset duplciates when checking from this state
43594360 if (!CheckBlock (block, state, chainparams.GetConsensus (), true , true ) ||
43604361 !ContextualCheckBlock (block, state, chainparams.GetConsensus (), pindex->pprev , currentActiveAssetCache)) {
4361- if (state.IsInvalid () && !state.CorruptionPossible ()) {
4362- pindex->nStatus |= BLOCK_FAILED_VALID;
4363- setDirtyBlockIndex.insert (pindex);
4362+ if (fFromLoad && state.GetRejectReason () == " bad-txns-transfer-asset-bad-deserialize" ) {
4363+ // keep going, we are only loading blocks from database
4364+ CValidationState new_state;
4365+ state = new_state;
4366+ } else {
4367+ if (state.IsInvalid () && !state.CorruptionPossible ()) {
4368+ pindex->nStatus |= BLOCK_FAILED_VALID;
4369+ setDirtyBlockIndex.insert (pindex);
4370+ }
4371+ return error (" %s: %s" , __func__, FormatStateMessage (state));
43644372 }
4365- return error (" %s: %s" , __func__, FormatStateMessage (state));
43664373 }
43674374
43684375 // Header is valid/has work, merkle tree and segwit merkle tree are good...RELAY NOW
@@ -5276,11 +5283,12 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskB
52765283 if (mapBlockIndex.count (hash) == 0 || (mapBlockIndex[hash]->nStatus & BLOCK_HAVE_DATA) == 0 ) {
52775284 LOCK (cs_main);
52785285 CValidationState state;
5279- if (AcceptBlock (pblock, state, chainparams, nullptr , true , dbp, nullptr )) {
5286+ if (AcceptBlock (pblock, state, chainparams, nullptr , true , dbp, nullptr , true )) {
52805287 nLoaded++;
52815288 }
5282- if (state.IsError ())
5289+ if (state.IsError ()) {
52835290 break ;
5291+ }
52845292 } else if (hash != chainparams.GetConsensus ().hashGenesisBlock && mapBlockIndex[hash]->nHeight % 1000 == 0 ) {
52855293 LogPrint (BCLog::REINDEX, " Block Import: already had block %s at height %d\n " , hash.ToString (), mapBlockIndex[hash]->nHeight );
52865294 }
@@ -5311,7 +5319,7 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskB
53115319 head.ToString ());
53125320 LOCK (cs_main);
53135321 CValidationState dummy;
5314- if (AcceptBlock (pblockrecursive, dummy, chainparams, nullptr , true , &it->second , nullptr ))
5322+ if (AcceptBlock (pblockrecursive, dummy, chainparams, nullptr , true , &it->second , nullptr , true ))
53155323 {
53165324 nLoaded++;
53175325 queue.push_back (pblockrecursive->GetHash ());
@@ -5724,6 +5732,18 @@ bool AreMessagesDeployed() {
57245732 return IsRip5Active ();
57255733}
57265734
5735+ bool AreTransferScriptsSizeDeployed () {
5736+
5737+ if (fTransferScriptIsActive )
5738+ return true ;
5739+
5740+ const ThresholdState thresholdState = VersionBitsTipState (GetParams ().GetConsensus (), Consensus::DEPLOYMENT_TRANSFER_SCRIPT_SIZE);
5741+ if (thresholdState == THRESHOLD_ACTIVE)
5742+ fTransferScriptIsActive = true ;
5743+
5744+ return fTransferScriptIsActive ;
5745+ }
5746+
57275747bool AreRestrictedAssetsDeployed () {
57285748
57295749 return IsRip5Active ();
0 commit comments