diff --git a/test/lnd_services_mock.go b/test/lnd_services_mock.go index db444744..07e25170 100644 --- a/test/lnd_services_mock.go +++ b/test/lnd_services_mock.go @@ -29,6 +29,7 @@ func NewMockLnd() *LndMockServices { lightningClient := &mockLightningClient{} walletKit := &mockWalletKit{ feeEstimates: make(map[int32]chainfee.SatPerKWeight), + minRelayFee: chainfee.FeePerKwFloor, } chainNotifier := &mockChainNotifier{} signer := &mockSigner{} @@ -278,3 +279,7 @@ func (s *LndMockServices) SetFeeEstimate(confTarget int32, confTarget, feeEstimate, ) } + +func (s *LndMockServices) SetMinRelayFee(feeEstimate chainfee.SatPerKWeight) { + s.LndServices.WalletKit.(*mockWalletKit).setMinRelayFee(feeEstimate) +} diff --git a/test/walletkit_mock.go b/test/walletkit_mock.go index 0f7ccee9..e4d4e38b 100644 --- a/test/walletkit_mock.go +++ b/test/walletkit_mock.go @@ -34,6 +34,7 @@ type mockWalletKit struct { feeEstimateLock sync.Mutex feeEstimates map[int32]chainfee.SatPerKWeight + minRelayFee chainfee.SatPerKWeight } var _ lndclient.WalletKitClient = (*mockWalletKit)(nil) @@ -169,6 +170,24 @@ func (m *mockWalletKit) EstimateFeeRate(ctx context.Context, return feeEstimate, nil } +func (m *mockWalletKit) setMinRelayFee(fee chainfee.SatPerKWeight) { + m.feeEstimateLock.Lock() + defer m.feeEstimateLock.Unlock() + + m.minRelayFee = fee +} + +// MinRelayFee returns the current minimum relay fee based on our chain backend +// in sat/kw. It can be set with setMinRelayFee. +func (m *mockWalletKit) MinRelayFee( + ctx context.Context) (chainfee.SatPerKWeight, error) { + + m.feeEstimateLock.Lock() + defer m.feeEstimateLock.Unlock() + + return m.minRelayFee, nil +} + // ListSweeps returns a list of the sweep transaction ids known to our node. func (m *mockWalletKit) ListSweeps(_ context.Context, _ int32) ( []string, error) {