lnwallet: add VSize method for returning size from TxWeightEstimator

This commit is contained in:
Johan T. Halseth 2018-02-13 14:34:44 +01:00
parent f6ac5658e2
commit 088d9bc42f
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26
1 changed files with 6 additions and 0 deletions

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
}