Bitcoin Forum
May 25, 2024, 06:57:14 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Bitcoin Technical Support / Why is this transaction version not a signed integer? on: January 23, 2024, 01:11:08 PM
Hi,
when I query transaction 5839f20446d7b9446e82c00117ee3699fa84154e970d57f09add60deef2eaa18 on the bitcoin testnet, my node's RPC reports a transaction version of 4294967295 (which is 0xFFFFFFFF).
However, according to https://developer.bitcoin.org/reference/transactions.html, this value should be signed integer of 4 bytes. This implementation https://docs.rs/bitcoin/0.31.1/bitcoin/blockdata/transaction/struct.Version.html follows the same rule and even implies that transactions with such a version would not be relayed by the network (but obviously still appear in blocks!). I wonder why the RPC does not return a version of -1 here, but instead a number that cannot be parsed into a signed 32bit integer?
BIP 68 even contains some reference code that implies that it should be a signed integer:
Code:
    // tx.nVersion is signed integer so requires cast to unsigned otherwise
    // we would be doing a signed comparison and half the range of nVersion
    // wouldn't support BIP 68.
    bool fEnforceBIP68 = static_cast<uint32_t>(tx.nVersion) >= 2
                      && flags & LOCKTIME_VERIFY_SEQUENCE;

Is this a bug in the bitcoin RPC serializer?
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!