Merge rust-bitcoin/rust-bitcoin#1335: Improve doc of `Script::push_verify`
7e39082eec
Improve doc of `Script::push_verify` (Martin Habovštiak) Pull request description: This rewords the doc to have a reasonable summary, adds a little background explaining the opcode behavior and the effect of the function when called multiple times. Closes #1154 ACKs for top commit: tcharding: ACK7e39082eec
apoelstra: ACK7e39082eec
Tree-SHA512: 7f0142c9fcec8ef5b30779f1d22922219180aa103ce2f3039412b1d6b46aa7ee2522181e23a76f9ba5fd84720ef3ff3daa8233d71cf10008f5e3b805b5a5c470
This commit is contained in:
commit
1d0b721e5e
|
@ -987,9 +987,16 @@ impl Builder {
|
|||
self
|
||||
}
|
||||
|
||||
/// Adds an `OP_VERIFY` to the script, unless the most-recently-added
|
||||
/// opcode has an alternate `VERIFY` form, in which case that opcode
|
||||
/// is replaced e.g., `OP_CHECKSIG` will become `OP_CHECKSIGVERIFY`.
|
||||
/// Adds an `OP_VERIFY` to the script or replaces the last opcode with VERIFY form.
|
||||
///
|
||||
/// Some opcodes such as `OP_CHECKSIG` have a verify variant that works as if `VERIFY` was
|
||||
/// in the script right after. To save space this function appends `VERIFY` only if
|
||||
/// the most-recently-added opcode *does not* have an alternate `VERIFY` form. If it does
|
||||
/// the last opcode is replaced. E.g., `OP_CHECKSIG` will become `OP_CHECKSIGVERIFY`.
|
||||
///
|
||||
/// Note that existing `OP_*VERIFY` opcodes do not lead to the instruction being ignored
|
||||
/// because `OP_VERIFY` consumes an item from the stack so ignoring them would change the
|
||||
/// semantics.
|
||||
pub fn push_verify(mut self) -> Builder {
|
||||
match self.1 {
|
||||
Some(opcodes::all::OP_EQUAL) => {
|
||||
|
|
Loading…
Reference in New Issue