BlockChain.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. /*
  2. This file is part of cpp-ethereum.
  3. cpp-ethereum is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. cpp-ethereum is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. /** @file fullblockchain.cpp
  15. * @author Dimitry Khokhlov <dimitry@ethdev.com>
  16. * @date 2015
  17. * Blockchain test functions.
  18. */
  19. #include <libethereum/Block.h>
  20. #include <libethereum/BlockChain.h>
  21. #include <test/TestHelper.h>
  22. #include <test/BlockChainHelper.h>
  23. #include <libethereum/GenesisInfo.h>
  24. #include <libethashseal/GenesisInfo.h>
  25. using namespace std;
  26. using namespace dev;
  27. using namespace dev::eth;
  28. using namespace dev::test;
  29. BOOST_FIXTURE_TEST_SUITE(BlockChainSuite, TestOutputHelper)
  30. BOOST_AUTO_TEST_CASE(output)
  31. {
  32. try
  33. {
  34. BOOST_WARN(string(BlockChainDebug::name()) == string(EthBlue "☍" EthWhite " ◇"));
  35. BOOST_WARN(string(BlockChainWarn::name()) == string(EthBlue "☍" EthOnRed EthBlackBold " ✘"));
  36. BOOST_WARN(string(BlockChainNote::name()) == string(EthBlue "☍" EthBlue " ℹ"));
  37. BOOST_WARN(string(BlockChainChat::name()) == string(EthBlue "☍" EthWhite " ◌"));
  38. TestBlock genesis = TestBlockChain::defaultGenesisBlock();
  39. TestBlockChain bc(genesis);
  40. TestBlock block;
  41. block.mine(bc);
  42. bc.addBlock(block);
  43. std::stringstream buffer;
  44. buffer << bc.interface();
  45. BOOST_REQUIRE(buffer.str().size() == 139);
  46. buffer.str(std::string());
  47. }
  48. catch (Exception const& _e)
  49. {
  50. BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
  51. }
  52. catch (std::exception const& _e)
  53. {
  54. BOOST_ERROR("Failed test with Exception: " << _e.what());
  55. }
  56. catch(...)
  57. {
  58. BOOST_ERROR("Exception thrown when trying to mine or import a block!");
  59. }
  60. }
  61. BOOST_AUTO_TEST_CASE(opendb)
  62. {
  63. TestBlock genesis = TestBlockChain::defaultGenesisBlock();
  64. TransientDirectory tempDirBlockchain;
  65. ChainParams p(genesisInfo(Network::Test), genesis.bytes(), genesis.accountMap());
  66. BlockChain bc(p, tempDirBlockchain.path(), WithExisting::Kill);
  67. auto is_critical = []( std::exception const& _e) { return string(_e.what()).find("DatabaseAlreadyOpen") != string::npos; };
  68. BOOST_CHECK_EXCEPTION(BlockChain bc2(p, tempDirBlockchain.path(), WithExisting::Verify), DatabaseAlreadyOpen, is_critical);
  69. }
  70. //BOOST_AUTO_TEST_CASE(rebuild)
  71. //{
  72. // string dbPath;
  73. // TestBlock genesisCopy;
  74. // {
  75. // TestBlock genesis = TestBlockChain::getDefaultGenesisBlock();
  76. // genesisCopy = genesis;
  77. // TransientDirectory tempDirBlockchain;
  78. // dbPath = tempDirBlockchain.path();
  79. // FullBlockChain<Ethash> bc(genesis.getBytes(), AccountMap(), tempDirBlockchain.path(), WithExisting::Kill);
  80. // TestTransaction testTr = TestTransaction::getDefaultTransaction();
  81. // TransactionQueue trQueue;
  82. // trQueue.import(testTr.getTransaction().rlp());
  83. // ZeroGasPricer gp;
  84. // Block block = bc.genesisBlock(genesis.getState().db());
  85. // block.sync(bc);
  86. // block.sync(bc, trQueue, gp);
  87. // dev::eth::mine(block, bc);
  88. // bc.import(block.blockData(), block.state().db());
  89. // BOOST_REQUIRE(bc.number() == 1);
  90. // bc.rebuild(tempDirBlockchain.path());
  91. // BOOST_REQUIRE(bc.number() == 1);
  92. // }
  93. // FullBlockChain<Ethash> bc(genesisCopy.getBytes(), AccountMap(), dbPath, WithExisting::Verify);
  94. // BOOST_REQUIRE(bc.number() == 0);
  95. // bc.rebuild(dbPath);
  96. // BOOST_REQUIRE(bc.number() == 1);
  97. //}
  98. BOOST_AUTO_TEST_CASE(Mining_1_mineBlockWithTransaction)
  99. {
  100. try
  101. {
  102. dev::test::TestBlockChain::s_sealEngineNetwork = eth::Network::FrontierTest;
  103. TestBlockChain bc(TestBlockChain::defaultGenesisBlock());
  104. TestTransaction tr = TestTransaction::defaultTransaction(1); //nonce = 1
  105. TestBlock block;
  106. block.addTransaction(tr);
  107. block.mine(bc);
  108. bc.addBlock(block);
  109. BOOST_REQUIRE(bc.interface().transactions().size() > 0);
  110. }
  111. catch (Exception const& _e)
  112. {
  113. BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
  114. }
  115. catch (std::exception const& _e)
  116. {
  117. BOOST_ERROR("Failed test with Exception: " << _e.what());
  118. }
  119. catch(...)
  120. {
  121. BOOST_ERROR("Exception thrown when trying to mine or import a block!");
  122. }
  123. }
  124. BOOST_AUTO_TEST_CASE(Mining_2_mineUncles)
  125. {
  126. try
  127. {
  128. dev::test::TestBlockChain::s_sealEngineNetwork = eth::Network::FrontierTest;
  129. TestBlockChain bc(TestBlockChain::defaultGenesisBlock());
  130. TestTransaction tr = TestTransaction::defaultTransaction(1); //nonce = 1
  131. TestBlock block;
  132. block.addTransaction(tr);
  133. block.mine(bc);
  134. bc.addBlock(block);
  135. TestBlock uncleBlock;
  136. uncleBlock.mine(bc);
  137. TestBlock uncleBlock2;
  138. uncleBlock2.mine(bc);
  139. TestTransaction tr2 = TestTransaction::defaultTransaction(2);
  140. TestBlock block2;
  141. block2.addTransaction(tr2);
  142. block2.mine(bc);
  143. bc.addBlock(block2);
  144. }
  145. catch (Exception const& _e)
  146. {
  147. BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
  148. }
  149. catch (std::exception const& _e)
  150. {
  151. BOOST_ERROR("Failed test with Exception: " << _e.what());
  152. }
  153. catch(...)
  154. {
  155. BOOST_ERROR("Exception thrown when trying to mine or import a block!");
  156. }
  157. }
  158. /*
  159. Often broken test disabled 5th September 2016, until we have time to
  160. troubleshoot the root cause.
  161. See https://github.com/ethereum/cpp-ethereum/issues/3256.
  162. BOOST_AUTO_TEST_CASE(Mining_3_mineBlockWithUncles)
  163. {
  164. try
  165. {
  166. dev::test::TestBlockChain::s_sealEngineNetwork = eth::Network::FrontierTest;
  167. TestBlockChain bc(TestBlockChain::defaultGenesisBlock());
  168. TestTransaction tr = TestTransaction::defaultTransaction(1); //nonce = 1
  169. TestBlock block;
  170. block.addTransaction(tr);
  171. block.mine(bc);
  172. bc.addBlock(block);
  173. TestBlock uncleBlock;
  174. uncleBlock.mine(bc);
  175. TestBlock uncleBlock2;
  176. uncleBlock2.mine(bc);
  177. TestTransaction tr2 = TestTransaction::defaultTransaction(2);
  178. TestBlock block2;
  179. block2.addTransaction(tr2);
  180. block2.mine(bc);
  181. bc.addBlock(block2);
  182. TestTransaction tr3 = TestTransaction::defaultTransaction(3);
  183. TestBlock block3;
  184. block3.addUncle(uncleBlock);
  185. bc.syncUncles(block3.uncles());
  186. block3.addTransaction(tr3);
  187. block3.mine(bc);
  188. bc.addBlock(block3);
  189. BOOST_REQUIRE(bc.interface().info().number() == 3);
  190. BOOST_REQUIRE(bc.interface().info(uncleBlock.blockHeader().hash()) == uncleBlock.blockHeader());
  191. }
  192. catch (Exception const& _e)
  193. {
  194. BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
  195. }
  196. catch (std::exception const& _e)
  197. {
  198. BOOST_ERROR("Failed test with Exception: " << _e.what());
  199. }
  200. catch(...)
  201. {
  202. BOOST_ERROR("Exception thrown when trying to mine or import a block!");
  203. }
  204. }
  205. */
  206. /*
  207. Often broken test disabled 5th September 2016, until we have time to
  208. troubleshoot the root cause.
  209. See https://github.com/ethereum/cpp-ethereum/issues/3059.
  210. BOOST_AUTO_TEST_CASE(Mining_4_BlockQueueSyncing)
  211. {
  212. try
  213. {
  214. dev::test::TestBlockChain::s_sealEngineNetwork = eth::Network::FrontierTest;
  215. TestBlockChain bc(TestBlockChain::defaultGenesisBlock());
  216. TestBlockChain bc2(TestBlockChain::defaultGenesisBlock());
  217. TestBlock block;
  218. block.mine(bc2);
  219. bc2.addBlock(block);
  220. TestBlock block2;
  221. block2.mine(bc2);
  222. BlockQueue uncleBlockQueue;
  223. uncleBlockQueue.setChain(bc2.interface());
  224. ImportResult importIntoQueue = uncleBlockQueue.import(&block2.bytes(), false);
  225. BOOST_REQUIRE(importIntoQueue == ImportResult::Success);
  226. this_thread::sleep_for(chrono::seconds(2));
  227. BlockChain& bcRef = bc.interfaceUnsafe();
  228. bcRef.sync(uncleBlockQueue, bc.testGenesis().state().db(), unsigned(4));
  229. //Attempt import block5 to another blockchain
  230. pair<ImportResult, ImportRoute> importAttempt;
  231. importAttempt = bcRef.attemptImport(block2.bytes(), bc.testGenesis().state().db());
  232. BOOST_REQUIRE(importAttempt.first == ImportResult::UnknownParent);
  233. //Insert block5 to another blockchain
  234. auto is_critical = []( std::exception const& _e) { cnote << _e.what(); return true; };
  235. BOOST_CHECK_EXCEPTION(bcRef.insert(block2.bytes(), block2.receipts()), UnknownParent, is_critical);
  236. //Get status of block5 in the block queue based on block5's chain (block5 imported into queue but not imported into chain)
  237. //BlockQueue(bc2) changed by sync function of original bc
  238. QueueStatus status = uncleBlockQueue.blockStatus(block2.blockHeader().hash());
  239. BOOST_REQUIRE_MESSAGE(status == QueueStatus::Bad, "Received Queue Status: " + toString(status) + " Expected Queue Status: " + toString(QueueStatus::Bad));
  240. }
  241. catch (Exception const& _e)
  242. {
  243. BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
  244. }
  245. catch (std::exception const& _e)
  246. {
  247. BOOST_ERROR("Failed test with Exception: " << _e.what());
  248. }
  249. catch(...)
  250. {
  251. BOOST_ERROR("Exception thrown when trying to mine or import a block!");
  252. }
  253. }
  254. */
  255. BOOST_AUTO_TEST_CASE(Mining_5_BlockFutureTime)
  256. {
  257. try
  258. {
  259. dev::test::TestBlockChain::s_sealEngineNetwork = eth::Network::FrontierTest;
  260. TestBlockChain bc(TestBlockChain::defaultGenesisBlock());
  261. TestBlock uncleBlock;
  262. uncleBlock.mine(bc);
  263. BlockHeader uncleHeader = uncleBlock.blockHeader();
  264. uncleHeader.setTimestamp(uncleHeader.timestamp() + 10000);
  265. uncleBlock.setBlockHeader(uncleHeader);
  266. uncleBlock.updateNonce(bc);
  267. BlockQueue uncleBlockQueue;
  268. uncleBlockQueue.setChain(bc.interface());
  269. uncleBlockQueue.import(&uncleBlock.bytes(), false);
  270. this_thread::sleep_for(chrono::seconds(2));
  271. BlockChain& bcRef = bc.interfaceUnsafe();
  272. bcRef.sync(uncleBlockQueue, bc.testGenesis().state().db(), unsigned(4));
  273. BOOST_REQUIRE(uncleBlockQueue.blockStatus(uncleBlock.blockHeader().hash()) == QueueStatus::Unknown);
  274. pair<ImportResult, ImportRoute> importAttempt;
  275. importAttempt = bcRef.attemptImport(uncleBlock.bytes(), bc.testGenesis().state().db());
  276. BOOST_REQUIRE(importAttempt.first == ImportResult::FutureTimeKnown);
  277. auto is_critical = []( std::exception const& _e) { cnote << _e.what(); return true; };
  278. BOOST_CHECK_EXCEPTION(bcRef.insert(uncleBlock.bytes(), uncleBlock.receipts()), FutureTime, is_critical);
  279. }
  280. catch (Exception const& _e)
  281. {
  282. BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
  283. }
  284. catch (std::exception const& _e)
  285. {
  286. BOOST_ERROR("Failed test with Exception: " << _e.what());
  287. }
  288. catch(...)
  289. {
  290. BOOST_ERROR("Exception thrown when trying to mine or import a block!");
  291. }
  292. }
  293. bool onBadwasCalled = false;
  294. void onBad(Exception& _ex)
  295. {
  296. cout << _ex.what();
  297. onBadwasCalled = true;
  298. }
  299. BOOST_AUTO_TEST_CASE(attemptImport)
  300. {
  301. //UnknownParent
  302. //Success
  303. //AlreadyKnown
  304. //FutureTimeKnown
  305. //Malformed
  306. try
  307. {
  308. TestBlockChain bc(TestBlockChain::defaultGenesisBlock());
  309. TestTransaction tr = TestTransaction::defaultTransaction();
  310. TestBlock block;
  311. block.addTransaction(tr);
  312. block.mine(bc);
  313. pair<ImportResult, ImportRoute> importAttempt;
  314. BlockChain& bcRef = bc.interfaceUnsafe();
  315. bcRef.setOnBad(onBad);
  316. importAttempt = bcRef.attemptImport(block.bytes(), bc.testGenesis().state().db());
  317. BOOST_REQUIRE(importAttempt.first == ImportResult::Success);
  318. importAttempt = bcRef.attemptImport(block.bytes(), bc.testGenesis().state().db());
  319. BOOST_REQUIRE(importAttempt.first == ImportResult::AlreadyKnown);
  320. bytes blockBytes = block.bytes();
  321. blockBytes[0] = 0;
  322. importAttempt = bcRef.attemptImport(blockBytes, bc.testGenesis().state().db());
  323. BOOST_REQUIRE(importAttempt.first == ImportResult::Malformed);
  324. BOOST_REQUIRE(onBadwasCalled == true);
  325. cout << endl;
  326. }
  327. catch (Exception const& _e)
  328. {
  329. BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
  330. }
  331. catch (std::exception const& _e)
  332. {
  333. BOOST_ERROR("Failed test with Exception: " << _e.what());
  334. }
  335. catch(...)
  336. {
  337. BOOST_ERROR("Exception thrown when trying to mine or import a block!");
  338. }
  339. }
  340. BOOST_AUTO_TEST_CASE(insert)
  341. {
  342. try
  343. {
  344. TestBlockChain bc(TestBlockChain::defaultGenesisBlock());
  345. TestTransaction tr = TestTransaction::defaultTransaction();
  346. TestBlock block;
  347. block.addTransaction(tr);
  348. block.mine(bc);
  349. BlockChain& bcRef = bc.interfaceUnsafe();
  350. //Incorrect Receipt
  351. ZeroGasPricer gp;
  352. Block bl = bcRef.genesisBlock(bc.testGenesis().state().db());
  353. bl.sync(bcRef);
  354. bl.sync(bcRef, block.transactionQueue(), gp);
  355. //Receipt should be RLPStream
  356. const bytes receipt = bl.receipt(0).rlp();
  357. bytesConstRef receiptRef(&receipt[0], receipt.size());
  358. auto is_critical = []( std::exception const& _e) { return string(_e.what()).find("InvalidBlockFormat") != string::npos; };
  359. BOOST_CHECK_EXCEPTION(bcRef.insert(bl.blockData(), receiptRef), InvalidBlockFormat, is_critical);
  360. auto is_critical2 = []( std::exception const& _e) { return string(_e.what()).find("InvalidReceiptsStateRoot") != string::npos; };
  361. BOOST_CHECK_EXCEPTION(bcRef.insert(block.bytes(), receiptRef), InvalidReceiptsStateRoot, is_critical2);
  362. BOOST_REQUIRE(bcRef.number() == 0);
  363. try
  364. {
  365. bcRef.insert(block.bytes(), block.receipts());
  366. }
  367. catch(...)
  368. {
  369. BOOST_ERROR("Unexpected Exception!");
  370. }
  371. }
  372. catch (Exception const& _e)
  373. {
  374. BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
  375. }
  376. catch (std::exception const& _e)
  377. {
  378. BOOST_ERROR("Failed test with Exception: " << _e.what());
  379. }
  380. catch(...)
  381. {
  382. BOOST_ERROR("Exception thrown when trying to mine or import a block!");
  383. }
  384. }
  385. BOOST_AUTO_TEST_CASE(insertException)
  386. {
  387. try
  388. {
  389. TestBlockChain bc(TestBlockChain::defaultGenesisBlock());
  390. BlockChain& bcRef = bc.interfaceUnsafe();
  391. TestTransaction tr = TestTransaction::defaultTransaction();
  392. TestBlock block;
  393. block.addTransaction(tr);
  394. block.mine(bc);
  395. bc.addBlock(block);
  396. auto is_critical = []( std::exception const& _e) { cnote << _e.what(); return true; };
  397. BOOST_CHECK_EXCEPTION(bcRef.insert(block.bytes(), block.receipts()), AlreadyHaveBlock, is_critical);
  398. }
  399. catch (Exception const& _e)
  400. {
  401. BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
  402. }
  403. catch (std::exception const& _e)
  404. {
  405. BOOST_ERROR("Failed test with Exception: " << _e.what());
  406. }
  407. catch(...)
  408. {
  409. BOOST_ERROR("Exception thrown when trying to mine or import a block!");
  410. }
  411. }
  412. BOOST_AUTO_TEST_CASE(rescue)
  413. {
  414. try
  415. {
  416. TestBlockChain bc(TestBlockChain::defaultGenesisBlock());
  417. {
  418. TestTransaction tr = TestTransaction::defaultTransaction();
  419. TestBlock block;
  420. block.addTransaction(tr);
  421. block.mine(bc);
  422. bc.addBlock(block);
  423. }
  424. {
  425. TestTransaction tr = TestTransaction::defaultTransaction(1);
  426. TestBlock block;
  427. block.addTransaction(tr);
  428. block.mine(bc);
  429. bc.addBlock(block);
  430. }
  431. {
  432. TestTransaction tr = TestTransaction::defaultTransaction(2);
  433. TestBlock block;
  434. block.addTransaction(tr);
  435. block.mine(bc);
  436. bc.addBlock(block);
  437. }
  438. // Temporary disable this assertion, which is failing in TravisCI for OS X Mavericks
  439. // See https://travis-ci.org/ethereum/cpp-ethereum/jobs/156083698.
  440. #if !defined(DISABLE_BROKEN_UNIT_TESTS_UNTIL_WE_FIX_THEM)
  441. try
  442. {
  443. BlockChain& bcRef = bc.interfaceUnsafe();
  444. std::this_thread::sleep_for(std::chrono::seconds(10)); //try wait for block verification before rescue
  445. bcRef.rescue(bc.testGenesis().state().db());
  446. BOOST_CHECK_MESSAGE(bcRef.number() == 3, "Rescued Blockchain missing some blocks!");
  447. }
  448. catch(...)
  449. {
  450. BOOST_ERROR("Unexpected Exception!");
  451. }
  452. #endif // !defined(DISABLE_BROKEN_UNIT_TESTS_UNTIL_WE_FIX_THEM)
  453. }
  454. catch (Exception const& _e)
  455. {
  456. BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
  457. }
  458. catch (std::exception const& _e)
  459. {
  460. BOOST_ERROR("Failed test with Exception: " << _e.what());
  461. }
  462. catch(...)
  463. {
  464. BOOST_ERROR("Exception thrown when trying to mine or import a block!");
  465. }
  466. }
  467. BOOST_AUTO_TEST_CASE(updateStats)
  468. {
  469. try
  470. {
  471. TestBlockChain bc(TestBlockChain::defaultGenesisBlock());
  472. BlockChain& bcRef = bc.interfaceUnsafe();
  473. BlockChain::Statistics stat = bcRef.usage();
  474. //Absolutely random values here!
  475. //BOOST_REQUIRE(stat.memBlockHashes == 0);
  476. //BOOST_REQUIRE(stat.memBlocks == 1); //incorrect value here
  477. //BOOST_REQUIRE(stat.memDetails == 0);
  478. //BOOST_REQUIRE(stat.memLogBlooms == 0);
  479. //BOOST_REQUIRE(stat.memReceipts == 0);
  480. //BOOST_REQUIRE(stat.memTotal() == 0);
  481. //BOOST_REQUIRE(stat.memTransactionAddresses == 0); //incorrect value here
  482. TestTransaction tr = TestTransaction::defaultTransaction();
  483. TestBlock block;
  484. block.addTransaction(tr);
  485. block.mine(bc);
  486. bc.addBlock(block);
  487. stat = bcRef.usage(true);
  488. BOOST_REQUIRE(stat.memBlockHashes == 0);
  489. BOOST_REQUIRE(stat.memBlocks == 675);
  490. BOOST_REQUIRE(stat.memDetails == 138);
  491. BOOST_REQUIRE(stat.memLogBlooms == 8422);
  492. BOOST_REQUIRE(stat.memReceipts == 0);
  493. BOOST_REQUIRE(stat.memTotal() == 9235);
  494. BOOST_REQUIRE(stat.memTransactionAddresses == 0);
  495. //memchache size 33554432 - 3500 blocks before cache to be cleared
  496. bcRef.garbageCollect(true);
  497. }
  498. catch (Exception const& _e)
  499. {
  500. BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e));
  501. }
  502. catch (std::exception const& _e)
  503. {
  504. BOOST_ERROR("Failed test with Exception: " << _e.what());
  505. }
  506. catch(...)
  507. {
  508. BOOST_ERROR("Exception thrown when trying to mine or import a block!");
  509. }
  510. }
  511. BOOST_AUTO_TEST_SUITE_END()