aboutsummaryrefslogtreecommitdiffstats
path: root/src/app.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-26 13:50:23 -0700
committerAdam Soltys <[email protected]>2026-06-26 13:50:23 -0700
commit9f4bc29025287e8e12a7ef31c9918c1adfdfff5d (patch)
treecd78a1521769844a6b4c8acc82ee7634f6302099 /src/app.js
parent445a2e772eba5377f74a1b68fe7f80508c05fa9c (diff)
downloadcoinosv3-9f4bc29025287e8e12a7ef31c9918c1adfdfff5d.tar.gz
coinosv3-9f4bc29025287e8e12a7ef31c9918c1adfdfff5d.zip
Fix broadcast hanging forever on a stalled response
The Esplora broadcast cleared its abort timer right after fetch() resolved, so the subsequent res.text() body read had no timeout — a stalled response body hung the whole broadcast (and the send spinner) indefinitely, with the tx never reaching the network. Keep the abort timer active through the body read, and add a hard 30s outer timeout in the send handler so a wedged broadcast always surfaces as 'timed out — try again' instead of spinning forever. (The silent-payment tx itself is valid — verified structure + BIP143 signature over the real outputs.) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'src/app.js')
-rw-r--r--src/app.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/app.js b/src/app.js
index d5452ec..cba23ba 100644
--- a/src/app.js
+++ b/src/app.js
@@ -2764,7 +2764,10 @@ async function broadcast() {
render();
try {
const hexTx = wallet.sign(ui.draft.tx);
- const txid = await wallet.broadcast(hexTx);
+ const txid = await Promise.race([
+ wallet.broadcast(hexTx),
+ new Promise((_, rej) => setTimeout(() => rej(new Error(t('broadcastTimeout'))), 30000)),
+ ]);
ui.sendResult = { txid };
ui.draft = null;
ui.send = blankSend();