WIP Bitcoinj usage refactor example #4269
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related project proposal: bisq-network/projects#30
This example PR is meant to be read commit by commit.
It's a simple refactor of
WalletConfig
focusing on movingPeerGroup
related code. I chosePeerGroup
, because it's probably the simplest important group of BitcoinJ endpoints. Moving code is the simplest (and least interesting) form of refactoring, but while doing it (similarly to shuffling puzzle pieces while solving a puzzle) you come up with more interesting refactorings, though it's a time-intensive process. This example is about that shuffling.There are a few quirks here that are still to be ironed out:
low.PeerGroup
clashes with BitcoinJ's PeerGroup. Might come up with something better;PeerGroup extends PeerGroupProxy
scheme has its upsides, but a few downsides too. Might come up with something better;PeerGroupProxy
name clashes withSocks5Proxy
and the like; naming isn't worked out in general;WalletConfig
tolow.PeerGroup
in this example might actually do better left in WalletConfig, which will require dissecting it further.