@@ -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"
@@ -277,30 +276,13 @@ func testLoopOutResume(t *testing.T, confs uint32, expired, preimageRevealed,
277276 // Expect client to register for our expected number of confirmations.
278277 confIntent := ctx .AssertRegisterConf (preimageRevealed , int32 (confs ))
279278
280- // Assert that the loopout htlc equals to the expected one.
281- scriptVersion := GetHtlcScriptVersion (protocolVersion )
282- var htlc * swap.Htlc
283-
284- switch scriptVersion {
285- case swap .HtlcV2 :
286- htlc , err = swap .NewHtlcV2 (
287- pendingSwap .Contract .CltvExpiry , senderKey ,
288- receiverKey , hash , & chaincfg .TestNet3Params ,
289- )
290-
291- case swap .HtlcV3 :
292- htlc , err = swap .NewHtlcV3 (
293- input .MuSig2Version040 ,
294- pendingSwap .Contract .CltvExpiry , senderKey ,
295- receiverKey , senderKey , receiverKey , hash ,
296- & chaincfg .TestNet3Params ,
297- )
298-
299- default :
300- t .Fatalf (swap .ErrInvalidScriptVersion .Error ())
301- }
302-
279+ htlc , err := GetHtlc (
280+ hash , & pendingSwap .Contract .SwapContract ,
281+ & chaincfg .TestNet3Params ,
282+ )
303283 require .NoError (t , err )
284+
285+ // Assert that the loopout htlc equals to the expected one.
304286 require .Equal (t , htlc .PkScript , confIntent .PkScript )
305287
306288 signalSwapPaymentResult (nil )
@@ -319,7 +301,7 @@ func testLoopOutResume(t *testing.T, confs uint32, expired, preimageRevealed,
319301 func (r error ) {},
320302 func (r error ) {},
321303 preimageRevealed ,
322- confIntent , scriptVersion ,
304+ confIntent , GetHtlcScriptVersion ( protocolVersion ) ,
323305 )
324306}
325307
0 commit comments