aboutsummaryrefslogtreecommitdiffstats
path: root/src/ark/manager.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-18 00:42:47 -0700
committerAdam Soltys <[email protected]>2026-08-18 00:42:47 -0700
commit6cffbb23fbbc69fc55f44a4a94161aa539d49629 (patch)
tree78a160a87615d97a42c86279b7bedea5f384a585 /src/ark/manager.js
parent0a19b26e1289f79de7b9e3ddd149617c894e6250 (diff)
downloadcoinosv3-6cffbb23fbbc69fc55f44a4a94161aa539d49629.tar.gz
coinosv3-6cffbb23fbbc69fc55f44a4a94161aa539d49629.zip
A confirmed board stops waiting on a flaky tip: confirmation itself counts for one, and a failed mailbox read no longer starves the drives that only need the chain
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JtaatFfAbx91Nh3xqKVqKz
Diffstat (limited to 'src/ark/manager.js')
-rw-r--r--src/ark/manager.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ark/manager.js b/src/ark/manager.js
index 7be74fe..01e257a 100644
--- a/src/ark/manager.js
+++ b/src/ark/manager.js
@@ -1346,11 +1346,16 @@ export class ArkManager {
if (action.step === 'funded') {
const need = this.info.requiredBoardConfirmations;
const status = await this.chain.getTxStatus(action.fundingTxid);
- // record progress so the UI can say WHERE the wait is (n/need confs)
- const confs = status?.confirmed ? (await this.chain.tipHeight()) - status.block_height + 1 : 0;
+ // record progress so the UI can say WHERE the wait is (n/need confs).
+ // A confirmed status proves at least ONE confirmation on its own — the
+ // tip fetch only refines the count, so its failure (rate limits) must
+ // not strand a confirmed board at "0/need" forever.
+ let confs = 0;
+ if (status?.confirmed) {
+ const tip = await this.chain.tipHeight().catch(() => null);
+ confs = tip != null && Number.isFinite(tip) ? tip - status.block_height + 1 : 1;
+ }
if (confs !== action.confs || need !== action.needConfs) { action.confs = confs; action.needConfs = need; this._save(); }
- // NB not `confs < need`: a failed tip fetch makes confs NaN, which must
- // wait for the next sync rather than slip past the comparison
if (!(confs >= need)) return; // retried on sync
const fundingOutpointRaw = new Uint8Array(36);