aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBtcDrak <btcdrak@gmail.com>2016-02-19 19:52:31 +0000
committerBtcDrak <btcdrak@gmail.com>2016-03-18 09:28:41 +0000
commit159ee3dd90490eabf6c048c17a62ffa01f6a0967 (patch)
treeca7dea2e042c2950f68fd0453697a96129b6234d
parent9713ed3015da02b0132b665e965fd591689e6510 (diff)
Policy: allow transaction version 2 relay policy.
This commit introduces a way to gracefully bump the default transaction version in a two step process.
-rw-r--r--src/policy/policy.cpp2
-rw-r--r--src/primitives/transaction.h7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp
index c92a249c17..018b3d25b0 100644
--- a/src/policy/policy.cpp
+++ b/src/policy/policy.cpp
@@ -58,7 +58,7 @@ bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType)
bool IsStandardTx(const CTransaction& tx, std::string& reason)
{
- if (tx.nVersion > CTransaction::CURRENT_VERSION || tx.nVersion < 1) {
+ if (tx.nVersion > CTransaction::MAX_STANDARD_VERSION || tx.nVersion < 1) {
reason = "version";
return false;
}
diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h
index 07ae39e0b4..9f7d6f3943 100644
--- a/src/primitives/transaction.h
+++ b/src/primitives/transaction.h
@@ -206,8 +206,15 @@ private:
void UpdateHash() const;
public:
+ // Default transaction version.
static const int32_t CURRENT_VERSION=1;
+ // Changing the default transaction version requires a two step process: first
+ // adapting relay policy by bumping MAX_STANDARD_VERSION, and then later date
+ // bumping the default CURRENT_VERSION at which point both CURRENT_VERSION and
+ // MAX_STANDARD_VERSION will be equal.
+ static const int32_t MAX_STANDARD_VERSION=2;
+
// The local variables are made const to prevent unintended modification
// without updating the cached hash value. However, CTransaction is not
// actually immutable; deserialization and assignment are implemented,