Merge rust-bitcoin/rust-bitcoin#2809: doc: fix "lazy line continuations" in markdown

1282b7f34b examples: drop a couple allocations (Andrew Poelstra)
45e0241267 doc: fix "lazy line continuations" in markdown (Andrew Poelstra)

Pull request description:

  Rust nightly as of 2024-05-27 has a new lint which detects list items which are continued by a non-indented line. Markdown treats these as single list items, which they sometimes are, but sometimes we intended them to be on a separate line.

  Also changes the docs for `UntweakedKeypair::tap_tweak` because the existing ones were overly technical and out-of-date.

  Also fixes a minor "no need to create a vec then dereference it" lint in the examples.

ACKs for top commit:
  storopoli:
    ACK 1282b7f34b
  tcharding:
    ACK 1282b7f34b

Tree-SHA512: 989c83b6bbbfbf8ddd2ade63b5f590f76810f4ec56fab432b580a40e3cc1468a0ea657dcc7ad0d4a31d49eb1390219616fec5a76b5680d5fddc3a06d81db30d7
This commit is contained in:
Andrew Poelstra 2024-05-28 13:06:06 +00:00
commit 6e407e44e4
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
6 changed files with 14 additions and 16 deletions

View File

@ -232,7 +232,7 @@ impl WatchOnly {
let sigs: Vec<_> = psbt.inputs[0].partial_sigs.values().collect(); let sigs: Vec<_> = psbt.inputs[0].partial_sigs.values().collect();
let mut script_witness: Witness = Witness::new(); let mut script_witness: Witness = Witness::new();
script_witness.push(&sigs[0].to_vec()); script_witness.push(sigs[0].serialize());
script_witness.push(self.input_xpub.to_pub().to_bytes()); script_witness.push(self.input_xpub.to_pub().to_bytes());
psbt.inputs[0].final_script_witness = Some(script_witness); psbt.inputs[0].final_script_witness = Some(script_witness);

View File

@ -798,19 +798,16 @@ impl TapTweak for UntweakedKeypair {
type TweakedAux = TweakedKeypair; type TweakedAux = TweakedKeypair;
type TweakedKey = TweakedKeypair; type TweakedKey = TweakedKeypair;
/// Tweaks private and public keys within an untweaked [`Keypair`] with corresponding public key /// Applies a Taproot tweak to both keys within the keypair.
/// value and optional script tree merkle root.
/// ///
/// This is done by tweaking private key within the pair using the equation q = p + H(P|c), where /// If `merkle_root` is provided, produces a Taproot key that can be spent by any
/// * q is the tweaked private key /// of the script paths committed to by the root. If it is not provided, produces
/// * p is the internal private key /// a Taproot key which can [provably only be spent via
/// * H is the hash function /// keyspend](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#cite_note-23).
/// * c is the commitment data
/// The public key is generated from a private key by multiplying with generator point, Q = qG.
/// ///
/// # Returns /// # Returns
/// ///
/// The tweaked key and its parity. /// The tweaked keypair.
fn tap_tweak<C: Verification>( fn tap_tweak<C: Verification>(
self, self,
secp: &Secp256k1<C>, secp: &Secp256k1<C>,

View File

@ -191,6 +191,7 @@ impl Decodable for MerkleBlock {
/// - uint256[] hashes in depth-first order (<= 32*N bytes) /// - uint256[] hashes in depth-first order (<= 32*N bytes)
/// - varint number of bytes of flag bits (1-3 bytes) /// - varint number of bytes of flag bits (1-3 bytes)
/// - byte[] flag bits, packed per 8 in a byte, least significant bit first (<= 2*N-1 bits) /// - byte[] flag bits, packed per 8 in a byte, least significant bit first (<= 2*N-1 bits)
///
/// The size constraints follow from this. /// The size constraints follow from this.
#[derive(PartialEq, Eq, Clone, Debug)] #[derive(PartialEq, Eq, Clone, Debug)]
pub struct PartialMerkleTree { pub struct PartialMerkleTree {

View File

@ -452,8 +452,8 @@ fn finalize_psbt(mut psbt: Psbt) -> Psbt {
let sigs: Vec<_> = psbt.inputs[1].partial_sigs.values().collect(); let sigs: Vec<_> = psbt.inputs[1].partial_sigs.values().collect();
let mut script_witness = Witness::new(); let mut script_witness = Witness::new();
script_witness.push([]); // Push 0x00 to the stack. script_witness.push([]); // Push 0x00 to the stack.
script_witness.push(&sigs[1].to_vec()); script_witness.push(sigs[1].serialize());
script_witness.push(&sigs[0].to_vec()); script_witness.push(sigs[0].serialize());
script_witness.push(psbt.inputs[1].witness_script.clone().unwrap().as_bytes()); script_witness.push(psbt.inputs[1].witness_script.clone().unwrap().as_bytes());
script_witness script_witness