Encode key type as u64 instead of u8#90
Conversation
721028c to
e1e4933
Compare
| pub(crate) const PSBT_GLOBAL_XPUB: u64 = 0x01; | ||
| /// Type: Transaction Version PSBT_GLOBAL_TX_VERSION = 0x02 | ||
| pub(crate) const PSBT_GLOBAL_TX_VERSION: u8 = 0x02; | ||
| pub(crate) const PSBT_GLOBAL_TX_VERSION: u64 = 0x02; |
There was a problem hiding this comment.
All these changes, while correct, are unrelated to this PR, right? Can we have them either as a separate patch (with explanation) or separate PR.
There was a problem hiding this comment.
Oh sorry mate, I missed that these const were the keytype values. My bad.
e1e4933 to
8fca8d6
Compare
|
EDIT: Oh you fix this in #94 I could be confused again but I think this is buggy mate. let key_byte_size: u64 = byte_size - 1;Needs to be |
|
I split this PR based on this comment:
That's why I opened #94, working on top of these changes, and expecting to merge them as stacked PRs. |
8fca8d6 to
9eab32f
Compare
`type_value` represents the `keytype` of a Key. The BIP 174 specifies that the `keytype` field is a compact size unsigned integer, i.e., it can be as large as u64::MAX. There hasn't been any larger keytypes specified, so u8 has been fine so far, but it isn't correct. This change enlarges the `type_value` field to hold the full compact size unsigned integer.
9eab32f to
d47ab6d
Compare
3d23615 fix: handle multi byte keytypes in Key::decode and Key::encode (nymius) d47ab6d fix: encode keytype as u64 instead of u8 (nymius) Pull request description: `<keytype>` as specified by BIP 174 may be represented with up to 8 bytes, even if minimally encoded. Because the currently specified fields weren't using as many bytes, we were only considering the single byte case in the `Key::decode` and `Key::encode` logic. Here we change this logic to address larger `<keytypes>` and follow the specification. Stacks on top of: #90, #93. Fixes #78. ACKs for top commit: nyonson: ACK 3d23615 tcharding: ACK 3d23615 Tree-SHA512: f6d12532eabd702979020835f23f7e588620014f8850e15d02dcbea20f253eea894f5a9f36b95d66a55f0e38a3b6a6701e8ca06aff88f6c70eb57600d59c9ef1
|
Went in in #94 |
I used the changes in
rust-bitcoin/rust-bitcoin#5625rust-bitcoin/rust-bitcoin#2906 to create this patch.Partially fixes #78