Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #41 from stevenroose/wtxid
Add wtxid method for Transaction
  • Loading branch information
apoelstra committed Feb 14, 2020
2 parents 6269a1b + 715aa7f commit 9718e2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "elements"
version = "0.12.0"
version = "0.12.1"
authors = ["Andrew Poelstra <apoelstra@blockstream.com>"]
description = "Library with support for de/serialization, parsing and executing on data structures and network messages related to Elements"
license = "CC0-1.0"
Expand All @@ -24,4 +24,4 @@ optional = true

[dev-dependencies]
rand = "0.6.5"
serde_json = "1"
serde_json = "<=1.0.44"
8 changes: 8 additions & 0 deletions src/transaction.rs
Expand Up @@ -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<Txid> for Transaction {
/// To get a transaction's txid, which is usually what you want, use the `txid` method.
fn bitcoin_hash(&self) -> Txid {
Expand Down

0 comments on commit 9718e2c

Please sign in to comment.