Skip to content

Commit 1e3f09f

Browse files
committed
Add wtxid method for Transaction
1 parent 6269a1b commit 1e3f09f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/transaction.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,16 @@ impl Transaction {
596596
self.lock_time.consensus_encode(&mut enc).unwrap();
597597
bitcoin::Txid::from_engine(enc)
598598
}
599+
600+
/// Get the witness txid of the transaction.
601+
pub fn wtxid(&self) -> bitcoin::Wtxid {
602+
let mut enc = Txid::engine();
603+
self.consensus_encode(&mut enc).unwrap();
604+
bitcoin::Wtxid::from_engine(enc)
605+
}
599606
}
600607

608+
//TODO(stevenroose) remove this, it's incorrect
601609
impl BitcoinHash<Txid> for Transaction {
602610
/// To get a transaction's txid, which is usually what you want, use the `txid` method.
603611
fn bitcoin_hash(&self) -> Txid {

0 commit comments

Comments
 (0)