Page MenuHomePhabricator

make nExtraNonce static to IncrementExtraNonce
AbandonedPublic

Authored by majcosta on Jun 24 2021, 08:40.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Summary

guarantees nExtraNonce will not have the same value between two consecutive calls, alternative to D9694 without the rand32()

Test Plan
ninja all check check-functional
for i in {1..100}; do ./test/functional/test_runner.py rpc_dumptxoutset; done

Diff Detail

Event Timeline

forgot the most important line

ensure nExtraNonce is changed in exactly one place, fix expected block hashes in rpc_dumptxoutset

deadalnix requested changes to this revision.Jun 24 2021, 11:39
deadalnix added a subscriber: deadalnix.

No, this is not thread safe.

This revision now requires changes to proceed.Jun 24 2021, 11:39

synchronize static variable, remove static uint256 hashPrevBlock which is now dead code

deadalnix requested changes to this revision.Jun 24 2021, 16:24

uint8 is just 256 values, this would make it impossible to CPU mine on testnet or whatnot.

src/miner.cpp
547 ↗(On Diff #28971)

Please don't use these fast whatever crap.

551 ↗(On Diff #28971)

Relaxed is wrong, here.

This revision now requires changes to proceed.Jun 24 2021, 16:24

use uint32_t instead and use default std::memory_order_seq_cst for atomic increment