Skip to content

Conversation

@furszy
Copy link

@furszy furszy commented Aug 25, 2020

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 CreateNewBlock in CheckForCoins and the second one inside the CreateNewBlock method when we call CWallet::CreateCoinStake.
This PR fixes it adding an unique available coins vector calculated before the block creation, only once per try, in the CheckForCoins function and feeding CreateNewBlock with it.

@furszy furszy self-assigned this Aug 25, 2020
Copy link

@random-zebra random-zebra left a 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.
@furszy furszy force-pushed the 2020_miner_calculate_stakeable_coins_only_once branch from 01814d5 to 261bd22 Compare September 6, 2020 23:00
@furszy
Copy link
Author

furszy commented Sep 6, 2020

rebased.

Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 261bd22

@ambassador000
Copy link

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.
Also, transactions were "conflicted" during the scanning block process and turned to confirmed when wallet fully synced.

@random-zebra random-zebra added Refactoring Block Generation Mining/Staking related issues labels Sep 7, 2020
@random-zebra random-zebra added this to the 5.0.0 milestone Sep 7, 2020
@furszy
Copy link
Author

furszy commented Sep 7, 2020

@NoobieDev12 not an issue of this PR.
The topbar message was always in that way (no distinction between sync from scratch and db reindex). Will check it in another PR and add the distinction (if needed).

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.

@furszy furszy merged commit 242356d into PIVX-Project:master Sep 8, 2020
@random-zebra random-zebra modified the milestones: 5.0.0, 4.3.0 Sep 10, 2020
@furszy furszy deleted the 2020_miner_calculate_stakeable_coins_only_once branch November 29, 2022 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Block Generation Mining/Staking related issues Refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants