diff --git a/bitcoin/src/blockdata/script/builder.rs b/bitcoin/src/blockdata/script/builder.rs index a69b19eb..cecdcce2 100644 --- a/bitcoin/src/blockdata/script/builder.rs +++ b/bitcoin/src/blockdata/script/builder.rs @@ -7,8 +7,10 @@ use core::fmt; use secp256k1::XOnlyPublicKey; +use crate::blockdata::locktime::absolute; use crate::blockdata::opcodes::{self, all::*}; use crate::blockdata::script::{write_scriptint, opcode_to_verify, Script, ScriptBuf}; +use crate::blockdata::transaction::Sequence; use crate::key::PublicKey; use crate::prelude::*; @@ -106,6 +108,16 @@ impl Builder { } } + /// Adds instructions to push an absolute lock time onto the stack. + pub fn push_lock_time(self, lock_time: absolute::LockTime) -> Builder { + self.push_int(lock_time.to_consensus_u32().into()) + } + + /// Adds instructions to push a sequence number onto the stack. + pub fn push_sequence(self, sequence: Sequence) -> Builder { + self.push_int(sequence.to_consensus_u32().into()) + } + /// Converts the `Builder` into `ScriptBuf`. pub fn into_script(self) -> ScriptBuf { self.0