Skip to content

Commit

Permalink
test: ignore initial swap.created status
Browse files Browse the repository at this point in the history
  • Loading branch information
jackstar12 committed Feb 12, 2024
1 parent c4fd09e commit a9141e5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cmd/boltzd/boltzd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ func swapStream(t *testing.T, client client.Boltz, swapId string) nextFunc {
select {
case status, ok := <-updates:
if ok {
// ignore initial swap.created message
created := boltz.SwapCreated.String()
if status.Swap.GetStatus() == created || status.ReverseSwap.GetStatus() == created {
continue
}
if state == status.Swap.GetState() || state == status.ReverseSwap.GetState() {
return status
}
Expand Down Expand Up @@ -386,12 +391,10 @@ func TestSwap(t *testing.T) {
})
require.NoError(t, err)

next := swapStream(t, client, swap.Id)
next(boltzrpc.SwapState_PENDING)

test.SendToAddress(tc.cli, swap.Address, 100000)
test.MineBlock()

next := swapStream(t, client, swap.Id)
info := next(boltzrpc.SwapState_SUCCESSFUL)
checkSwap(t, info.Swap)
})
Expand Down Expand Up @@ -489,6 +492,8 @@ func TestSwap(t *testing.T) {
refundFee, err := chain.GetTransactionFee(from, info.RefundTransactionId)
require.NoError(t, err)
require.Equal(t, int(refundFee), int(*info.OnchainFee))

checkTxOutAddress(t, chain, from, info.RefundTransactionId, "", true)
})

t.Run("AddressRequired", func(t *testing.T) {
Expand Down

0 comments on commit a9141e5

Please sign in to comment.