* [Bitcoin-development] Question on creating test cases for block.CheckBlock()
@ 2014-07-21 17:30 Sergio Lerner
2014-07-22 11:13 ` Mike Hearn
0 siblings, 1 reply; 2+ messages in thread
From: Sergio Lerner @ 2014-07-21 17:30 UTC (permalink / raw)
To: bitcoin-development
I'm working on a BIP which needs to modify the block acceptance rules. I
have two ways of testing:
- Mining blocks on the testnet
- Creating test cases for Bitcoin Core.
I want to create those test cases for block.CheckBlock(), which involves
verifying 100 dynamically generated blocks.
What is the state of the blockchain when a test case is executed ? Is is
configured for the regtest, testnet3 or mainnet? What blocks are in the
blockchain? Only the genesis block?
checkblock_tests.cpp seems to be the only test case for CheckBlock() and
it assumes the mainnet is configured.
I need to use the regtest so I can create blocks of difficulty 1.
Best regards and thank you in advance,
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Bitcoin-development] Question on creating test cases for block.CheckBlock()
2014-07-21 17:30 [Bitcoin-development] Question on creating test cases for block.CheckBlock() Sergio Lerner
@ 2014-07-22 11:13 ` Mike Hearn
0 siblings, 0 replies; 2+ messages in thread
From: Mike Hearn @ 2014-07-22 11:13 UTC (permalink / raw)
To: Sergio Lerner; +Cc: bitcoin-development
[-- Attachment #1: Type: text/plain, Size: 2194 bytes --]
There is no infrastructure for writing block chain unit tests
unfortunately. Last time I tried to fix this I ended up going down a rabbit
hole - Bitcoin wasn't written to be a testable codebase and as a result
reinitialising it from scratch is rather difficult (there are lots of
global variables that have to be reset to particular states and no real
list of where they are).
Instead what I ended up doing is extending the pull tester. This is a
bitcoinj based app (BitcoindComparisonTool in the codebase) which builds a
regtest chain and submits it to a local regtest node. It tests things like
reorgs and various rules. It speaks to the node only via P2P so how easy it
is to verify your BIP works will depend on that. Also the code needs
cleaning up, there's a lot of copy/paste coding going on in there.
On Mon, Jul 21, 2014 at 7:30 PM, Sergio Lerner <sergiolerner@certimix.com>
wrote:
> I'm working on a BIP which needs to modify the block acceptance rules. I
> have two ways of testing:
>
> - Mining blocks on the testnet
> - Creating test cases for Bitcoin Core.
>
> I want to create those test cases for block.CheckBlock(), which involves
> verifying 100 dynamically generated blocks.
> What is the state of the blockchain when a test case is executed ? Is is
> configured for the regtest, testnet3 or mainnet? What blocks are in the
> blockchain? Only the genesis block?
>
> checkblock_tests.cpp seems to be the only test case for CheckBlock() and
> it assumes the mainnet is configured.
> I need to use the regtest so I can create blocks of difficulty 1.
>
> Best regards and thank you in advance,
>
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
[-- Attachment #2: Type: text/html, Size: 2872 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-22 11:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-21 17:30 [Bitcoin-development] Question on creating test cases for block.CheckBlock() Sergio Lerner
2014-07-22 11:13 ` Mike Hearn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox