Repository navigation
Description
Every decdn pool subcommand opens <data_dir>/buyer-pools.redb — the standalone client's store. On a node host the daemon's buyer state lives in <data_dir>/buyer.redb, so the CLI reads and writes a different file than the node it is pointed at.
This is a separate defect from #2077, and it invalidates that issue's premise. #2077 reasons that pool list "reads only the local buyer store, so it cannot show a pool whose store row is gone". On a node host it never reads that store at all: pool list prints pools=0 even when the row is present and intact.
Evidence
Observed 2026-09-20 on a three-node fleet running decdn-node at 8095370, right after the #2075 adoption path landed. One node logged a successful adoption — which is emitted after store.record(&state) commits:
INFO adopted this node's existing on-chain payment pool; not opening a second one
pool_id=0x590e3ca0…cfecb0 deposit=10000000 remaining=9808795
INFO BuyerPoolService bootstrap complete … tracked=0 adopted=true
Immediately afterwards, on that same host, as the same decdn user, with --config /etc/decdn/node.toml (so identity.data_dir resolves to the daemon's /var/lib/decdn):
$ decdn pool list --config /etc/decdn/node.toml
pools=0
(no tracked pools)
All three nodes printed pools=0. The command also created a buyer-pools.redb that had not existed on any of them, at mode 0660 — beside the daemon's 0600 stores.
Mechanism
- daemon →
buyer.redb:const BUYER_DB_FILE: &str = "buyer.redb"(crates/node/src/channel_store.rs:102), opened atchannel_store.rs:508viaopen_hardened_db. - CLI →
buyer-pools.redb:const BUYER_POOLS_DB_FILE: &str = "buyer-pools.redb"(crates/incentive/src/buyer_pool_redb.rs:33). list(crates/cli/src/commands/pool.rs:939) callsRedbBuyerPoolStore::open(&data_dir), which is thebuyer-pools.redbone, and whoseopenusesDatabase::create— hence the stray file.
#1246 deliberately shared the codec and table ops between the two so they could not drift in format. The file split is intentional and documented (buyer_pool_redb.rs:1-7). What appears unintended is that the operator-facing CLI has no way to address the node's file, and reports the empty one as fact.
Beyond list: the mutating paths are also affected
Same store handle, so on a node host:
pool open(pool.rs:157) andpool top-up(pool.rs:210) record intobuyer-pools.redb. A pool opened by hand on a node host is one the daemon will never see — manufacturing exactly the stranded-deposit condition Node-to-node pull leg fails 100% of attempts on the live fleet #2072/fix(node,incentive): adopt the payment pool a node already owns #2075 exist to prevent.pool close/pool reclaimcallclose_and_forget→store.forget_if_pool(owner, pool_id). On a node host that is a silent no-op, so closing a pool the daemon tracks leaves the daemon's row inbuyer.redbpointing at a pool that is nowClosing/Closed.
The on-chain legs of all four are unaffected — they go through getPool/getPools and the contract — so this is a local-bookkeeping defect, not a funds-safety one. We closed two genuinely stranded pools this way and verified the on-chain result was correct; the pools in question were untracked by the daemon, so the no-op forget cost nothing.
There is an irony worth noting: RedbBuyerPoolStore::open carries a careful zero-length guard against a truncated store silently wiping a voucher watermark, while on a node host it is creating a fresh, unrelated store and reporting its emptiness as the node's state.
Impact on the #2075 runbook
docs/runbook.md § "Node-to-node pulls never succeed (buyer wallet or pool)", Cause (2), step 1 reads:
Read
decdn_buyer_pool_adoption_failures_total. Any increment means the node could not tell whether it already owned a pool and is about to open a second one;decdn pool list(which reads the local store) then shows nothing while the chain says otherwise.
On a node host that output is unconditional, so it confirms the hypothesis no matter what is true. An operator following the runbook will read pools=0 as corroboration of the forgotten-pool bug on a perfectly healthy node.
Separately, the stranded-pool warning cannot be relied on to find these: reconcile_owned_pool returns on AdoptionCheck::AlreadyTracked before report_stranded_pools, so a node that already tracks a pool never enumerates the chain and never warns. We found a second stranded pool (~9.95 USDC, opened when a store reset orphaned its predecessor) on a node that logged tracked=1 adopted=false and warned about nothing. Only a direct getPools read surfaced it.
Suggested direction
Deferring to your judgement on the shape, but the options seem to be:
- Have the CLI resolve the node's store when the config it was handed is a node config — the least surprising behavior for
--config /etc/decdn/node.toml. - Failing that, make the mismatch loud rather than silent: if
data_dircontains abuyer.redb, refuse to create a freshbuyer-pools.redbbeside it and say which file is being read.
Either way pool list should name the file it read, so pools=0 is interpretable. #2077's --all would sidestep the read entirely for the diagnostic case, but the mutating paths still need a decision.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
fix(node,cli): drop a buyer-pool row the chain has closed; widen the …
fix(node): never drop a buyer-pool row on a status read that failed
fix(cli,node): read the node's buyer pools from the node, not a store…
fix(cli): batch of five CLI fixes around the node-vs-client data dir (#…