From 826fed53f21c8a2380a157247e5eaf5ac9d61e62 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Fri, 24 Sep 2021 19:48:36 +0200 Subject: [PATCH] transactions: add a note about `get_vsize` and standardness rules Signed-off-by: Antoine Poinsot --- src/blockdata/transaction.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/blockdata/transaction.rs b/src/blockdata/transaction.rs index fd122728..b4ab122a 100644 --- a/src/blockdata/transaction.rs +++ b/src/blockdata/transaction.rs @@ -431,6 +431,13 @@ impl Transaction { } /// 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] pub fn get_vsize(&self) -> usize { let weight = self.get_weight();