tradecraftio / tradecraft

Tradecraft integration/staging tree https://tradecraft.io/download
Other
13 stars 9 forks source link

Re-enable RPC regression tests from bitcoin with "bitcoin mode" (no demurrage) regtest chain #40

Closed maaku closed 5 years ago

maaku commented 5 years ago

For the past couple of releases the majority of RPC regression tests have bee disabled due to their implementation making certain assumptions about the behavior of the chain, such as blocks having 50 BTC subsidy, and not taking into account value decay due to demurrage. For example:

Previously I updated these tests individually, but this proved difficult to maintain. In recent rebasing efforts I delayed introduction of demurrage and changing subsidy until the end so the tests could at least be run against earlier patches. This PR introduces a more long-term solution.

This PR changes the subsidy on regtest to resemble bitcoin's (50 coins per block), and introduces a new consensus-impacting option -notimeadjust (only available with -regtest) which disables demurrage / time-value adjustment. Running the JSON-RPC python test framework with the --bitcoin-mode command line option turns on this no-demurrage mode.

This proved sufficient to get all but one of the pull-tester's default JSON-RPC tests to run. I have not yet investigated the -extended tests, or gotten to the bottom of the one failing test script, p2p-fullblocktest.py.

Fixes #38.

maaku commented 5 years ago

I got the unknown error in p2p-fullblocktest.py sorted out. It is an unrelated failure due to excess fee in calculations prior to the truncated inputs and ALU demurrage calculation soft-forks. I have an idea for fixing this, but it should be a separate PR. So this code is now ready to merge as-is.