htlcswitch: respect minimum relay fee

When channels fee rates are being considered for an update, the minimum
relay fee should also be considered.
This commit is contained in:
Elle Mouton
2021-06-23 14:28:25 +02:00
parent 6712595618
commit f667683e6c
5 changed files with 317 additions and 60 deletions

View File

@@ -71,6 +71,7 @@ func (m *mockPreimageCache) SubscribeUpdates() *contractcourt.WitnessSubscriptio
type mockFeeEstimator struct {
byteFeeIn chan chainfee.SatPerKWeight
relayFee chan chainfee.SatPerKWeight
quit chan struct{}
}
@@ -78,6 +79,7 @@ type mockFeeEstimator struct {
func newMockFeeEstimator() *mockFeeEstimator {
return &mockFeeEstimator{
byteFeeIn: make(chan chainfee.SatPerKWeight),
relayFee: make(chan chainfee.SatPerKWeight),
quit: make(chan struct{}),
}
}
@@ -94,7 +96,12 @@ func (m *mockFeeEstimator) EstimateFeePerKW(
}
func (m *mockFeeEstimator) RelayFeePerKW() chainfee.SatPerKWeight {
return 1e3
select {
case feeRate := <-m.relayFee:
return feeRate
case <-m.quit:
return 0
}
}
func (m *mockFeeEstimator) Start() error {