Skip to content

Instantly share code, notes, and snippets.

@btcdrak
Created February 19, 2016 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btcdrak/a949122b20d038be801d to your computer and use it in GitHub Desktop.
Save btcdrak/a949122b20d038be801d to your computer and use it in GitHub Desktop.
diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp
index 332abc4..e3ed7be 100644
--- a/src/policy/policy.cpp
+++ b/src/policy/policy.cpp
@@ -55,7 +55,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 07ae39e..9f7d6f3 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,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment