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

Remove terrible addresses from address manager #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shane-kerr
Copy link
Member

This pull request (PR) addresses issue #105, which is the wallet not cleaning out old addresses.

The only code which ever removed anything from the address manager was called if one of the buckets was full. (The address manager divides the addresses up into "buckets" for some reason, with a maximum number of addresses per bucket.) It would only ever delete a single address in this case.

Luckily, there was already code which would define a given address as "terrible", which was re-used in this PR.

It does two main things:

  1. When a bucket is full, the code now removes all of the "terrible" addresses in that bucket, instead of just one. While this will not prevent bad addresses from accumulating, it should over time get rid of most of them.

  2. More importantly, when the wallet receives addresses from a peer, it adds them all into the address manager as before, but now when that is done it goes through all of the "terrible" addresses that the address manager knows about and gets rid of them. Any node connected to peers that provide addresses will quickly get rid of the "terrible" addresses.

On my wallet, I went from having 17000 or so addresses to 650 or so, without any obvious other side-effects. The wallet is currently connected to 56 peers and appears to be functioning normally.

As usual, no tests were added for any of this because we don't have a test suite in MintCoin. 😬

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.

1 participant