lnwallet: add VSize method for returning size from TxWeightEstimator

This commit is contained in:
Johan T. Halseth committed 2018-02-26 22:42:24 +01:00
1 parent f6ac5658e2
commit 088d9bc42f
1 file changed
+6
+6
View File
@@ -513,3 +513,9 @@ func (twe *TxWeightEstimator) Weight() int {
}
return weight
}
// VSize gets the estimated virtual size of the transactions, in vbytes.
func (twe *TxWeightEstimator) VSize() int {
// A tx's vsize is 1/4 of the weight, rounded up.
return (twe.Weight() + witnessScaleFactor - 1) / witnessScaleFactor
}