Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: client side dag #1259

Merged
merged 1 commit into from Feb 7, 2024
Merged

feat: client side dag #1259

merged 1 commit into from Feb 7, 2024

Conversation

grumbach
Copy link
Member

@grumbach grumbach commented Feb 5, 2024

Description

reviewpad:summary

@grumbach grumbach changed the title Dag client side feat: client side dag Feb 5, 2024
sn_cli/src/subcommands/wallet/audit.rs Dismissed Show dismissed Hide dismissed
@grumbach grumbach marked this pull request as ready for review February 5, 2024 09:28
Ok(s) => s,
Err(Error::MissingSpendRecord(_)) => {
trace!("UTXO at {spend_addr:?}");
return Ok(dag);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1, Why it's not an error to be returned if spend not found ?
2, The comment of the function doesn't explain this situation

if it's a value return, maybe put an explaination in the function comment ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a Spend is not found, it means the CashNote was not spent yet. This is not an error in our DAG building, it simply indicates there is no need to fetch further as unspent money has no descendants.


/// Extends an existing SpendDag starting from the utxos in this DAG
/// Covers the entirety of currently existing Spends if the DAG was built from Genesis
pub async fn spend_dag_continue_from_utxos(&self, dag: &mut SpendDag) -> WalletResult<()> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm... what's the different between this to be above spend_dag_extend function ?
continue_from_utxos is also an extend ?

maybe the spend_dag_extend shall be renamed to dag_from_spend_address ?

Copy link
Member Author

@grumbach grumbach Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree, basically spend_dag_continue_from_utxos extends the DAG in all directions from the current UTXOs at the extremities. That's total collection, the point of this is to collect all Spends that exist on the Network.

spend_dag_extend is partial extension from one spend back to either Genesis or a known Spend that we already have in our DAG. It is adding one Spend and all its ancestors to our current DAG.

So both are extension, but one is only in one direction up to a specific Spend and the other one is in all directions.

dag_from_spend_address makes me think that we build a dag from an address, maybe we need to add an extend somewhere.
How is spend_dag_extend_until?

@grumbach grumbach added this pull request to the merge queue Feb 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Feb 7, 2024
@grumbach grumbach added this pull request to the merge queue Feb 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Feb 7, 2024
@grumbach grumbach added this pull request to the merge queue Feb 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Feb 7, 2024
@grumbach grumbach added this pull request to the merge queue Feb 7, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Feb 7, 2024
@grumbach grumbach added this pull request to the merge queue Feb 7, 2024
Merged via the queue into maidsafe:main with commit 0d60555 Feb 7, 2024
38 checks passed
@grumbach grumbach deleted the dag_client_side branch February 7, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants