Skip to content

Commit

Permalink
fix: additional btc tx options:
Browse files Browse the repository at this point in the history
- lockUnspents: true to ensure we don't try to double-spend
- changePosition: 2 on vault swaps to ensure a valid transaction
  • Loading branch information
dandanlen committed Nov 26, 2024
1 parent df77ae3 commit bdf6514
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions bouncer/commands/create_raw_btc_tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const createRawTransaction = async (toAddress: string, amountInBtc: number | str
const fundedTx = (await btcClient.fundRawTransaction(rawTx, {
changeAddress: await btcClient.getNewAddress(),
feeRate: 0.00001,
lockUnspents: true,
})) as { hex: string };

// Sign the raw transaction
Expand Down
2 changes: 2 additions & 0 deletions bouncer/shared/send_btc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export async function fundAndSendTransaction(
const fundedTx = (await btcClient.fundRawTransaction(rawTx, {
changeAddress,
feeRate: feeRate ?? 0.00001,
lockUnspents: true,
changePosition: 2,
})) as { hex: string };
const signedTx = await btcClient.signRawTransactionWithWallet(fundedTx.hex);
const txId = (await btcClient.sendRawTransaction(signedTx.hex)) as string | undefined;
Expand Down

0 comments on commit bdf6514

Please sign in to comment.