Skip to content

Commit cd61512

Browse files
feat: implement From trait on BitcoinTxIn reference
1 parent 01e4ffe commit cd61512

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,17 @@ impl From<BitcoinTxIn> for TxIn {
188188
}
189189
}
190190

191+
impl From<&BitcoinTxIn> for TxIn {
192+
fn from(tx_in: &BitcoinTxIn) -> Self {
193+
TxIn {
194+
previous_output: tx_in.previous_output,
195+
script_sig: Arc::new(tx_in.script_sig.clone().into()),
196+
sequence: tx_in.sequence.0,
197+
witness: tx_in.witness.to_vec(),
198+
}
199+
}
200+
}
201+
191202
impl From<TxIn> for BitcoinTxIn {
192203
fn from(value: TxIn) -> Self {
193204
Self {

0 commit comments

Comments
 (0)