We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c8fb64 commit 3e0db90Copy full SHA for 3e0db90
1 file changed
src/transaction.rs
@@ -869,6 +869,15 @@ impl Transaction {
869
self.scaled_size(1)
870
}
871
872
+ /// Returns the "virtual size" (vsize) of this transaction.
873
+ ///
874
+ /// Will be `ceil(weight / 4.0)`.
875
+ #[inline]
876
+ pub fn vsize(&self) -> usize {
877
+ let weight = self.weight();
878
+ (weight + 4 - 1) / 4
879
+ }
880
+
881
fn scaled_size(&self, scale_factor: usize) -> usize {
882
let witness_flag = self.has_witness();
883
0 commit comments