-
Notifications
You must be signed in to change notification settings - Fork 290
Wallet coinselection #928
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
Draft
nodech
wants to merge
19
commits into
handshake-org:master
Choose a base branch
from
nodech:wallet-coinselection
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Wallet coinselection #928
+4,387
−699
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…lues. Introduces separate indexes for confirmed and unconfirmed transaction values. This change enables sorting transactions based on their confirmation status, addressing the need for different ordering of confirmed vs. unconfirmed entries.
fa1d30d
to
40a083a
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking-minor
Backwards compatible - Release version
feature
general - adding feature
wallet
part of the codebase
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.
Wallet Coin Selection
This PR adds new coin indexes to the txdb and uses them inside wallet for
coinselection instead of selecting every coin for in memory sorting.
This should allow wallet to scale for these specific selections regardless of
the number of coins. Also this reduces the search space to only spendable coins
from the beginning.
The wallet's coin selection now offers two optimized methods,
dbvalue
anddbage
, alongside existing options (all
,value
,age
,random
). Unlike previous methods that load and process all coins from thedatabase in memory, these new variations stream coins directly to the selector,
potentially improving performance.
Name for
dbvalue
anddbage
is not final, can be changed. Alternativesinclude but not limited to:
streamvalue
,queryvalue
...MTX
MTX Coinselection has been moved outside to allow for replacable coin sources.
TXDB Layout
Sh[height:uint32][coin-hash:hash256][coin-index:uint32]
- Coin by height/age for wallet.SH[account:uint32][height:uint32][coin-hash:hash256][coin-index:uint32]
- Coin by height/age per account.Sv[value:uint64][coin-hash:hash256][coin-index:uint32]
- Confirmed coins by value for wallet.SV[account:uint32[value:uint64][coin-hash:hash256][coin-index:uint32]
- Confirmed by value per account.Su[value:uint64][coin-hash:hash256][coin-index:uint32]
- Unconfirmed coins by value for wallet.SU[account:uint32[value:uint64][coin-hash:hash256][coin-index:uint32]
- Unconfirmed coins by value per account.Other prefixes can also be considered for the TXDB:
q
orQ
.TODO: