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

fix(network): collect all spends and store the first two ordered spends #1904

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

RolandSherwin
Copy link
Member

No description provided.

info!("For record {pretty_key:?} task {query_id:?}, found split record for a spend, accumulated and sending them as a single record");
let accumulated_spends = accumulated_spends
.into_iter()
.take(2)
Copy link
Contributor

Choose a reason for hiding this comment

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

why 2 ? why not more?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can we keep a random magic number here for now, say 50? If so, might have to do the same during PUT validation (we store 2 there).

The lower bound of a single signed spend is 825B. Can grow if the inputs/outputs increase.

@RolandSherwin RolandSherwin force-pushed the accumulate_double_spends branch from 87c34fa to a5a5098 Compare June 18, 2024 13:45
@RolandSherwin RolandSherwin force-pushed the accumulate_double_spends branch from a5a5098 to d8ee017 Compare June 18, 2024 13:47
.map_err(|_| NetworkError::InternalMsgChannelDropped)?;
} else {
sender
.send(Err(GetRecordError::SplitRecord { result_map }))
Copy link
Member

Choose a reason for hiding this comment

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

if no entry within the accumulated_record,
it shall be considered as NoHolders, instead of SplitRecord ?

Copy link
Member Author

@RolandSherwin RolandSherwin Jun 18, 2024

Choose a reason for hiding this comment

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

So we have no idea if the record we're GET'ing is a spend here, we just try to read the header and collect them IF they're spends. If not, we assume it is a chunk/register and just return SplitRecordError

sn_networking/src/event/kad.rs Outdated Show resolved Hide resolved
@RolandSherwin RolandSherwin force-pushed the accumulate_double_spends branch from d8ee017 to 7bcd249 Compare June 18, 2024 13:54
@joshuef joshuef added this pull request to the merge queue Jun 19, 2024
Merged via the queue into maidsafe:main with commit 58defbc Jun 19, 2024
40 checks passed
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.

3 participants