dtr-org / unit-e

A digital currency for a new era of decentralized trust
https://unit-e.io
MIT License
45 stars 15 forks source link

Fix transaction picking #952

Closed scravy closed 5 years ago

scravy commented 5 years ago

Depends on #935

The only new commit which distinguishes this pull request from #935 is https://github.com/dtr-org/unit-e/pull/952/commits/77aa80977c2ef7034d3a2d6905e3cf5c63c5d83c

Enabling the stake validation checks the eligibility in TestBlockValidity which is called in CreateNewBock in miner.cpp when the TransactionPicker (implementation: BlockAssemblerAdapter) invokes it to gather a list of transactions to include in a block. This pseudo-block which is created does not have eligible stake (for the same reason the merkle check is skipped, already in existing bitcoin code).

This fixes that by introducig a clean flag to bypass that check (much like the previous flags which also bypassed certain checks, but using the XXXFlags from validation_flags.h instead of boolean flags - which in my mind/experience are a code smell and should be avoided).

scravy commented 5 years ago

I added the commit in here to #935 which introduces this misbehavior and is not merged yet.