-
Notifications
You must be signed in to change notification settings - Fork 725
[Miner] PoS process, calculate stakeable utxo only once. #1818
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
[Miner] PoS process, calculate stakeable utxo only once. #1818
Conversation
random-zebra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found the problem with the fuctional test failing.
The list of available coins must be updated after each generated block in generate().
We were calculating the stakeable utxo before calling CreateNewBlock and inside the method (CreateCoinStake). Looping over the wallet's transactions map twice.
01814d5 to
261bd22
Compare
|
rebased. |
random-zebra
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 261bd22
|
Functionality tested, working as intended. NOTE: Probably unrelated, but in case if it helps -> I'm not sure if there is an issue with this PR or it's just a particular issue on my end, but starting the wallet on testnet with this PR pulled on top of latest master resulted with "scanning block" (although GUI was saying "scanning block ...", it was actually doing sync from scratch (I believe) because it was using the bandwidth just like it is using when doing the sync from scratch. |
|
@NoobieDev12 not an issue of this PR. About the conflicted tx state. It's ok, not an issue. As your node was syncing, your wallet had transactions that were not part of the main chain at a certain point. Once the block which includes them was processed, the transaction state got updated properly. |
Work on top of #1816 and part of #1817 coinstake transaction creation speedup goal. Starting on 01814d5
Improving the following situation: we are calculating the stakeable utxo twice for the same PoS block creation process (looping over the entire wallet's transactions map twice), one before calling
CreateNewBlockinCheckForCoinsand the second one inside theCreateNewBlockmethod when we callCWallet::CreateCoinStake.This PR fixes it adding an unique available coins vector calculated before the block creation, only once per try, in the
CheckForCoinsfunction and feedingCreateNewBlockwith it.