aboutsummaryrefslogtreecommitdiff
path: root/src/coins.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2017-04-25 11:29:18 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2017-05-26 13:27:50 -0700
commitd342424301013ec47dc146a4beb49d5c9319d80a (patch)
tree00574e5165c4b96167009fefe525b024e98eae0f /src/coins.h
parent7e0032290669fae5f52c256856c53038511c7db4 (diff)
Remove/ignore tx version in utxo and undo
This makes the following changes: * In undo data and the chainstate database, the transaction nVersion field is removed from the data structures, always written as 0, and ignored when reading. * The definition of hash_serialized in gettxoutsetinfo is changed to no longer incude the nVersion field. It is renamed to hash_serialized_2 to avoid confusion. The new definition also includes transaction height and coinbase information, as this information was missing before. This depends on having a CHashVerifier-based undo data checksum verifier. Apart from changing the definition of serialized_hash, downgrading after using this patch is supported, as no release ever used the value of nVersion field in UTXO entries.
Diffstat (limited to 'src/coins.h')
-rw-r--r--src/coins.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/coins.h b/src/coins.h
index 065bae56e9..12cfd6bf6b 100644
--- a/src/coins.h
+++ b/src/coins.h
@@ -84,15 +84,10 @@ public:
//! at which height this transaction was included in the active block chain
int nHeight;
- //! version of the CTransaction; accesses to this value should probably check for nHeight as well,
- //! as new tx version will probably only be introduced at certain heights
- int nVersion;
-
void FromTx(const CTransaction &tx, int nHeightIn) {
fCoinBase = tx.IsCoinBase();
vout = tx.vout;
nHeight = nHeightIn;
- nVersion = tx.nVersion;
ClearUnspendable();
}
@@ -105,11 +100,10 @@ public:
fCoinBase = false;
std::vector<CTxOut>().swap(vout);
nHeight = 0;
- nVersion = 0;
}
//! empty constructor
- CCoins() : fCoinBase(false), vout(0), nHeight(0), nVersion(0) { }
+ CCoins() : fCoinBase(false), vout(0), nHeight(0) { }
//!remove spent outputs at the end of vout
void Cleanup() {
@@ -131,7 +125,6 @@ public:
std::swap(to.fCoinBase, fCoinBase);
to.vout.swap(vout);
std::swap(to.nHeight, nHeight);
- std::swap(to.nVersion, nVersion);
}
//! equality test
@@ -141,7 +134,6 @@ public:
return true;
return a.fCoinBase == b.fCoinBase &&
a.nHeight == b.nHeight &&
- a.nVersion == b.nVersion &&
a.vout == b.vout;
}
friend bool operator!=(const CCoins &a, const CCoins &b) {
@@ -163,7 +155,8 @@ public:
assert(fFirst || fSecond || nMaskCode);
unsigned int nCode = 8*(nMaskCode - (fFirst || fSecond ? 0 : 1)) + (fCoinBase ? 1 : 0) + (fFirst ? 2 : 0) + (fSecond ? 4 : 0);
// version
- ::Serialize(s, VARINT(this->nVersion));
+ int nVersionDummy = 0;
+ ::Serialize(s, VARINT(nVersionDummy));
// header code
::Serialize(s, VARINT(nCode));
// spentness bitmask
@@ -187,7 +180,8 @@ public:
void Unserialize(Stream &s) {
unsigned int nCode = 0;
// version
- ::Unserialize(s, VARINT(this->nVersion));
+ int nVersionDummy;
+ ::Unserialize(s, VARINT(nVersionDummy));
// header code
::Unserialize(s, VARINT(nCode));
fCoinBase = nCode & 1;