Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Update ref to parity-common and update seek behaviour #9257

Merged
merged 2 commits into from
Aug 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,9 @@ impl BlockChainClient for Client {
if let Some(after) = after {
if let Err(e) = iter.seek(after) {
trace!(target: "fatdb", "list_accounts: Couldn't seek the DB: {:?}", e);
} else {
// Position the iterator after the `after` element
iter.next();
Copy link
Member

Choose a reason for hiding this comment

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

Could you explain how this works? Why calling next after seek returned an Err would position the iterator after the after?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the else branch is actually when there has been no errors

Copy link
Member

Choose a reason for hiding this comment

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

Ah, right, thanks for clarifying that. So we assume that after is present in the db, otherwise this is not correct?

Copy link
Contributor Author

@ngotchac ngotchac Jul 31, 2018

Choose a reason for hiding this comment

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

So in this context, after is either None or an address that is actually in DB.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this could be simplified by writing:

if let Err(e) = iter.next(after) {
  trace!("...");
}

Cause Err is no used later on anyway

}
}

Expand Down Expand Up @@ -1735,7 +1738,10 @@ impl BlockChainClient for Client {

if let Some(after) = after {
if let Err(e) = iter.seek(after) {
trace!(target: "fatdb", "list_accounts: Couldn't seek the DB: {:?}", e);
trace!(target: "fatdb", "list_storage: Couldn't seek the DB: {:?}", e);
} else {
// Position the iterator after the `after` element
iter.next();
}
}

Expand Down