Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cln regtest #374

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion internal/rpcserver/rpcserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2306,10 +2306,11 @@ func TestChainSwap(t *testing.T) {

newAmount := swap.FromData.Amount - 10

stream, statusStream := swapStream(t, client, swap.Id)

test.SendToAddress(test.BtcCli, swap.FromData.LockupAddress, newAmount)
test.MineBlock()

stream, statusStream := swapStream(t, client, swap.Id)
info := statusStream(boltzrpc.SwapState_PENDING, boltz.TransactionLockupFailed)
require.Equal(t, newAmount, info.ChainSwap.FromData.Amount)

Expand Down
9 changes: 9 additions & 0 deletions internal/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,25 @@ func ClnCli(cmd string) string {
return run("lightning-cli-sim 1 " + cmd)
}

func syncCln() {
blockheight := BtcCli("getblockcount")
for ClnCli("getinfo | jq -r .blockheight") != blockheight {
time.Sleep(250 * time.Millisecond)
}
}

func MineBlock() {
BtcCli("-generate 1")
LiquidCli("-generate 1")
syncCln()
}

func MineUntil(t *testing.T, cli Cli, height int64) {
blockHeight, err := strconv.ParseInt(cli("getblockcount"), 10, 64)
require.NoError(t, err)
blocks := height - blockHeight
cli(fmt.Sprintf("-generate %d", blocks))
syncCln()
}

func GetNewAddress(cli Cli) string {
Expand Down
Loading