diff options
| author | Adam Soltys <[email protected]> | 2026-06-29 15:31:59 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-06-29 15:31:59 -0700 |
| commit | 052e9c714092d8f4a5a9bb29bb85277630c1926d (patch) | |
| tree | fdf7cc771f458df5834e34048a0c9870a9e55121 /src/format.js | |
| parent | 87fcb80de91f539891cc2d635b0013d07826dd60 (diff) | |
| download | coinosv3-052e9c714092d8f4a5a9bb29bb85277630c1926d.tar.gz coinosv3-052e9c714092d8f4a5a9bb29bb85277630c1926d.zip | |
Swaps: don't reuse a burned swap index (deterministic-preimage collision)
A reverse swap's preimage is sha256(swapNode(idx).privateKey) — deterministic per
index. nextSwapIndex was derived only from *saved* swaps, so an attempt that
created the swap at Boltz but threw before saving (e.g. the lockup-address-mismatch
bug) never advanced the index; the next try reused the same preimage and Boltz
rejected it ('a swap with this preimage hash exists already').
Make nextSwapIndex a persisted, monotonic counter (reserves the index on every
call, seeded from saved swaps), and have startReverse retry with the next index
when Boltz reports the preimage already exists — which also recovers wallets
already stuck on a burned index.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'src/format.js')
0 files changed, 0 insertions, 0 deletions
