From 190caa40970eea315a3466ee565a85a3bfdb17a9 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Tue, 23 Jun 2020 12:09:47 +0200 Subject: [PATCH] loopout/test: refactor test --- client_test.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/client_test.go b/client_test.go index 911732a6..d0c5bfd6 100644 --- a/client_test.go +++ b/client_test.go @@ -179,10 +179,16 @@ func testResume(t *testing.T, expired, preimageRevealed, expectSuccess bool) { var receiverKey [33]byte copy(receiverKey[:], receiverPubKey.SerializeCompressed()) - state := loopdb.StateInitiated - if preimageRevealed { - state = loopdb.StatePreimageRevealed + update := loopdb.LoopEvent{ + SwapStateData: loopdb.SwapStateData{ + State: loopdb.StateInitiated, + }, } + + if preimageRevealed { + update.State = loopdb.StatePreimageRevealed + } + pendingSwap := &loopdb.LoopOut{ Contract: &loopdb.LoopOutContract{ DestAddr: dest, @@ -201,14 +207,8 @@ func testResume(t *testing.T, expired, preimageRevealed, expectSuccess bool) { }, }, Loop: loopdb.Loop{ - Events: []*loopdb.LoopEvent{ - { - SwapStateData: loopdb.SwapStateData{ - State: state, - }, - }, - }, - Hash: hash, + Events: []*loopdb.LoopEvent{&update}, + Hash: hash, }, }