Optimize `Transaction.get_vsize()` (thanks @TheBlueMatt).
This commit is contained in:
parent
2085dc32a7
commit
1bf9147a6e
|
@ -430,7 +430,7 @@ impl Transaction {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn get_vsize(&self) -> usize {
|
pub fn get_vsize(&self) -> usize {
|
||||||
let weight = self.get_weight();
|
let weight = self.get_weight();
|
||||||
(weight / WITNESS_SCALE_FACTOR) + if weight % WITNESS_SCALE_FACTOR == 0 { 0 } else { 1 }
|
(weight + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Internal utility function for get_{size,weight}
|
/// Internal utility function for get_{size,weight}
|
||||||
|
|
Loading…
Reference in New Issue