Add weight, size, and vsize methods on the Transaction type

This commit is contained in:
thunderbiscuit 2023-02-01 16:20:41 -05:00
parent d48bacd29b
commit 1e9ecfbe52
No known key found for this signature in database
GPG Key ID: 88253696EB836462
2 changed files with 21 additions and 3 deletions

View File

@ -248,6 +248,12 @@ interface Transaction {
constructor(sequence<u8> transaction_bytes);
sequence<u8> serialize();
u64 weight();
u64 size();
u64 vsize();
};
interface PartiallySignedTransaction {

View File

@ -254,6 +254,18 @@ impl Transaction {
fn serialize(&self) -> Vec<u8> {
self.internal.serialize()
}
fn weight(&self) -> u64 {
self.internal.weight() as u64
}
fn size(&self) -> u64 {
self.internal.size() as u64
}
fn vsize(&self) -> u64 {
self.internal.vsize() as u64
}
}
/// A Bitcoin address.