@@ -1036,7 +1036,7 @@ bool MemPoolAccept::PreChecks(ATMPArgs& args, Workspace& ws)
1036
1036
ws.m_conflicts .insert (err->second ->GetHash ());
1037
1037
// Adding the sibling to m_iters_conflicting here means that it doesn't count towards
1038
1038
// RBF Carve Out above. This is correct, since removing to-be-replaced transactions from
1039
- // the descendant count is done separately in SingleV3Checks for TRUC transactions.
1039
+ // the descendant count is done separately in SingleTRUCChecks for TRUC transactions.
1040
1040
ws.m_iters_conflicting .insert (m_pool.GetIter (err->second ->GetHash ()).value ());
1041
1041
ws.m_sibling_eviction = true ;
1042
1042
// The sibling will be treated as part of the to-be-replaced set in ReplacementChecks.
@@ -1877,7 +1877,6 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptPackage(const Package& package,
1877
1877
1878
1878
MempoolAcceptResult AcceptToMemoryPool (Chainstate& active_chainstate, const CTransactionRef& tx,
1879
1879
int64_t accept_time, bool bypass_limits, bool test_accept)
1880
- EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
1881
1880
{
1882
1881
AssertLockHeld (::cs_main);
1883
1882
const CChainParams& chainparams{active_chainstate.m_chainman .GetParams ()};
@@ -2606,9 +2605,8 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
2606
2605
for (const auto & tx : block.vtx ) {
2607
2606
for (size_t o = 0 ; o < tx->vout .size (); o++) {
2608
2607
if (view.HaveCoin (COutPoint (tx->GetHash (), o))) {
2609
- LogPrintf (" ERROR: ConnectBlock(): tried to overwrite transaction\n " );
2610
- return state.Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-txns-BIP30" ,
2611
- " tried to overwrite transaction" );
2608
+ state.Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-txns-BIP30" ,
2609
+ " tried to overwrite transaction" );
2612
2610
}
2613
2611
}
2614
2612
}
@@ -2666,14 +2664,13 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
2666
2664
state.Invalid (BlockValidationResult::BLOCK_CONSENSUS,
2667
2665
tx_state.GetRejectReason (),
2668
2666
tx_state.GetDebugMessage () + " in transaction " + tx.GetHash ().ToString ());
2669
- LogError (" %s: Consensus::CheckTxInputs: %s, %s\n " , __func__, tx.GetHash ().ToString (), state.ToString ());
2670
- return false ;
2667
+ break ;
2671
2668
}
2672
2669
nFees += txfee;
2673
2670
if (!MoneyRange (nFees)) {
2674
- LogPrintf ( " ERROR: %s: accumulated fee in the block out of range. \n " , __func__);
2675
- return state. Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-txns- accumulated- fee-outofrange " ,
2676
- " accumulated fee in the block out of range " ) ;
2671
+ state. Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-txns- accumulated- fee-outofrange " ,
2672
+ " accumulated fee in the block out of range " );
2673
+ break ;
2677
2674
}
2678
2675
2679
2676
// Check that transaction is BIP68 final
@@ -2685,9 +2682,9 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
2685
2682
}
2686
2683
2687
2684
if (!SequenceLocks (tx, nLockTimeFlags, prevheights, *pindex)) {
2688
- LogPrintf ( " ERROR: %s: contains a non-BIP68-final transaction \n " , __func__);
2689
- return state. Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-txns-nonfinal " ,
2690
- " contains a non-BIP68-final transaction " + tx. GetHash (). ToString ()) ;
2685
+ state. Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-txns-nonfinal " ,
2686
+ " contains a non-BIP68-final transaction " + tx. GetHash (). ToString ());
2687
+ break ;
2691
2688
}
2692
2689
}
2693
2690
@@ -2697,8 +2694,8 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
2697
2694
// * witness (when witness enabled in flags and excludes coinbase)
2698
2695
nSigOpsCost += GetTransactionSigOpCost (tx, view, flags);
2699
2696
if (nSigOpsCost > MAX_BLOCK_SIGOPS_COST) {
2700
- LogPrintf ( " ERROR: ConnectBlock(): too many sigops\n " );
2701
- return state. Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-blk-sigops " , " too many sigops " ) ;
2697
+ state. Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-blk-sigops " , " too many sigops" );
2698
+ break ;
2702
2699
}
2703
2700
2704
2701
if (!tx.IsCoinBase ())
@@ -2710,8 +2707,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
2710
2707
// Any transaction validation failure in ConnectBlock is a block consensus failure
2711
2708
state.Invalid (BlockValidationResult::BLOCK_CONSENSUS,
2712
2709
tx_state.GetRejectReason (), tx_state.GetDebugMessage ());
2713
- LogInfo (" Script validation error in block: %s\n " , state.ToString ());
2714
- return false ;
2710
+ break ;
2715
2711
}
2716
2712
control.Add (std::move (vChecks));
2717
2713
}
@@ -2731,16 +2727,17 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
2731
2727
Ticks<MillisecondsDouble>(m_chainman.time_connect ) / m_chainman.num_blocks_total );
2732
2728
2733
2729
CAmount blockReward = nFees + GetBlockSubsidy (pindex->nHeight , params.GetConsensus ());
2734
- if (block.vtx [0 ]->GetValueOut () > blockReward) {
2735
- LogPrintf (" ERROR: ConnectBlock(): coinbase pays too much (actual=%d vs limit=%d)\n " , block.vtx [0 ]->GetValueOut (), blockReward);
2736
- return state.Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-cb-amount" ,
2737
- strprintf (" coinbase pays too much (actual=%d vs limit=%d)" , block.vtx [0 ]->GetValueOut (), blockReward));
2730
+ if (block.vtx [0 ]->GetValueOut () > blockReward && state.IsValid ()) {
2731
+ state.Invalid (BlockValidationResult::BLOCK_CONSENSUS, " bad-cb-amount" ,
2732
+ strprintf (" coinbase pays too much (actual=%d vs limit=%d)" , block.vtx [0 ]->GetValueOut (), blockReward));
2738
2733
}
2739
2734
2740
2735
auto parallel_result = control.Complete ();
2741
- if (parallel_result.has_value ()) {
2736
+ if (parallel_result.has_value () && state. IsValid () ) {
2742
2737
state.Invalid (BlockValidationResult::BLOCK_CONSENSUS, strprintf (" mandatory-script-verify-flag-failed (%s)" , ScriptErrorString (parallel_result->first )), parallel_result->second );
2743
- LogInfo (" Script validation error in block: %s" , state.ToString ());
2738
+ }
2739
+ if (!state.IsValid ()) {
2740
+ LogInfo (" Block validation error: %s" , state.ToString ());
2744
2741
return false ;
2745
2742
}
2746
2743
const auto time_4{SteadyClock::now ()};
0 commit comments