changeset 3162:1f4365b4bcd2 draft

Treat non-version-1 transactions as non-standard Adds CBlock::CURRENT_VERSION and CTransaction::CURRENT_VERSION constants, and makes non-CURRENT_VERSION transactions nonstandard. This will help make future upgrades smoother.
author Gavin Andresen <gavinandresen@gmail.com>
date Wed, 27 Jun 2012 12:43:19 -0400
parents d6eea4180a72
children 7ce3f0954271
files src/main.cpp src/main.h
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -268,6 +268,9 @@
 
 bool CTransaction::IsStandard() const
 {
+    if (nVersion > CTransaction::CURRENT_VERSION)
+        return false;
+
     BOOST_FOREACH(const CTxIn& txin, vin)
     {
         // Biggest 'standard' txin is a 3-signature 3-of-3 CHECKMULTISIG
--- a/src/main.h
+++ b/src/main.h
@@ -386,6 +386,7 @@
 class CTransaction
 {
 public:
+    static const int CURRENT_VERSION=1;
     int nVersion;
     std::vector<CTxIn> vin;
     std::vector<CTxOut> vout;
@@ -411,7 +412,7 @@
 
     void SetNull()
     {
-        nVersion = 1;
+        nVersion = CTransaction::CURRENT_VERSION;
         vin.clear();
         vout.clear();
         nLockTime = 0;
@@ -817,6 +818,7 @@
 {
 public:
     // header
+    static const int CURRENT_VERSION=1;
     int nVersion;
     uint256 hashPrevBlock;
     uint256 hashMerkleRoot;
@@ -858,7 +860,7 @@
 
     void SetNull()
     {
-        nVersion = 1;
+        nVersion = CBlock::CURRENT_VERSION;
         hashPrevBlock = 0;
         hashMerkleRoot = 0;
         nTime = 0;