Skip to main content

daemon_marker

Function daemon_marker 

Source
pub fn daemon_marker(data_dir: &Path) -> Result<Option<&'static str>>
Expand description

The daemon-owned file that marks data_dir as a node’s, if any.

Checks the whole DAEMON_STORE_FILES set rather than NODE_BUYER_DB_FILE alone, because the buyer store is exactly the file an operator recovering from a reset deletes or loses. A directory whose buyer.redb is gone but whose lanes.redb remains is still a node’s, and treating it as a client’s is how a second deposit gets escrowed into a store the daemon never reads.

Each file is checked with symlink_metadata, not Path::exists, which collapses every stat error to false. Only NotFound reads as “absent”. Any other stat error (a permission denial, a loop, a transient I/O fault) leaves the owner unknown, and this returns it: the callers gate refusals that move USDC on this answer, so an unknown owner must refuse rather than pass as a client’s directory (#2086).

§Errors

The first stat error other than NotFound, with the path it concerns.