aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2012-06-27 12:43:19 -0400
committerGavin Andresen <gavinandresen@gmail.com>2012-07-06 11:37:01 -0400
commitdae3e10a5abe93833c57183b7c00f1db9200f46e (patch)
tree52799f24df21e1785c0e58e43438a8b130642ad5 /src
parent6e3a1a374293a8a5adeb2ad464f7205e819585ee (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp3
-rw-r--r--src/main.h6
2 files changed, 7 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index b4e827098e..499f4e336a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -268,6 +268,9 @@ bool CTransaction::ReadFromDisk(COutPoint prevout)
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
diff --git a/src/main.h b/src/main.h
index c841fdaf18..b3cc9ab40e 100644
--- a/src/main.h
+++ b/src/main.h
@@ -386,6 +386,7 @@ typedef std::map<uint256, std::pair<CTxIndex, CTransaction> > MapPrevTx;
class CTransaction
{
public:
+ static const int CURRENT_VERSION=1;
int nVersion;
std::vector<CTxIn> vin;
std::vector<CTxOut> vout;
@@ -411,7 +412,7 @@ public:
void SetNull()
{
- nVersion = 1;
+ nVersion = CTransaction::CURRENT_VERSION;
vin.clear();
vout.clear();
nLockTime = 0;
@@ -817,6 +818,7 @@ class CBlock
{
public:
// header
+ static const int CURRENT_VERSION=1;
int nVersion;
uint256 hashPrevBlock;
uint256 hashMerkleRoot;
@@ -858,7 +860,7 @@ public:
void SetNull()
{
- nVersion = 1;
+ nVersion = CBlock::CURRENT_VERSION;
hashPrevBlock = 0;
hashMerkleRoot = 0;
nTime = 0;