diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1729,8 +1729,6 @@ } const uint32_t flags = GetBlockScriptFlags(config, pindex->pprev); - const bool fIsMagneticAnomalyEnabled = - IsMagneticAnomalyEnabled(config, pindex->pprev); int64_t nTime2 = GetTimeMicros(); nTimeForks += nTime2 - nTime1; @@ -1764,14 +1762,11 @@ nSigOpsCount += GetSigOpCountWithoutP2SH(tx, flags); } - if (fIsMagneticAnomalyEnabled || tx.IsCoinBase()) { - // We do not need to throw when a transaction is duplicated. If they - // are in the same block, CheckBlock will catch it, and if they are - // in a different block, it'll register as a double spend or BIP30 - // violation. In both cases, we get a more meaningful feedback out - // of it. - AddCoins(view, tx, pindex->nHeight, true); - } + // We do not need to throw when a transaction is duplicated. If they are + // in the same block, CheckBlock will catch it, and if they are in a + // different block, it'll register as a double spend or BIP30 violation. + // In both cases, we get a more meaningful feedback out of it. + AddCoins(view, tx, pindex->nHeight, true); } for (const auto &ptx : block.vtx) { @@ -1833,10 +1828,6 @@ blockundo.vtxundo.push_back(CTxUndo()); SpendCoins(view, tx, blockundo.vtxundo.back(), pindex->nHeight); - - if (!fIsMagneticAnomalyEnabled) { - AddCoins(view, tx, pindex->nHeight); - } } int64_t nTime3 = GetTimeMicros(); @@ -2204,14 +2195,8 @@ // remove transactions that are replay protected from the mempool. There is // no easy way to do this so we'll just discard the whole mempool and then // add the transaction of the block we just disconnected back. - // - // If we are deactivating Magnetic anomaly, we want to make sure we do not - // have transactions in the mempool that use newly introduced opcodes. As a - // result, we also cleanup the mempool. - if ((IsReplayProtectionEnabled(config, pindexDelete) && - !IsReplayProtectionEnabled(config, pindexDelete->pprev)) || - (IsMagneticAnomalyEnabled(config, pindexDelete) && - !IsMagneticAnomalyEnabled(config, pindexDelete->pprev))) { + if (IsReplayProtectionEnabled(config, pindexDelete) && + !IsReplayProtectionEnabled(config, pindexDelete->pprev)) { LogPrint(BCLog::MEMPOOL, "Clearing mempool for reorg"); g_mempool.clear(); diff --git a/test/functional/abc-checkdatasig-activation.py b/test/functional/abc-checkdatasig-activation.py --- a/test/functional/abc-checkdatasig-activation.py +++ b/test/functional/abc-checkdatasig-activation.py @@ -169,17 +169,6 @@ add_tx(magneticanomalyblock, tx0) yield accepted(magneticanomalyblock) - self.log.info("Cause a reorg that deactivate the checkdatasig opcodes") - - # Invalidate the checkdatasig block, ensure tx0 gets back to the mempool. - assert(tx0id not in set(node.getrawmempool())) - - node.invalidateblock(format(magneticanomalyblock.sha256, 'x')) - assert(tx0id in set(node.getrawmempool())) - - node.invalidateblock(format(fork_block.sha256, 'x')) - assert(tx0id not in set(node.getrawmempool())) - if __name__ == '__main__': CheckDataSigActivationTest().main() diff --git a/test/functional/abc-transaction-ordering.py b/test/functional/abc-transaction-ordering.py --- a/test/functional/abc-transaction-ordering.py +++ b/test/functional/abc-transaction-ordering.py @@ -213,19 +213,6 @@ assert_equal(node.getblockheader(node.getbestblockhash())['mediantime'], MAGNETIC_ANOMALY_START_TIME - 1) - # Before we activate the Nov 15, 2018 HF, transaction order is respected. - def ordered_block(block_number, spend): - b = block(block_number, spend=spend, tx_count=16) - b.vtx = [b.vtx[0]] + sorted(b.vtx[1:], key=lambda tx: tx.get_id()) - update_block(block_number) - return b - - ordered_block(4444, out[16]) - yield rejected(RejectResult(16, b'bad-txns-inputs-missingorspent')) - - # Rewind bad block. - tip(5104) - # Activate the Nov 15, 2018 HF block(5556, out[16], tx_count=16) yield accepted() @@ -241,6 +228,13 @@ # Rewind bad block. tip(5556) + # After we activate the Nov 15, 2018 HF, transaction order is enforced. + def ordered_block(block_number, spend): + b = block(block_number, spend=spend, tx_count=16) + b.vtx = [b.vtx[0]] + sorted(b.vtx[1:], key=lambda tx: tx.get_id()) + update_block(block_number) + return b + # Now that the fork activated, we need to order transaction per txid. ordered_block(4445, out[17]) yield accepted()