diff options
| author | Adam Soltys <[email protected]> | 2026-12-04 13:24:12 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-12-06 00:01:59 -0700 |
| commit | 50ca83a0f21fb8090ba39481cf3d331c331d26ba (patch) | |
| tree | e6064ab6c9fe2255ae06ae0fb387eba609ef2b4a /src/ark/manager.js | |
| parent | befa01bc9b2c144c020b403429db20bc5278db93 (diff) | |
| download | coinosv3-50ca83a0f21fb8090ba39481cf3d331c331d26ba.tar.gz coinosv3-50ca83a0f21fb8090ba39481cf3d331c331d26ba.zip | |
ark: completeBoard takes the funding output's index.
A service boarding coins paid from another wallet (the ark → ark2 migrator's float) can't count on the board output being first; the outpoint now carries the index the caller found (default 0, which is what the app's own wallet always produces).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VMan6WoqaQDYdpWkatPCar
Diffstat (limited to 'src/ark/manager.js')
| -rw-r--r-- | src/ark/manager.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ark/manager.js b/src/ark/manager.js index fc298d9..d85c563 100644 --- a/src/ark/manager.js +++ b/src/ark/manager.js @@ -2390,11 +2390,15 @@ export class ArkManager { return { actionId: action.id, fundingAddress: p2trAddress(probe.fundingTaproot.outputXOnly, hrp), feeSat }; } - async completeBoard(actionId, fundingTxid) { + // fundingVout: where the board output sits in the funding tx. The app's own + // wallet always puts it first; another wallet (paying a service's board + // address) may not, so the caller can say. + async completeBoard(actionId, fundingTxid, fundingVout = 0) { const action = this.state.actions.find((a) => a.id === actionId); if (!action || action.type !== 'board') throw new Error('unknown board action'); if (action.step === 'created') { action.fundingTxid = fundingTxid; + action.fundingVout = fundingVout; action.step = 'funded'; this._save(); } @@ -2430,7 +2434,8 @@ export class ArkManager { if (!(confs >= need)) return; // retried on sync const fundingOutpointRaw = new Uint8Array(36); - fundingOutpointRaw.set(hex.decode(action.fundingTxid).reverse(), 0); // vout 0 + fundingOutpointRaw.set(hex.decode(action.fundingTxid).reverse(), 0); + new DataView(fundingOutpointRaw.buffer).setUint32(32, action.fundingVout || 0, true); // vout, little-endian const board = buildBoard({ userPub: keys.pubkey, serverPub: this.serverPub, amountSat: action.amountSat, feeSat: action.feeSat, |
