aboutsummaryrefslogtreecommitdiffstats
path: root/src/ark/manager.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-08-28 21:12:20 -0700
committerAdam Soltys <[email protected]>2026-08-28 21:12:20 -0700
commit63b26f2d7e3af485479068af40a9ef7a7386d1d2 (patch)
tree9e6eebec638b2e415847fafff8fc3ade6b8e27fe /src/ark/manager.js
parent065d50b3ef553f540c6471c60abd804abed61b28 (diff)
downloadcoinosv3-63b26f2d7e3af485479068af40a9ef7a7386d1d2.tar.gz
coinosv3-63b26f2d7e3af485479068af40a9ef7a7386d1d2.zip
A payment that lands now is dated now: expiry-based age estimation applies only to the first catch-up — it mis-dated a live receive by a month after the vtxo lifetime doubled, since the math assumes every coin began with the full current lifetime
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_019eA8JRq9Wr7z2fRQk99HLi
Diffstat (limited to 'src/ark/manager.js')
-rw-r--r--src/ark/manager.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ark/manager.js b/src/ark/manager.js
index cfb7436..508cd85 100644
--- a/src/ark/manager.js
+++ b/src/ark/manager.js
@@ -321,13 +321,19 @@ export class ArkManager {
if (m.kind !== 'arkoor') return changed;
const ourKeys = [hex.encode(this._key(0).pubkey)];
const tip = await this._tipMemo();
+ // Expiry-based dating is for the FIRST catch-up only, where old receipts
+ // deserve old dates. A delivery landing on a live wallet happened NOW —
+ // the estimate mis-dated a fresh receive by a month when the server's
+ // vtxo lifetime changed under it (the math assumes every coin began with
+ // the full current lifetime).
+ const live = !this.state.baselinePending;
for (const v of m.vtxos) {
if (this._vtxo(v.id)) {
// The vtxo beat the message here (a mirror or snapshot merge carried
// it) — the money is present but the story is missing. Backfill the
// receive movement so history matches the balance.
if (!this.state.movements.some((x) => x.vtxoId === v.id)) {
- this._movement({ type: 'receive', amountSat: v.amountSat, status: 'complete', vtxoId: v.id, ts: this._estimateReceiveTs(this._decoded(this._vtxo(v.id)), tip) });
+ this._movement({ type: 'receive', amountSat: v.amountSat, status: 'complete', vtxoId: v.id, ts: live ? Date.now() : this._estimateReceiveTs(this._decoded(this._vtxo(v.id)), tip) });
changed = true;
}
continue;
@@ -348,7 +354,7 @@ export class ArkManager {
if (!this._addVtxo(v, v._raw.bytes, 0)) continue;
this._movement({
type: 'receive', amountSat: v.amountSat, status: 'complete', vtxoId: v.id,
- ts: this._estimateReceiveTs(v, tip),
+ ts: live ? Date.now() : this._estimateReceiveTs(v, tip),
});
changed = true;
}