htlcswitch: add dedicated block subscription to interceptable switch

Preparation for making the interceptable switch aware of expiring htlcs.
This commit is contained in:
Joost Jager
2022-08-15 15:28:23 +02:00
parent 4a3e90f4d0
commit a6df9567ba
4 changed files with 92 additions and 5 deletions

View File

@@ -359,6 +359,13 @@ func createTestPeer(t *testing.T, notifier chainntnfs.ChainNotifier,
ChainNet: wire.SimNet,
}
interceptableSwitchNotifier := &mock.ChainNotifier{
EpochChan: make(chan *chainntnfs.BlockEpoch, 1),
}
interceptableSwitchNotifier.EpochChan <- &chainntnfs.BlockEpoch{
Height: 1,
}
cfg := &Config{
Addr: cfgAddr,
PubKeyBytes: pubKey,
@@ -369,6 +376,7 @@ func createTestPeer(t *testing.T, notifier chainntnfs.ChainNotifier,
InterceptSwitch: htlcswitch.NewInterceptableSwitch(
&htlcswitch.InterceptableSwitchConfig{
CltvRejectDelta: testCltvRejectDelta,
Notifier: interceptableSwitchNotifier,
},
),
ChannelDB: dbAlice.ChannelStateDB(),