aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authormerge-script <fanquake@gmail.com>2024-06-12 10:32:31 +0100
committermerge-script <fanquake@gmail.com>2024-06-12 10:32:31 +0100
commit5ee6b76c69d51158c13f6ad9ea1b264372e58d4d (patch)
treefeab6f5725952448a30ed3643fce8f2bc17f0927 /contrib
parent416e26c1db7769e5de05fae1c07c47991a3447c2 (diff)
parent429ec1aaaaafab150f11e27fcf132a99b57c4fc7 (diff)
Merge bitcoin/bitcoin#29325: consensus: Store transaction nVersion as uint32_t
429ec1aaaaafab150f11e27fcf132a99b57c4fc7 refactor: Rename CTransaction::nVersion to version (Ava Chow) 27e70f1f5be1f536f2314cd2ea42b4f80d927fbd consensus: Store transaction nVersion as uint32_t (Ava Chow) Pull request description: Given that the use of a transaction's nVersion is always as an unsigned int, it doesn't make sense to store it as signed and then cast it to unsigned everywhere it is used and displayed. Since a few alternative implementations have recently been revealed to have made an error with this signedness that would have resulted in consensus failure, I think it makes sense for us to just make this always unsigned to make it clear that the version is treated as unsigned. This would also help us avoid future potential issues with signedness of this value. I believe that this is safe and does not actually change what transactions would or would not be considered both standard and consensus valid. Within consensus, the only use of the version in consensus is in BIP68 validation which was already casting it to uint32_t. Within policy, although it is used as a signed int for the transaction version number check, I do not think that this change would change standardness. Standard transactions are limited to the range [1, 2]. Negative numbers would have fallen under the < 1 condition, but by making it unsigned, they are still non-standard under the > 2 condition. Unsigned and signed ints are serialized and unserialized the same way so there is no change in serialization. ACKs for top commit: maflcko: ACK 429ec1aaaaafab150f11e27fcf132a99b57c4fc7 🐿 glozow: ACK 429ec1aaaa shaavan: ACK 429ec1aaaaafab150f11e27fcf132a99b57c4fc7 💯 Tree-SHA512: 0bcd92a245d7d16c3665d2d4e815a4ef28207ad4a1fb46c6f0203cdafeab1b82c4e95e4bdce7805d80a4f4a46074f6542abad708e970550d38a00d759e3dcef1
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/signet/miner4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/signet/miner b/contrib/signet/miner
index 7b7b3feb39..4216ada5fa 100755
--- a/contrib/signet/miner
+++ b/contrib/signet/miner
@@ -58,14 +58,14 @@ def signet_txs(block, challenge):
sd += block.nTime.to_bytes(4, "little")
to_spend = CTransaction()
- to_spend.nVersion = 0
+ to_spend.version = 0
to_spend.nLockTime = 0
to_spend.vin = [CTxIn(COutPoint(0, 0xFFFFFFFF), b"\x00" + CScriptOp.encode_op_pushdata(sd), 0)]
to_spend.vout = [CTxOut(0, challenge)]
to_spend.rehash()
spend = CTransaction()
- spend.nVersion = 0
+ spend.version = 0
spend.nLockTime = 0
spend.vin = [CTxIn(COutPoint(to_spend.sha256, 0), b"", 0)]
spend.vout = [CTxOut(0, b"\x6a")]