From a843f4f690d61144c25aaf84e431488ad611eb93 Mon Sep 17 00:00:00 2001 From: Gijs van Dam Date: Thu, 14 Nov 2024 16:57:02 +0100 Subject: [PATCH] tapfreighter: bump feerate to min relay fee If the fee estimation returns a fee rate lower than the min relay fee, we should use the min relay fee instead. This commit implements this behavior for the tapfreighter. --- tapfreighter/chain_porter.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tapfreighter/chain_porter.go b/tapfreighter/chain_porter.go index 3fbb6790d..2d9a2162f 100644 --- a/tapfreighter/chain_porter.go +++ b/tapfreighter/chain_porter.go @@ -1128,6 +1128,17 @@ func (p *ChainPorter) stateStep(currentPkg sendPackage) (*sendPackage, error) { return nil, fmt.Errorf("unable to estimate "+ "fee: %w", err) } + minRelayFee, err := p.cfg.Wallet.MinRelayFee(ctx) + if err != nil { + return nil, fmt.Errorf("unable to obtain "+ + "minimum relay fee: %w", err) + } + + // If the fee rate is below the minimum relay fee, we'll + // bump it up. + if feeRate < minRelayFee { + feeRate = minRelayFee + } } readableFeeRate := feeRate.FeePerKVByte().String()