How to test invalid blocks?

+4 votes
Hi,

We were looking into how Multichain handles invalid blocks created by miners. We saw that in the code there's a function InvalidChainFound that will show in the debug.log when an invalid block is found. My question is: Is there a way for us to test that this is working. I assume we'd have to compile a node with some modified code to simulate creating an invalid block?

Thanks
asked Jun 5, 2018 by anonymous

1 Answer

0 votes

Well, there's an easier way to do it than this. On one non-mining node, issue the pause incoming command, so that it retrieves no new blocks from the network. Then wait for the next block to be generated, and gets its raw hex content from a different node using: getblock [block-height] false

Then make any modification you want to this block's hexadecimal, then attempt to submit it to the paused node using the submitblock command. You may see different errors depending on the type of change you made.

answered Jun 5, 2018 by MultiChain
How can I make changes to the hexadecimal of my Block to test if it is invalid?

Thank
You can do this in any text editor.
...