From bdf6514dd1eaf9f0e9331d6fcbe8048a0cfa2cb3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 26 Nov 2024 14:10:11 +0100 Subject: [PATCH] fix: additional btc tx options: - lockUnspents: true to ensure we don't try to double-spend - changePosition: 2 on vault swaps to ensure a valid transaction --- bouncer/commands/create_raw_btc_tx.ts | 1 + bouncer/shared/send_btc.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/bouncer/commands/create_raw_btc_tx.ts b/bouncer/commands/create_raw_btc_tx.ts index 58c3790e38..4960598f3e 100755 --- a/bouncer/commands/create_raw_btc_tx.ts +++ b/bouncer/commands/create_raw_btc_tx.ts @@ -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 diff --git a/bouncer/shared/send_btc.ts b/bouncer/shared/send_btc.ts index d799eee0e6..e4c1442946 100644 --- a/bouncer/shared/send_btc.ts +++ b/bouncer/shared/send_btc.ts @@ -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;