From e765f39f74dec8e02d232e440e809bf101b894da Mon Sep 17 00:00:00 2001 From: Amirhossein Mirkazemi Date: Mon, 21 Mar 2022 21:34:04 +0330 Subject: [PATCH] txsizes: count change output in estimating tx size in estimating transaction size, the number of transaction outputs sometimes was calculated one less than actual since change output was not counted; this commit makes sure that it's counted when it exists. --- wallet/txsizes/size.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/txsizes/size.go b/wallet/txsizes/size.go index 1522e37aca..2cdfdcc19b 100644 --- a/wallet/txsizes/size.go +++ b/wallet/txsizes/size.go @@ -178,7 +178,7 @@ func EstimateVirtualSize(numP2PKHIns, numP2WPKHIns, numNestedP2WPKHIns int, baseSize := 8 + wire.VarIntSerializeSize( uint64(numP2PKHIns+numP2WPKHIns+numNestedP2WPKHIns)) + - wire.VarIntSerializeSize(uint64(len(txOuts))) + + wire.VarIntSerializeSize(uint64(outputCount)) + numP2PKHIns*RedeemP2PKHInputSize + numP2WPKHIns*RedeemP2WPKHInputSize + numNestedP2WPKHIns*RedeemNestedP2WPKHInputSize +