SoftwareVerde / bitcoin-cash-specification

Specification of the Bitcoin Cash protocols and consensus
Other
8 stars 5 forks source link

Address size of the input sequence number #28

Closed monsterbitar closed 2 years ago

monsterbitar commented 2 years ago

According to https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/replay-protected-sighash.md, the nSequence field should be 4-byte little endian.

joshmg commented 2 years ago

Oh, good catch! This looks like it was just an honest mistake by whoever wrote this part of the spec. For sanity, I confirmed, and that's what our codebase says too: https://github.com/softwareverde/bitcoin-verde/blob/master/src/main/java/com/softwareverde/bitcoin/transaction/input/TransactionInputDeflater.java#L17

And here is where the transaction signer grabs the SequenceNumber, which is serialized as 4 bytes (not 8): https://github.com/SoftwareVerde/bitcoin-verde/blob/master/src/main/java/com/softwareverde/bitcoin/transaction/signer/BitcoinCashTransactionSignerUtil.java#L109

Merging.