feat(auditor): dump fetched spends to local disk #1960
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request primarily introduces changes to the
SpendDagDb
implementation in thesn_auditor
package, specifically in thedag_db.rs
andmain.rs
files. The changes aim to enhance the process of updating the Directed Acyclic Graph (DAG) from the network by storing spends (transactions) on disk for better tracking and auditing. This is achieved by adding astorage_dir
parameter to thecontinuous_background_update
method and modifying how spends are processed.The most important changes are:
sn_auditor/src/dag_db.rs
: Thecontinuous_background_update
method in theSpendDagDb
implementation now takes an additionalstorage_dir: PathBuf
parameter. This directory path is used to store spends on disk.sn_auditor/src/dag_db.rs
: The spend processing logic has been updated. Now, each spend is hashed and stored in adetected_spends
set. If a spend is new (not already in the set), it's written to a file in thestorage_dir
. The file name is a combination of the spend's address and hash.sn_auditor/src/main.rs
: Themain
function now creates astorage_dir
and passes it to theinitialize_background_spend_dag_collection
function.sn_auditor/src/main.rs
: Theinitialize_background_spend_dag_collection
function now takes an additionalstorage_dir: PathBuf
parameter. This is passed to thecontinuous_background_update
method of theSpendDagDb
instance. [1] [2]These changes are important as they help in tracking and auditing transactions by storing them on disk. This makes it easier to inspect individual transactions and provides a persistent record of transactions for auditing purposes.