aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-06-27 10:52:50 -0700
committerAdam Soltys <[email protected]>2026-06-27 10:52:50 -0700
commit45d7d233c26edc07d7ad0e68c310d02f0626fbe9 (patch)
tree81cc0cccb94604ab4850fe5e58f8ee90779cd0c0
parent5082edae2a89c202016dc8337ba432aa3409d1ba (diff)
downloadcoinosv3-45d7d233c26edc07d7ad0e68c310d02f0626fbe9.tar.gz
coinosv3-45d7d233c26edc07d7ad0e68c310d02f0626fbe9.zip
Fix electrum reconcile stall: keep _rpcId numeric (id:null broke matching)
_rpcId could go non-numeric, so ++ produced NaN and requests serialized with "id":null. _handleRpc matches responses with `msg.id != null`, so every data-call response was dropped → the call timed out → _reconcileHeld skipped the address → confirmations never reflected (until an unrelated full refresh). Coerce to a number on every send. Verified via CDP: a mined deposit now flips pending→confirmed in ~1s instead of stalling. Co-Authored-By: Claude Opus 4.8 <[email protected]>
-rw-r--r--src/wallet.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wallet.js b/src/wallet.js
index a3b2429..3c88b77 100644
--- a/src/wallet.js
+++ b/src/wallet.js
@@ -1587,7 +1587,10 @@ export class Wallet {
// not responses). Newline-terminated per the protocol.
_rpcSend(method, params) {
if (!this._ws || this._ws.readyState !== 1) return;
- const id = ++this._rpcId;
+ // Coerce to a number defensively: a non-numeric _rpcId serializes id as
+ // null, which the response matcher (msg.id != null) drops — silently
+ // breaking every data call (and thus reconciles).
+ const id = (this._rpcId = (this._rpcId || 0) + 1);
try {
this._ws.send(JSON.stringify({ id, method, params }) + '\n');
} catch {}
@@ -1622,7 +1625,7 @@ export class Wallet {
_rpcSendCall(method, params, attempt = 0) {
return new Promise((resolve, reject) => {
if (this.offline) { reject(new Error('offline')); return; }
- const id = ++this._rpcId;
+ const id = (this._rpcId = (this._rpcId || 0) + 1);
if (!this._pending) this._pending = new Map();
const timer = setTimeout(() => {
if (!this._pending.delete(id)) return;