Mining: set minimum block weight to 5000, parse as configuration option #514
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.
Addresses #430 -- solution 1 & 2
(see also #515)
Goal
Prevent low- or no-fee transactions from being stuck in the mempool forever, by adjusting mining policy to occasionally include them.
This PR is mainly changing a constant in policy.js from a value that used to be
0
:What this means is, in miner.js
assemble()
when a block is being put together to be hashed, if the current block template has a total weight under 5000, the miner will insert "free" transactions from the mempool (very low fee transactions).One such TX might be this poor guy:
https://shakescan.com/transaction/a239970210b948d462adf8a07fb2e8bf9b301ba34942cb01b86eb96aeec2ad30
...that has been patiently pending for SIX MONTHS.
5000 weight units is tiny by the way. An "empty" block with just a coinbase is already
1308
weight.I ran a few heuristics to determine how often a block with <5000 weight ever gets mined. Parsing blocks 2016-33054. (all data)
and another test to see how big the average "gap" in blocks is between blocks of a certain weight:
So,
long story short - we can expect a block < 5000 weight a few times a day at the current network activity level. This means there is still very limited opportunities for a low-fee tx to get included in a block with this new policy rule. And when it happens, miners won't be sacrificing really anything.
Also,
miners can bypass this rule by launching with
--min-weight=0
(or other value) which is now parsed by the full node.