From 088d9bc42f75368b351fb799617554597f5810ea Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 13 Feb 2018 14:34:44 +0100 Subject: [PATCH] lnwallet: add VSize method for returning size from TxWeightEstimator --- lnwallet/size.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lnwallet/size.go b/lnwallet/size.go index d633c390..d6821eac 100644 --- a/lnwallet/size.go +++ b/lnwallet/size.go @@ -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 +}