Merge rust-bitcoin/rust-bitcoin#665: transactions: add a note about `get_vsize` and standardness rules

826fed53f2 transactions: add a note about `get_vsize` and standardness rules (Antoine Poinsot)

Pull request description:

  If they ever hit a discrepancy they must really be doing something dodgy but hey :)

ACKs for top commit:
  dr-orlovsky:
    ACK 826fed53f2

Tree-SHA512: c618a80b047797625a233939d2c1146e8b4ce44215648841813f78178577afc844f5e561e4e60b4084e315735894ecb354af8d81f4702f5354e5d5cd05b52ac4
This commit is contained in:
sanket1729 2021-12-28 02:32:59 +05:30
commit b945a5e5c6
No known key found for this signature in database
GPG Key ID: 648FFB183E0870A2
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();