htlcswitch: init mockFeeEstimator in other LinkChannelConfigs
If the tests don't execute quick enough, the link will try to sample the network fee and cause a panic. This happens semi-regularly on travis.
This commit is contained in:
3 files changed
+10
-6
No files matched your search
@@ -1967,6 +1967,7 @@ func newSingleLinkTestHarness(chanAmt, chanReserve btcutil.Amount) (
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Registry: invoiceRegistry,
|
Registry: invoiceRegistry,
|
||||||
|
FeeEstimator: newMockFeeEstimator(),
|
||||||
ChainEvents: &contractcourt.ChainEventSubscription{},
|
ChainEvents: &contractcourt.ChainEventSubscription{},
|
||||||
BatchTicker: bticker,
|
BatchTicker: bticker,
|
||||||
FwdPkgGCTicker: ticker.NewForce(15 * time.Second),
|
FwdPkgGCTicker: ticker.NewForce(15 * time.Second),
|
||||||
@@ -4469,6 +4470,7 @@ func (h *persistentLinkHarness) restartLink(
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Registry: h.coreLink.cfg.Registry,
|
Registry: h.coreLink.cfg.Registry,
|
||||||
|
FeeEstimator: newMockFeeEstimator(),
|
||||||
ChainEvents: &contractcourt.ChainEventSubscription{},
|
ChainEvents: &contractcourt.ChainEventSubscription{},
|
||||||
BatchTicker: bticker,
|
BatchTicker: bticker,
|
||||||
FwdPkgGCTicker: ticker.New(5 * time.Second),
|
FwdPkgGCTicker: ticker.New(5 * time.Second),
|
||||||
|
|||||||
@@ -74,6 +74,13 @@ type mockFeeEstimator struct {
|
|||||||
quit chan struct{}
|
quit chan struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func newMockFeeEstimator() *mockFeeEstimator {
|
||||||
|
return &mockFeeEstimator{
|
||||||
|
byteFeeIn: make(chan chainfee.SatPerKWeight),
|
||||||
|
quit: make(chan struct{}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (m *mockFeeEstimator) EstimateFeePerKW(
|
func (m *mockFeeEstimator) EstimateFeePerKW(
|
||||||
numBlocks uint32) (chainfee.SatPerKWeight, error) {
|
numBlocks uint32) (chainfee.SatPerKWeight, error) {
|
||||||
|
|
||||||
|
|||||||
@@ -1098,13 +1098,8 @@ func newHopNetwork() *hopNetwork {
|
|||||||
}
|
}
|
||||||
obfuscator := NewMockObfuscator()
|
obfuscator := NewMockObfuscator()
|
||||||
|
|
||||||
feeEstimator := &mockFeeEstimator{
|
|
||||||
byteFeeIn: make(chan chainfee.SatPerKWeight),
|
|
||||||
quit: make(chan struct{}),
|
|
||||||
}
|
|
||||||
|
|
||||||
return &hopNetwork{
|
return &hopNetwork{
|
||||||
feeEstimator: feeEstimator,
|
feeEstimator: newMockFeeEstimator(),
|
||||||
globalPolicy: globalPolicy,
|
globalPolicy: globalPolicy,
|
||||||
obfuscator: obfuscator,
|
obfuscator: obfuscator,
|
||||||
defaultDelta: defaultDelta,
|
defaultDelta: defaultDelta,
|
||||||
|
|||||||
Reference in new issue
Block a user