Open Doy-lee opened 4 years ago
A possible alternative to this is to make FAKECHAIN use some other, very light mining algorithm (e.g. SHA-256, or maybe just the existing CN-pico). I suspect most of the CPU time used is in the randomx initialization rather than actual block generation.
This will speed up tests by saving time on the block generation and block replay step.
One gotcha with this is some core_tests rely on absolute block heights (which become incorrect if you change the number of blocks generated) and not calculating them at run-time causing them to spuriously fail.
Another gotcha when running core_tests, FAKECHAIN is passed to
blockchain::init
, currently the Blockchain will try to deserialize the MAINNET genesis blob which has the CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW set to 30 and will fail validation if you change it to anything else for core_tests.This is actually an extraneous step, since all core_tests generate their own genesis block and use
blockchain::reset_and_set_genesis_block(..)
to replace the MAINNET block. (This new block will have the correct CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW value if you have changed it. The MAINNET genesis block is hardcoded and will fail miner TX pre-validation).