mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-24 22:45:41 +01:00
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.
This commit is contained in:
@@ -1086,7 +1086,6 @@ void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, CTxUndo &txund
|
||||
CTxInUndo& undo = txundo.vprevout.back();
|
||||
undo.nHeight = coins->nHeight;
|
||||
undo.fCoinBase = coins->fCoinBase;
|
||||
undo.nVersion = coins->nVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1271,7 +1270,6 @@ int ApplyTxInUndo(const CTxInUndo& undo, CCoinsViewCache& view, const COutPoint&
|
||||
if (!coins->IsPruned()) fClean = false; // overwriting existing transaction
|
||||
coins->fCoinBase = undo.fCoinBase;
|
||||
coins->nHeight = undo.nHeight;
|
||||
coins->nVersion = undo.nVersion;
|
||||
} else {
|
||||
if (coins->IsPruned()) fClean = false; // adding output to missing transaction
|
||||
}
|
||||
@@ -1319,11 +1317,6 @@ static DisconnectResult DisconnectBlock(const CBlock& block, const CBlockIndex*
|
||||
outs->ClearUnspendable();
|
||||
|
||||
CCoins outsBlock(tx, pindex->nHeight);
|
||||
// The CCoins serialization does not serialize negative numbers.
|
||||
// No network rules currently depend on the version here, so an inconsistency is harmless
|
||||
// but it must be corrected before txout nversion ever influences a network rule.
|
||||
if (outsBlock.nVersion < 0)
|
||||
outs->nVersion = outsBlock.nVersion;
|
||||
if (*outs != outsBlock) fClean = false; // transaction mismatch
|
||||
|
||||
// remove outputs
|
||||
|
||||
Reference in New Issue
Block a user