mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
test: implement MinRelayFee RPC
This commit is contained in:
parent
149bffcad7
commit
45aa156977
2 changed files with 24 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue