transactions: add a note about `get_vsize` and standardness rules

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This commit is contained in:
Antoine Poinsot 2021-09-24 19:48:36 +02:00
parent 72dbe1d308
commit 826fed53f2
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304
1 changed files with 7 additions and 0 deletions

View File

@ -431,6 +431,13 @@ impl Transaction {
} }
/// Gets the "vsize" of this transaction. Will be `ceil(weight / 4.0)`. /// Gets the "vsize" of this transaction. Will be `ceil(weight / 4.0)`.
/// Note this implements the virtual size as per [`bip141`], which is different
/// to what is implemented in Bitcoin Core. The computation should be the same
/// for any remotely sane transaction, and a standardness-rule-correct version
/// is available in the [`policy`] module.
///
/// [`bip141`]: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki
/// [`policy`]: ../policy/mod.rs.html
#[inline] #[inline]
pub fn get_vsize(&self) -> usize { pub fn get_vsize(&self) -> usize {
let weight = self.get_weight(); let weight = self.get_weight();