From ebd44ab4c2222254ece0be0976a9bbec3abfcdfd Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Thu, 6 Oct 2022 23:27:03 +0200 Subject: [PATCH 1/2] sweep: fix sweep fee estimation for p2tr outputs --- sweep/sweeper.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sweep/sweeper.go b/sweep/sweeper.go index 28d2bfe..a56c57b 100644 --- a/sweep/sweeper.go +++ b/sweep/sweeper.go @@ -198,6 +198,8 @@ func (s *Sweeper) GetSweepFee(ctx context.Context, weightEstimate.AddP2SHOutput() case *btcutil.AddressPubKeyHash: weightEstimate.AddP2PKHOutput() + case *btcutil.AddressTaproot: + weightEstimate.AddP2TROutput() default: return 0, fmt.Errorf("unknown address type %T", destAddr) } From 8d210424327cffbac519255e1da76e3aa7046523 Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Fri, 7 Oct 2022 08:33:49 +0200 Subject: [PATCH 2/2] sweeper: fix formatting and update error --- sweep/sweeper.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sweep/sweeper.go b/sweep/sweeper.go index a56c57b..4a35c1a 100644 --- a/sweep/sweeper.go +++ b/sweep/sweeper.go @@ -192,16 +192,22 @@ func (s *Sweeper) GetSweepFee(ctx context.Context, switch destAddr.(type) { case *btcutil.AddressWitnessScriptHash: weightEstimate.AddP2WSHOutput() + case *btcutil.AddressWitnessPubKeyHash: weightEstimate.AddP2WKHOutput() + case *btcutil.AddressScriptHash: weightEstimate.AddP2SHOutput() + case *btcutil.AddressPubKeyHash: weightEstimate.AddP2PKHOutput() + case *btcutil.AddressTaproot: weightEstimate.AddP2TROutput() + default: - return 0, fmt.Errorf("unknown address type %T", destAddr) + return 0, fmt.Errorf("estimate fee: unknown address type %T", + destAddr) } err = addInputEstimate(&weightEstimate)