aboutsummaryrefslogtreecommitdiff
path: root/src/script/script_error.cpp
diff options
context:
space:
mode:
authorFabian Jahr <[email protected]>2019-12-29 01:58:46 +0100
committerFabian Jahr <[email protected]>2020-04-14 15:02:06 +0200
commit1abbdac6777bc5396d17a6772c8176a354730997 (patch)
treeaae8ecde49b1053a7633f0a5f85d5f023d854f5b /src/script/script_error.cpp
parentMerge #17954: wallet: Remove calls to Chain::Lock methods (diff)
downloaddiscoin-1abbdac6777bc5396d17a6772c8176a354730997.tar.xz
discoin-1abbdac6777bc5396d17a6772c8176a354730997.zip
wallet: Prefer full destination groups in coin selection
When a wallet uses avoid_reuse and has a large number of outputs in a single destination, it groups these outputs in OutputGroups that are no larger than OUTPUT_GROUP_MAX_ENTRIES. The goal is to spend as many outputs as possible from the destination while not breaking consensus due to a huge number of inputs and also not surprise the use with high fees. If there are n outputs in a destination and n > OUTPUT_GROUP_MAX_ENTRIES then this results in one or many groups of size OUTPUT_GROUP_MAX_ENTRIES and possibly one group of size < OUTPUT_GROUP_MAX_ENTRIES. Prior to this commit the coin selection in the case where n > OUTPUT_GROUP_MAX_ENTRIES was skewed towards the one group of size < OUTPUT_GROUP_MAX_ENTRIES if it exists and the amount to be spent by the transaction is smaller than the aggregate of those of the group size < OUTPUT_GROUP_MAX_ENTRIES. The reason is that the coin selection decides between the different groups based on fees and mostly the smaller group will cause smaller fees. The behavior that users of the avoid_reuse flag seek is that the full groups of size OUTPUT_GROUP_MAX_ENTRIES get used first. This commit implements this by pretending that the small group has a large number of ancestors (one smallet than the maximum allowed for this wallet). This dumps the small group to the bottom of the list of priorities in the coin selection algorithm.
Diffstat (limited to 'src/script/script_error.cpp')
0 files changed, 0 insertions, 0 deletions