loopout/test: refactor test

pull/238/head
Joost Jager 4 years ago
parent 4da4738a2d
commit 190caa4097
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -179,10 +179,16 @@ func testResume(t *testing.T, expired, preimageRevealed, expectSuccess bool) {
var receiverKey [33]byte
copy(receiverKey[:], receiverPubKey.SerializeCompressed())
state := loopdb.StateInitiated
update := loopdb.LoopEvent{
SwapStateData: loopdb.SwapStateData{
State: loopdb.StateInitiated,
},
}
if preimageRevealed {
state = loopdb.StatePreimageRevealed
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,
},
}

Loading…
Cancel
Save