This repository was archived by the owner on May 27, 2025. It is now read-only.

Description
Issue
A transaction with specific from address can take forever to build, for example:
await sendBtc({
from: 'tb1quqtqsh5jrlr9p5wnpu3rs883lqh4avpwc766x3',
tos: [
{
address: 'tb1quqtqsh5jrlr9p5wnpu3rs883lqh4avpwc766x3',
value: 1000,
},
],
source,
});
What happens:
- The construction process contains a loop to estimate the fee of the transaction
- In each loop, the
BtcAssetsApi.getBtcUtxos() API is called to get the latest UTXO[] list
- Each request can take 8-15 seconds, and in each loop, more UTXOs are collected to the inputs
- If the inputs length increased, the estimated fee is also increased, causing another round of the loop
- The condition to break the loop takes a very long time to be satisfied (due to the INSUFFICIENT_UTXO error)
- The loop (tested by @Dawn-githup) can take 40+ minutes to fail, which is clearly abnormal
Investigation & resolvers