swap_creation_open_fill fails on main. Confirmed pre-existing — it fails identically with only the build fixes from #137 applied, so it is not caused by #138.
---- swap_creation_open_fill ----
ErrorObject { code: ServerError(-1), message: "not enough funds", data: None }
test result: FAILED. 10 passed; 1 failed; 1 ignored
Cause
integration_tests/swap_creation.rs reserves the swap for a freshly generated address:
let claimer_address = sidechain.rpc_client.get_new_address().await?;
let accept_txid = sidechain.rpc_client
.accept_swap(swap_id, Some(claimer_address), Some(0))
.await?;
But SwapAccept must spend an input owned by the address it reserves for — that is what proves control of it, and it is the rule that stops anyone parking every open swap for free. A brand-new address owns nothing, so coin selection has nothing to choose and returns NotEnoughFunds.
Came in with #135, and merged because CI was already red for the nightly clippy regression described in that PR.
Fix options
- Fund
claimer_address before the accept — a transfer to it, mined, then reserve. Closest to what a real taker does.
- Reserve for an address the wallet already holds a UTXO at.
Option 1 exercises the real flow and is what I would suggest, but it is a judgement call about what the test is meant to prove, so I have not made it.
Note
Everything else passes: 10/11 integration tests and 55 unit tests, against a real bitcoind, electrs, and an enforcer built at the pinned rev a9ca43d.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Mrg9zkV9bEdAvVEjx1RKLx
swap_creation_open_fillfails onmain. Confirmed pre-existing — it fails identically with only the build fixes from #137 applied, so it is not caused by #138.Cause
integration_tests/swap_creation.rsreserves the swap for a freshly generated address:But
SwapAcceptmust spend an input owned by the address it reserves for — that is what proves control of it, and it is the rule that stops anyone parking every open swap for free. A brand-new address owns nothing, so coin selection has nothing to choose and returnsNotEnoughFunds.Came in with #135, and merged because CI was already red for the nightly clippy regression described in that PR.
Fix options
claimer_addressbefore the accept — a transfer to it, mined, then reserve. Closest to what a real taker does.Option 1 exercises the real flow and is what I would suggest, but it is a judgement call about what the test is meant to prove, so I have not made it.
Note
Everything else passes: 10/11 integration tests and 55 unit tests, against a real bitcoind, electrs, and an enforcer built at the pinned rev
a9ca43d.🤖 Generated with Claude Code
https://claude.ai/code/session_01Mrg9zkV9bEdAvVEjx1RKLx