Policy: allow transaction version 2 relay policy.

This commit introduces a way to gracefully bump the default
transaction version in a two step process.
pull/262/head
BtcDrak 9 years ago
parent 02c2435802
commit 12c89c9185

@ -55,7 +55,7 @@ bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType)
bool IsStandardTx(const CTransaction& tx, std::string& reason) 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"; reason = "version";
return false; return false;
} }

@ -206,8 +206,15 @@ private:
void UpdateHash() const; void UpdateHash() const;
public: public:
// Default transaction version.
static const int32_t CURRENT_VERSION=1; 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 // The local variables are made const to prevent unintended modification
// without updating the cached hash value. However, CTransaction is not // without updating the cached hash value. However, CTransaction is not
// actually immutable; deserialization and assignment are implemented, // actually immutable; deserialization and assignment are implemented,

Loading…
Cancel
Save