Improve docs: encode_signing_data_to/signature_hash
The two methods `encode_signing_data_to` and `signature_hash` use the same docs (one is a public helper for the other). The docs have gotten a bit stale (refer to deprecated types). Instead of duplicating all the text, add a statement pointing readers from the docs of `signature_hash` to the docs on `encode_signing_data_to`.
This commit is contained in:
parent
337caad880
commit
3bcc146a44
|
@ -310,20 +310,23 @@ impl Transaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Encodes the signing data from which a signature hash for a given input index with a given
|
/// Encodes the signing data from which a signature hash for a given input index with a given
|
||||||
/// sighash flag can be computed. To actually produce a scriptSig, this hash needs to be run
|
/// sighash flag can be computed.
|
||||||
/// through an ECDSA signer, the SigHashType appended to the resulting sig, and a script
|
|
||||||
/// written around this, but this is the general (and hard) part.
|
|
||||||
///
|
///
|
||||||
/// The `sighash_type` supports arbitrary `u32` value, instead of just [`SigHashType`],
|
/// To actually produce a scriptSig, this hash needs to be run through an ECDSA signer, the
|
||||||
/// because internally 4 bytes are being hashed, even though only lowest byte
|
/// [`EcdsaSigHashType`] appended to the resulting sig, and a script written around this, but
|
||||||
/// is appended to signature in a transaction.
|
/// this is the general (and hard) part.
|
||||||
///
|
///
|
||||||
/// *Warning* This does NOT attempt to support OP_CODESEPARATOR. In general this would require
|
/// The `sighash_type` supports an arbitrary `u32` value, instead of just [`EcdsaSigHashType`],
|
||||||
/// evaluating `script_pubkey` to determine which separators get evaluated and which don't,
|
/// because internally 4 bytes are being hashed, even though only lowest byte is appended to
|
||||||
/// which we don't have the information to determine.
|
/// signature in a transaction.
|
||||||
|
///
|
||||||
|
/// **Warning**: This 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.
|
||||||
///
|
///
|
||||||
/// # Panics
|
/// # Panics
|
||||||
/// Panics if `input_index` is greater than or equal to `self.input.len()`
|
///
|
||||||
|
/// If `input_index` is out of bounds (greater than or equal to `self.input.len()`).
|
||||||
pub fn encode_signing_data_to<Write: io::Write, U: Into<u32>>(
|
pub fn encode_signing_data_to<Write: io::Write, U: Into<u32>>(
|
||||||
&self,
|
&self,
|
||||||
mut writer: Write,
|
mut writer: Write,
|
||||||
|
@ -392,18 +395,8 @@ impl Transaction {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes a signature hash for a given input index with a given sighash flag.
|
/// Computes a signature hash for a given input index with a given sighash flag.
|
||||||
/// To actually produce a scriptSig, this hash needs to be run through an
|
|
||||||
/// ECDSA signer, the SigHashType appended to the resulting sig, and a
|
|
||||||
/// script written around this, but this is the general (and hard) part.
|
|
||||||
///
|
|
||||||
/// *Warning* This 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.
|
|
||||||
///
|
|
||||||
/// # Panics
|
|
||||||
/// Panics if `input_index` is greater than or equal to `self.input.len()`
|
|
||||||
///
|
///
|
||||||
|
/// Please refer [`Self::encode_signing_data_to`] for full documentation of this method.
|
||||||
pub fn signature_hash(
|
pub fn signature_hash(
|
||||||
&self,
|
&self,
|
||||||
input_index: usize,
|
input_index: usize,
|
||||||
|
|
Loading…
Reference in New Issue