aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2016-04-07 14:33:08 -0400
committerSuhas Daftuar <sdaftuar@gmail.com>2016-04-07 14:33:08 -0400
commite4ba9f6b0402cf7a2ad0d74f617c434a26c6e124 (patch)
treeae7956341a906af2433dc82efb5561c35e8257e6 /src
parent5851915a006ace71493f54665322e41001fb3ac3 (diff)
Version 2 transactions remain non-standard until CSV activates
Before activation, such transactions might not be mined, so don't allow into the mempool.
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a9f104c88b..f5c7e11d6e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1025,6 +1025,14 @@ bool AcceptToMemoryPoolWorker(CTxMemPool& pool, CValidationState& state, const C
if (fRequireStandard && !IsStandardTx(tx, reason))
return state.DoS(0, false, REJECT_NONSTANDARD, reason);
+ // Don't relay version 2 transactions until CSV is active, and we can be
+ // sure that such transactions will be mined (unless we're on
+ // -testnet/-regtest).
+ const CChainParams& chainparams = Params();
+ if (fRequireStandard && tx.nVersion >= 2 && VersionBitsTipState(chainparams.GetConsensus(), Consensus::DEPLOYMENT_CSV) != THRESHOLD_ACTIVE) {
+ return state.DoS(0, false, REJECT_NONSTANDARD, "premature-version2-tx");
+ }
+
// Only accept nLockTime-using transactions that can be mined in the next
// block; we don't want our mempool filled up with transactions that can't
// be mined yet.