Skip to content

Expose SwapScript constructors from raw scripts, extract verify_submarine_preimage - #164

Merged
i5hi merged 6 commits into
trunkfrom
feat/swapscript-from-script
Sep 9, 2026
Merged

i5hi merged 6 commits into
trunkfrom
feat/swapscript-from-script

Conversation

@i5hi

@i5hi i5hi commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

The validated cooperative-claim helper (SwapScript::submarine_cooperative_claim, which verifies the server's preimage against the invoice payment hash before partial-signing) was only reachable from a fresh swap response. Bindings that reconstruct swap scripts from storage (boltz-dart) could not use it, so they re-implemented the coop close against the raw primitives — skipping the preimage check and partial-signing whatever transaction hash the server supplies.

  • SwapScript::from_bitcoin / SwapScript::from_liquid: build the wrapper from an already-reconstructed script, so the validated helpers are reachable for restored swaps.
  • verify_submarine_preimage extracted from submarine_cooperative_claim (behavior unchanged) so the proof-of-payment gate is a pure, unit-testable function.
  • 3 unit tests using an invoice minted and signed in-test: matching preimage accepted, mismatch rejected, bad hex rejected.

Validated: cargo test --lib wrappers green; full submarine regtest suite green against the local regtest stack (4/4, including the cooperative claim path end to end). The pre-existing swaps::boltz::tests failures hit the public api.boltz.exchange (currently down) and are unrelated.

Companion PR: SatoshiPortal/boltz-dart (coop_close_submarine delegates to the validated flow).

Includes the CI fixes from #165 (committed Cargo.lock, ignored live-API tests, wasm lock seeding) so checks can run while that PR is open — its diff collapses to the wrappers change once #165 merges.

@i5hi
i5hi merged commit 83957e1 into trunk Sep 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant