It is more typical in this repo to use `module::Error` instead of a type
alias when importing.
Use `hex::Error` directly instead of `use hex::Error as HexError`.
d882b68a2c Add Script conversion method p2wpkh_script_code (Tobin Harding)
Pull request description:
In order to sign a utxo that does a p2wpkh spend we need to create the
script that can be used to create a sighash. In the libbitcoin docs this
is referred to as the 'script code' [0] (also described in BIP143)
The script is the same as a p2pkh script but the pubkey_hash is found in
the scriptPubkey.
Add a `Script` conversion method that checks if `self` is a v0 p2wpkh
script and if so extracts the pubkey_hash and returns the required
script.
Includes a link to BIP143
[0] https://github.com/libbitcoin/libbitcoin-system/wiki/P2WPKH-Transactions#spending-a-p2wpkh-output
ACKs for top commit:
apoelstra:
ACK d882b68a2c
sanket1729:
code review ACK d882b68a2c.
Tree-SHA512: 9a3244b5aac4e2911edf4d3bb634d3d2b98006b864280a2a04b45c55c263c2541bf25f01196f2a65bf9acbdd0cf28c69c3a020a7e6c8da6fddf7c7cfbb62836d
f92854a805 Add PSBT alias (Tobin Harding)
Pull request description:
Programmers are inherently lazy and for good reason. I'm yet to see
anyone write `PartiallySignedTransaction` in code that uses
`rust-bitcoin`, its too obvious to add a type alias for PSBTs, let's
just do it ourselves to save everyone else having to do so.
Add public type alias `Psbt` for `PartiallySignedTransaction`.
ACKs for top commit:
apoelstra:
ACK f92854a805
sanket1729:
ACK f92854a805
Tree-SHA512: 1f56ac236d34a89bbb557ada147f05d8a8ce961dad3ad921f10f26c597b91ecc8e15070f8825774745e5333ba5282962830a3cc0c53b93f147be93ab566b1b9e
548725c5fb test: reject message (de)serialization (0xb10c)
fc572aba86 fix: use var_str in 'reject' msgs (0xb10c)
Pull request description:
[BIP-61 defines `response-to-msg`][bip61] (`Reject::message` in rust-bitcoin; the message that triggered the reject) to be a `var_str`. However, by using the `CommandString` it was (de)serialized as 12 byte string. A test is added that de- and serializes two reject messages received from an older Bitcoin Core peer.
Reject message sending has been removed from Bitcoin Core, I'm still receiving them from older peers from time to time.
[bip61]: https://github.com/bitcoin/bips/blob/master/bip-0061.mediawiki#common-payload
gh-ref: https://github.com/rust-bitcoin/rust-bitcoin/pull/323
ACKs for top commit:
apoelstra:
ACK 548725c5fb
Tree-SHA512: e5cbf215a471f113b4dd7f7fada162686fc6e8c7b1e2e9e641667208a36d3db610e57e8b549756ffe597656fee5444fe95466f1b88f45366595766f7c4640eea
c97589f8de Fix TapTree derserialization (sanket1729)
Pull request description:
Trees should only be serialized if both of the following conditions
hold:
1) Tree is complete binary tree(is_finalized)
2) Tree does not have any hidden nodes
ACKs for top commit:
tcharding:
ACK c97589f8de
apoelstra:
ACK c97589f8de
Tree-SHA512: 33d16f2d532cb24acba4ab847d493e550f7b279567678f3f2cd7e4161dea8b720a0e35be32b6c506e467c3526a29042aad8f4b5f45133b9a32028d4ee6a48f8e
bd36d846f2 Add temporary warning about edition change (Martin Habovstiak)
Pull request description:
This warns contributors about possible rebases. Changing CONTRIBUTING
should ensure that GitHub will display special warning. This will be
removed after migration is done.
See also https://github.com/rust-bitcoin/rust-bitcoin/discussions/945
ACKs for top commit:
sanket1729:
ACK bd36d846f2
apoelstra:
ACK bd36d846f2
Tree-SHA512: 8fd0c9a0803933c3996340ceb46f6d72ec1896936267c5c14ac1a7c48499a24babad1e096fa3a903fb4aedff6b915fd0ba92dd53f8cc3fd1fa0dbccb9bf7732b
This warns contributors about possible rebases. Changing CONTRIBUTING
should ensure that GitHub will display special warning. This will be
removed after migration is done.
This creates a few primitive functions for handling iterators and uses
them to avoid repeated code. As a result not only is the code simpler
but also fixes a forgotten bound check. Thanks to a helper function
which always does bounds check correctly this can no longer be
forgotten.
38f09d2d93 minor changelog fixes (Andrew Poelstra)
785be0e27a release 0.28.0 (Andrew Poelstra)
c9385969f9 release: do CHANGELOG for 0.28.0 (Andrew Poelstra)
Pull request description:
See discussion here https://github.com/rust-bitcoin/rust-bitcoin/discussions/941 about whether we want to cut the release now or do another slew of breaking changes between RCs.
ACKs for top commit:
sanket1729:
utACK 38f09d2d93. The diff from the previous ACKs is minor easy to review.
Tree-SHA512: e1ebdd637918337bb9d40f35fdcc3bf50fcab2bce095ed41026502af9446d8b27ddc1b87150205a79a4ac30baea96163219e772a757ab85649d503d97cdcb691
This refactors `blockdata::script::Instructions` to use
`::core::slice::Iter<'a, u8>` instead of `&'a [u8]` to better express
the intention and to avoid some slicing mistakes. Similarly to a
previous change this uses a macro to deduplicate the common logic and
the new `read_uint_iter` internal function to automatically advance the
iterator.
Addresses:
https://github.com/rust-bitcoin/rust-bitcoin/pull/662#pullrequestreview-768320603
7969b7a43e Make TaprooBuilder::finalize able to return keyspend only (Jeremy Rubin)
Pull request description:
ACKs for top commit:
JeremyRubin:
> ACK 7969b7a
sanket1729:
ACK 7969b7a43e
apoelstra:
ACK 7969b7a43e
Tree-SHA512: 26d0b730590f610a858061394faafaa74b13dd353f34ccf1c6166d0cbb62937010eed5661a887f7bea4f983ac9eab8cdca10a5fe7bd74f2dd5701a7782cbac64
3c59897598 Removed IntoIterator for TapTree implementation (Dr Maxim Orlovsky)
7a5482d23a Rename LeafInfo into ScriptLeaf (Dr Maxim Orlovsky)
2b8d96581a Rename TapTree::iter into TapTree::script_leaves (Dr Maxim Orlovsky)
6f871ba47d Add convenience LeafInfo::depth method (Dr Maxim Orlovsky)
3c502ffc2d Making all LeafInfo fields private (Dr Maxim Orlovsky)
d655ff3e93 Make TapTreeIterator use LeafInfo (Dr Maxim Orlovsky)
79345fcd02 LeafInfo field accessor methods (Dr Maxim Orlovsky)
5958466678 Make LeafInfo::leaf_hash public and change its name and return type (Dr Maxim Orlovsky)
c83893d497 Make taproot LeafInfo public (Dr Maxim Orlovsky)
Pull request description:
This PR makes existing taproot script iterator to iterate `LeafScript` values instead of constructed `(u8, &Script)`. First, this is more idiomatic (iterator should not construct value but iterate through real internal representation); second information about merkle path of the scripts is required for me downstream to implement OP_RETURN taproot commitments.
The PR also removes unnecessary iterator type, replacing it with a slice iterator type from the core rust library.
I am asking to include this PR into RC fix scope, since it is required downstream.
ACKs for top commit:
sanket1729:
ACK 3c59897598. Reviewed the range-diff with the post that I previously ACKed
Tree-SHA512: 99e341443987204a8aba20869c750bd80a725f3d49d1b5731d554dff7377181b02a4517f8b390101afb2957135dbb255c6e360f90cadd6ee07b17eb14fd30af5
In the future, TapTree may iterate over different node types, and that's why it does not have `iter()` function; using instead `script_leafs`. Thus, we should not have IntoIterator implementation as well
Previously used depth and script tuple missed information about the leaf version.
All three comprises already existing type `LeafInfo` which was made public in
previous commits.
In order to sign a utxo that does a p2wpkh spend we need to create the
script that can be used to create a sighash. In the libbitcoin docs this
is referred to as the 'script code' [0].
The script is the same as a p2pkh script but the pubkey_hash is found in
the scriptPubkey.
Add a `Script` conversion method that checks if `self` is a v0 p2wpkh
script and if so extracts the pubkey_hash and returns the required
script.
[0] https://github.com/libbitcoin/libbitcoin-system/wiki/P2WPKH-Transactions#spending-a-p2wpkh-output
Programmers are inherently lazy and for good reason. I'm yet to see
anyone write `PartiallySignedTransaction` in code that uses
`rust-bitcoin`, its too obvious to add a type alias for PSBTs, let's
just do it ourselves to save everyone else having to do so.
Add public type alias `Psbt` for `PartiallySignedTransaction`.
Trees should only be serialized if both of the following conditions
hold:
1) Tree is complete binary tree(is_finalized)
2) Tree does not have any hidden nodes
c036b0db6f Unit test for failing TapTree on builder containing hidden nodes. (Dr Maxim Orlovsky)
77715311cf Prevent TapTree from hidden parts (Dr Maxim Orlovsky)
b0f3992db1 Rename TaprootBuilder::is_complete into is_finalized (Dr Maxim Orlovsky)
efa800fb1f Make TapTree::from_inner return a proper error type (Dr Maxim Orlovsky)
e24c6e23e3 TapTree serialization roundtrip unit test (Dr Maxim Orlovsky)
56adfa4527 TaprootBuilder::has_hidden_nodes method (Dr Maxim Orlovsky)
e69701e089 Rename taproot `*_hidden` API into `*_hidden_nodes` (Dr Maxim Orlovsky)
6add0dd9dc Track information about hidden leaves in taproot NodeInfo (Dr Maxim Orlovsky)
Pull request description:
Closes#928
ACKs for top commit:
sanket1729:
ACK c036b0db6f. Reviewed the range diff
apoelstra:
ACK c036b0db6f
Tree-SHA512: 3a8193e6d6dd985da30a2094d1111471b5971f422525870003b77b6ac47cd4ad6e718d46a6d86bbb5e92e5253ac53804badf67edd98bbccbdc11e6383c675663
29843c41ef Allow deprecated function call (Tobin Harding)
Pull request description:
We have a deprecated function call because of the MSRV, tell clippy to ignore it.
ACKs for top commit:
Kixunil:
ACK 29843c41ef conditioned on adding this to MSRV bump TODO list.
sanket1729:
ACK 29843c41ef.
Tree-SHA512: 3e2bf95d05c3baff4f01c447717dde4e78d686cbc6f720591f6656ce1e5d8cf3a276a0c3dc0016dea357b61350091778d4500a59427ea9863eb5bb9344b822e4
This adds tests for the previously untested reject message
(de)serialization. The two reject messages were received from an
older Bitcoin Core peer that still sends reject messages.