Skip to content

Commit

Permalink
Ensuring btc is mined
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-then committed Dec 9, 2023
1 parent cc19a96 commit f94ce40
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/rsk-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,16 @@ const triggerRelease = async (rskTransactionHelpers, btcClient, callbacks = {})

console.log('anyPendingPegoutsWaitingForSignaturesBroadcasted: ', anyPendingPegoutsWaitingForSignaturesBroadcasted);

let attempts = 0;
while(await getBitcoinMempool(btcClient).length > 0 && attempts < 10) {
attempts++;
console.log('the btc mempool is still not empty, mining 1 more block, attempts: ', attempts);
await btcClient.mine(1);
}

// Ensuring that the btc tx now has enough confirmations
await btcClient.mine(RSK_TO_BTC_MINIMUM_ACCEPTABLE_CONFIRMATIONS + 1);

await rskTxHelper.updateBridge();
await mineAndSync(rskTransactionHelpers); // At this point the bridge should already have the change uxto registered

Expand Down

0 comments on commit f94ce40

Please sign in to comment.