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

Prioritize accounts over address book #5909

Merged
merged 1 commit into from Jun 23, 2017
Merged

Conversation

maciejhirsz
Copy link
Contributor

If a user creates an entry in the address book, and later tries to import an account that produces the same address, the account never shows up in the UI, no error is presented.

The account actually does get created, but since parity_allAccountsInfo returns a map, and the map is constructed such that the address book can overshadow actual accounts. This is a not-so-elegant solution that guarantees that accounts always take precedence over address book.

Also replaced BTreeMap<String, String> with a dedicated struct.

@maciejhirsz maciejhirsz added A0-pleasereview 🤓 Pull request needs code review. M6-rpcapi 📣 RPC API. labels Jun 22, 2017
for (address, map) in account_iter {
match accounts.get(&address) {
// Skip if an account with UUID is already present.
Some(ref occupied) if occupied.uuid.is_some() => continue,
Copy link
Contributor

Choose a reason for hiding this comment

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

Entry API could be used here to coalesce the "get or insert" logic, but I don't know if it would be cleaner...

@rphmeier rphmeier added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Jun 22, 2017
@gavofyork
Copy link
Contributor

build failing.

@gavofyork gavofyork added A7-looksgoodtestsfail 🤖 Pull request is reviewed well, but cannot be merged due to tests failing. and removed A8-looksgood 🦄 Pull request is reviewed well. labels Jun 23, 2017
@maciejhirsz maciejhirsz merged commit 02edc95 into master Jun 23, 2017
@maciejhirsz maciejhirsz deleted the mh-always-show-accounts branch June 23, 2017 14:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A7-looksgoodtestsfail 🤖 Pull request is reviewed well, but cannot be merged due to tests failing. M6-rpcapi 📣 RPC API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants