diff --git a/Cargo.toml b/Cargo.toml index 5ae96727..3f75cfc3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "elements" -version = "0.12.0" +version = "0.12.1" authors = ["Andrew Poelstra "] description = "Library with support for de/serialization, parsing and executing on data structures and network messages related to Elements" license = "CC0-1.0" @@ -24,4 +24,4 @@ optional = true [dev-dependencies] rand = "0.6.5" -serde_json = "1" +serde_json = "<=1.0.44" diff --git a/src/transaction.rs b/src/transaction.rs index 0d5369be..561eae53 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -596,8 +596,16 @@ impl Transaction { self.lock_time.consensus_encode(&mut enc).unwrap(); bitcoin::Txid::from_engine(enc) } + + /// Get the witness txid of the transaction. + pub fn wtxid(&self) -> bitcoin::Wtxid { + let mut enc = Txid::engine(); + self.consensus_encode(&mut enc).unwrap(); + bitcoin::Wtxid::from_engine(enc) + } } +//TODO(stevenroose) remove this, it's incorrect impl BitcoinHash for Transaction { /// To get a transaction's txid, which is usually what you want, use the `txid` method. fn bitcoin_hash(&self) -> Txid {