bolt: implement tx_add_input message codec#23
Conversation
|
@morehouse picked up tx_add_input since the embedded prevtx field made it the most involved of the interactive-tx codecs. Would love a review when you get a chance. |
2b8012d to
c0af643
Compare
c0af643 to
1058cc3
Compare
morehouse
left a comment
There was a problem hiding this comment.
Thanks for tackling this. Main feedback:
- let's avoid depending on the
bitcoincrate for now - let's add support for the
tlvsfield - please structure the tests similarly to the other codecs (
open_channelis a good example)
1058cc3 to
600f6da
Compare
|
Updated: dropped the bitcoin crate dependency (prevtx is now Vec), added TxAddInputTlvs following the open_channel pattern, and restructured tests to match the other codecs with one test per truncated field. |
600f6da to
b419151
Compare
| } | ||
|
|
||
| #[test] | ||
| fn message_tx_add_input_roundtrip() { |
There was a problem hiding this comment.
Tests should be ordered by the message type number.
7470f73 to
e2d30df
Compare
morehouse
left a comment
There was a problem hiding this comment.
Looks good once these comments are addressed.
| } | ||
|
|
||
| /// Valid `TxAddInput` message for testing. | ||
| fn sample_tx_add_input() -> TxAddInput { |
There was a problem hiding this comment.
Let's move this helper function to directly before message_tx_add_input_roundtrip, for consistency.
There was a problem hiding this comment.
Moved to directly before message_tx_add_input_roundtrip.
6498f66 to
39aa70d
Compare
39aa70d to
f961086
Compare
Implements the
tx_add_inputmessage codec (type 0x0042) for BOLT 2 interactive transaction construction.The
prevtxfield carries a full consensus-encoded Bitcoin transaction, decoded usingbitcoin::consensus::deserializeand length-prefixed on the wire via theWireFormattrait.Includes encode/decode,
Messageenum integration, and tests covering roundtrip, truncation, and trailing bytes.Part of #5