@@ -13,7 +13,6 @@ import (
1313 "github.com/lightninglabs/loop/loopdb"
1414 "github.com/lightninglabs/loop/swap"
1515 "github.com/lightninglabs/loop/test"
16- "github.com/lightningnetwork/lnd/input"
1716 "github.com/lightningnetwork/lnd/lnrpc"
1817 "github.com/lightningnetwork/lnd/lntypes"
1918 "github.com/stretchr/testify/require"
@@ -240,8 +239,12 @@ func testLoopOutResume(t *testing.T, confs uint32, expired, preimageRevealed,
240239 Preimage : preimage ,
241240 AmountRequested : amt ,
242241 CltvExpiry : 744 ,
243- ReceiverKey : receiverKey ,
244- SenderKey : senderKey ,
242+ HtlcKeys : loopdb.HtlcKeys {
243+ SenderScriptKey : senderKey ,
244+ SenderInternalPubKey : senderKey ,
245+ ReceiverScriptKey : receiverKey ,
246+ ReceiverInternalPubKey : receiverKey ,
247+ },
245248 MaxSwapFee : 60000 ,
246249 MaxMinerFee : 50000 ,
247250 ProtocolVersion : protocolVersion ,
@@ -273,30 +276,13 @@ func testLoopOutResume(t *testing.T, confs uint32, expired, preimageRevealed,
273276 // Expect client to register for our expected number of confirmations.
274277 confIntent := ctx .AssertRegisterConf (preimageRevealed , int32 (confs ))
275278
276- // Assert that the loopout htlc equals to the expected one.
277- scriptVersion := GetHtlcScriptVersion (protocolVersion )
278- var htlc * swap.Htlc
279-
280- switch scriptVersion {
281- case swap .HtlcV2 :
282- htlc , err = swap .NewHtlcV2 (
283- pendingSwap .Contract .CltvExpiry , senderKey ,
284- receiverKey , hash , & chaincfg .TestNet3Params ,
285- )
286-
287- case swap .HtlcV3 :
288- htlc , err = swap .NewHtlcV3 (
289- input .MuSig2Version040 ,
290- pendingSwap .Contract .CltvExpiry , senderKey ,
291- receiverKey , senderKey , receiverKey , hash ,
292- & chaincfg .TestNet3Params ,
293- )
294-
295- default :
296- t .Fatalf (swap .ErrInvalidScriptVersion .Error ())
297- }
298-
279+ htlc , err := GetHtlc (
280+ hash , & pendingSwap .Contract .SwapContract ,
281+ & chaincfg .TestNet3Params ,
282+ )
299283 require .NoError (t , err )
284+
285+ // Assert that the loopout htlc equals to the expected one.
300286 require .Equal (t , htlc .PkScript , confIntent .PkScript )
301287
302288 signalSwapPaymentResult (nil )
@@ -315,7 +301,7 @@ func testLoopOutResume(t *testing.T, confs uint32, expired, preimageRevealed,
315301 func (r error ) {},
316302 func (r error ) {},
317303 preimageRevealed ,
318- confIntent , scriptVersion ,
304+ confIntent , GetHtlcScriptVersion ( protocolVersion ) ,
319305 )
320306}
321307
0 commit comments