htlcswitch: add InterceptableSwitchConfig
Preparation for adding more config options.
This commit is contained in:
4 files changed
+43
-12
No files matched your search
@@ -3846,7 +3846,10 @@ func TestSwitchHoldForward(t *testing.T) {
|
||||
interceptedChan: make(chan InterceptedPacket),
|
||||
}
|
||||
switchForwardInterceptor := NewInterceptableSwitch(
|
||||
s, cltvRejectDelta, false,
|
||||
&InterceptableSwitchConfig{
|
||||
Switch: s,
|
||||
CltvRejectDelta: cltvRejectDelta,
|
||||
},
|
||||
)
|
||||
require.NoError(t, switchForwardInterceptor.Start())
|
||||
|
||||
@@ -4037,7 +4040,13 @@ func TestSwitchHoldForward(t *testing.T) {
|
||||
require.NoError(t, switchForwardInterceptor.Stop())
|
||||
|
||||
// Test always-on interception.
|
||||
switchForwardInterceptor = NewInterceptableSwitch(s, cltvRejectDelta, true)
|
||||
switchForwardInterceptor = NewInterceptableSwitch(
|
||||
&InterceptableSwitchConfig{
|
||||
Switch: s,
|
||||
CltvRejectDelta: cltvRejectDelta,
|
||||
RequireInterceptor: true,
|
||||
},
|
||||
)
|
||||
require.NoError(t, switchForwardInterceptor.Start())
|
||||
|
||||
// Forward a fresh packet. It is expected to be failed immediately,
|
||||
@@ -5329,7 +5338,11 @@ func testSwitchAliasInterceptFail(t *testing.T, zeroConf bool) {
|
||||
t: t,
|
||||
interceptedChan: make(chan InterceptedPacket),
|
||||
}
|
||||
interceptSwitch := NewInterceptableSwitch(s, 0, false)
|
||||
interceptSwitch := NewInterceptableSwitch(
|
||||
&InterceptableSwitchConfig{
|
||||
Switch: s,
|
||||
},
|
||||
)
|
||||
require.NoError(t, interceptSwitch.Start())
|
||||
interceptSwitch.SetInterceptor(forwardInterceptor.InterceptForwardHtlc)
|
||||
|
||||
|
||||
Reference in new issue
Block a user