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: ACK1282b7f34b
tcharding: ACK1282b7f34b
Tree-SHA512: 989c83b6bbbfbf8ddd2ade63b5f590f76810f4ec56fab432b580a40e3cc1468a0ea657dcc7ad0d4a31d49eb1390219616fec5a76b5680d5fddc3a06d81db30d7
This commit is contained in:
commit
6e407e44e4
|
@ -232,7 +232,7 @@ impl WatchOnly {
|
|||
|
||||
let sigs: Vec<_> = psbt.inputs[0].partial_sigs.values().collect();
|
||||
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());
|
||||
|
||||
psbt.inputs[0].final_script_witness = Some(script_witness);
|
||||
|
|
|
@ -319,8 +319,8 @@ pub enum AddressData {
|
|||
/// ```
|
||||
///
|
||||
/// 2. `Debug` on `Address<NetworkUnchecked>` does not produce clean address but address wrapped by
|
||||
/// an indicator that its network has not been checked. This is to encourage programmer to properly
|
||||
/// check the network and use `Display` in user-facing context.
|
||||
/// an indicator that its network has not been checked. This is to encourage programmer to properly
|
||||
/// check the network and use `Display` in user-facing context.
|
||||
///
|
||||
/// ```
|
||||
/// # use std::str::FromStr;
|
||||
|
|
|
@ -798,19 +798,16 @@ impl TapTweak for UntweakedKeypair {
|
|||
type TweakedAux = TweakedKeypair;
|
||||
type TweakedKey = TweakedKeypair;
|
||||
|
||||
/// Tweaks private and public keys within an untweaked [`Keypair`] with corresponding public key
|
||||
/// value and optional script tree merkle root.
|
||||
/// Applies a Taproot tweak to both keys within the keypair.
|
||||
///
|
||||
/// This is done by tweaking private key within the pair using the equation q = p + H(P|c), where
|
||||
/// * q is the tweaked private key
|
||||
/// * p is the internal private key
|
||||
/// * H is the hash function
|
||||
/// * c is the commitment data
|
||||
/// The public key is generated from a private key by multiplying with generator point, Q = qG.
|
||||
/// If `merkle_root` is provided, produces a Taproot key that can be spent by any
|
||||
/// of the script paths committed to by the root. If it is not provided, produces
|
||||
/// a Taproot key which can [provably only be spent via
|
||||
/// keyspend](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#cite_note-23).
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// The tweaked key and its parity.
|
||||
/// The tweaked keypair.
|
||||
fn tap_tweak<C: Verification>(
|
||||
self,
|
||||
secp: &Secp256k1<C>,
|
||||
|
|
|
@ -886,8 +886,8 @@ impl<R: Borrow<Transaction>> SighashCache<R> {
|
|||
/// # Warning
|
||||
///
|
||||
/// - Does NOT attempt to support OP_CODESEPARATOR. In general this would require evaluating
|
||||
/// `script_pubkey` to determine which separators get evaluated and which don't, which we don't
|
||||
/// have the information to determine.
|
||||
/// `script_pubkey` to determine which separators get evaluated and which don't, which we don't
|
||||
/// have the information to determine.
|
||||
/// - Does NOT handle the sighash single bug (see "Return type" section)
|
||||
///
|
||||
/// # Returns
|
||||
|
|
|
@ -191,6 +191,7 @@ impl Decodable for MerkleBlock {
|
|||
/// - uint256[] hashes in depth-first order (<= 32*N 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)
|
||||
///
|
||||
/// The size constraints follow from this.
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
pub struct PartialMerkleTree {
|
||||
|
|
|
@ -452,8 +452,8 @@ fn finalize_psbt(mut psbt: Psbt) -> Psbt {
|
|||
let sigs: Vec<_> = psbt.inputs[1].partial_sigs.values().collect();
|
||||
let mut script_witness = Witness::new();
|
||||
script_witness.push([]); // Push 0x00 to the stack.
|
||||
script_witness.push(&sigs[1].to_vec());
|
||||
script_witness.push(&sigs[0].to_vec());
|
||||
script_witness.push(sigs[1].serialize());
|
||||
script_witness.push(sigs[0].serialize());
|
||||
script_witness.push(psbt.inputs[1].witness_script.clone().unwrap().as_bytes());
|
||||
|
||||
script_witness
|
||||
|
|
Loading…
Reference in New Issue