aboutsummaryrefslogtreecommitdiffstats
path: root/src/ark/manager.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/ark/manager.js')
-rw-r--r--src/ark/manager.js9
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,