We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6a5c4c3 commit 413c3c7Copy full SHA for 413c3c7
src/transaction.rs
@@ -612,6 +612,12 @@ impl Transaction {
612
self.consensus_encode(&mut enc).unwrap();
613
bitcoin::Wtxid::from_engine(enc)
614
}
615
+
616
+ /// Get the total transaction fee.
617
+ pub fn fee(&self) -> u64 {
618
+ // All values should be explicit, so we don't have to assert that here.
619
+ self.output.iter().filter(|o| o.is_fee()).filter_map(|o| o.value.explicit()).sum()
620
+ }
621
622
623
//TODO(stevenroose) remove this, it's incorrect
0 commit comments