{"action":"created","issue":{"url":"https://api.github.com/repos/zathras-crypto/mastercore/issues/66","labels_url":"https://api.github.com/repos/zathras-crypto/mastercore/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/zathras-crypto/mastercore/issues/66/comments","events_url":"https://api.github.com/repos/zathras-crypto/mastercore/issues/66/events","html_url":"https://github.com/zathras-crypto/mastercore/issues/66","id":69549331,"number":66,"title":"Audit failure during block reorganizations","user":{"login":"dexX7","id":5836089,"avatar_url":"https://avatars.githubusercontent.com/u/5836089?v=3","gravatar_id":"","url":"https://api.github.com/users/dexX7","html_url":"https://github.com/dexX7","followers_url":"https://api.github.com/users/dexX7/followers","following_url":"https://api.github.com/users/dexX7/following{/other_user}","gists_url":"https://api.github.com/users/dexX7/gists{/gist_id}","starred_url":"https://api.github.com/users/dexX7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dexX7/subscriptions","organizations_url":"https://api.github.com/users/dexX7/orgs","repos_url":"https://api.github.com/users/dexX7/repos","events_url":"https://api.github.com/users/dexX7/events{/privacy}","received_events_url":"https://api.github.com/users/dexX7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-04-20T09:44:08Z","updated_at":"2015-04-24T02:55:05Z","closed_at":null,"body":"Re: the Travis failures:\r\n\r\nIt looks like this is caused by the Bitcoin Core RPC tests, which involve reorganizations and network splits. In particular:\r\n\r\n```\r\nAuditor has detected processing of a block in a non-sequential order (201)\r\n```\r\n```\r\nAuditor has received unexpected notification of completion of block 201\r\n```\r\n```\r\nAuditor has detected inconsistencies when attempting to update the total amount of tokens for property 1\r\nType:increase  Total cached:3815712997063, Amount changed:2640094941521, Total cached after update:6455807938584, Total from state:3815712997063\r\n```\r\nThis is probably where it happens, in this test at least: [mempool_resurrect_test.py#L67-L70](https://github.com/zathras-crypto/mastercore/blob/db0916bd13d7a7f932fecd1b41c3cc1c8c61264a/qa/rpc-tests/mempool_resurrect_test.py#L67-L70)\r\n\r\nTo reproduce, dump the information to the console, and run:\r\n```\r\nomnicore/qa/rpc-tests$ ./mempool_resurrect_test.py\r\n```\r\n... or alternatively, don't let the test remove the temporary data and specify a target datadir:\r\n```\r\nomnicore/qa/rpc-tests$ ./mempool_resurrect_test.py --nocleanup --tmpdir=./testoutput\r\n```\r\nThen, you'd find the logs and data in:\r\n```\r\nomnicore/qa/rpc-tests/testoutput/node0/regtest/mastercore.log\r\nomnicore/qa/rpc-tests/testoutput/node1/regtest/mastercore.log\r\nomnicore/qa/rpc-tests/testoutput/node2/regtest/mastercore.log\r\nomnicore/qa/rpc-tests/testoutput/node3/regtest/mastercore.log\r\n```\r\n\r\nOne quick note regarding those tests in general: usually, during the first run, a cache is created for the first 200 blocks. Not all tests use that cache, but many do. This cache dir should be in `omnicore/qa/rpc-tests/cache` and you can start with a completely clean state by removing that dir:\r\n```\r\nomnicore/qa/rpc-tests$ rm -rf cache/\r\n```\r\n\r\nThere are probably other reorg tests in the same dir `omnicore/qa/rpc-tests/`, and Travis also runs additional tests of BitcoinJ, via the [BitcoindComparisionTool](https://github.com/TheBlueMatt/test-scripts/), but those Python tests are much easier to run. :)"},"comment":{"url":"https://api.github.com/repos/zathras-crypto/mastercore/issues/comments/95782446","html_url":"https://github.com/zathras-crypto/mastercore/issues/66#issuecomment-95782446","issue_url":"https://api.github.com/repos/zathras-crypto/mastercore/issues/66","id":95782446,"user":{"login":"zathras-crypto","id":5633351,"avatar_url":"https://avatars.githubusercontent.com/u/5633351?v=3","gravatar_id":"","url":"https://api.github.com/users/zathras-crypto","html_url":"https://github.com/zathras-crypto","followers_url":"https://api.github.com/users/zathras-crypto/followers","following_url":"https://api.github.com/users/zathras-crypto/following{/other_user}","gists_url":"https://api.github.com/users/zathras-crypto/gists{/gist_id}","starred_url":"https://api.github.com/users/zathras-crypto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zathras-crypto/subscriptions","organizations_url":"https://api.github.com/users/zathras-crypto/orgs","repos_url":"https://api.github.com/users/zathras-crypto/repos","events_url":"https://api.github.com/users/zathras-crypto/events{/privacy}","received_events_url":"https://api.github.com/users/zathras-crypto/received_events","type":"User","site_admin":false},"created_at":"2015-04-24T02:55:05Z","updated_at":"2015-04-24T02:55:05Z","body":"> I'm not sure, if this is of any use for you\r\n\r\nAre you kidding?  :)  Hugely useful mate :)  I didn't do the reorg stuff so I'd always wondered how solid it was.  The guy who wrote it (Bart) is very good (well above my grade haha), but I'd always wondered if we were properly tested in that area.  I'm VERY glad to hear you spin up some tests and that they pass.\r\n\r\nIncidentally, just for sanity a while back I put in some quick detection that we're not leaving stuff behind in a reorg - does ```mastercore.log``` contain any lines with the text ```LEVELDB TX OVERWRITE DETECTION - txid1234abcd``` when you run this?  I'd expect so as I haven't pushed https://github.com/zathras-crypto/mastercore/commit/4ef9c6de3891b81c97d5e0c5700f0fd15ddd5836 to main yet...\r\n"}}