Skip to content

Commit 9718e2c

Browse files
authored
Merge pull request #41 from stevenroose/wtxid
Add wtxid method for Transaction
2 parents 6269a1b + 715aa7f commit 9718e2c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "elements"
3-
version = "0.12.0"
3+
version = "0.12.1"
44
authors = ["Andrew Poelstra <apoelstra@blockstream.com>"]
55
description = "Library with support for de/serialization, parsing and executing on data structures and network messages related to Elements"
66
license = "CC0-1.0"
@@ -24,4 +24,4 @@ optional = true
2424

2525
[dev-dependencies]
2626
rand = "0.6.5"
27-
serde_json = "1"
27+
serde_json = "<=1.0.44"

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)