You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_bitcoin.h 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef BITCOIN_TEST_TEST_BITCOIN_H
  2. #define BITCOIN_TEST_TEST_BITCOIN_H
  3. #include "chainparamsbase.h"
  4. #include "key.h"
  5. #include "txdb.h"
  6. #include <boost/filesystem.hpp>
  7. #include <boost/thread.hpp>
  8. /** Basic testing setup.
  9. * This just configures logging and chain parameters.
  10. */
  11. struct BasicTestingSetup {
  12. BasicTestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
  13. ~BasicTestingSetup();
  14. };
  15. /** Testing setup that configures a complete environment.
  16. * Included are data directory, coins database, script check threads
  17. * and wallet (if enabled) setup.
  18. */
  19. struct TestingSetup: public BasicTestingSetup {
  20. CCoinsViewDB *pcoinsdbview;
  21. boost::filesystem::path pathTemp;
  22. boost::thread_group threadGroup;
  23. TestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
  24. ~TestingSetup();
  25. };
  26. class CBlock;
  27. struct CMutableTransaction;
  28. class CScript;
  29. //
  30. // Testing fixture that pre-creates a
  31. // 100-block REGTEST-mode block chain
  32. //
  33. struct TestChain100Setup : public TestingSetup {
  34. TestChain100Setup();
  35. // Create a new block with just given transactions, coinbase paying to
  36. // scriptPubKey, and try to add it to the current chain.
  37. CBlock CreateAndProcessBlock(const std::vector<CMutableTransaction>& txns,
  38. const CScript& scriptPubKey);
  39. ~TestChain100Setup();
  40. std::vector<CTransaction> coinbaseTxns; // For convenience, coinbase transactions
  41. CKey coinbaseKey; // private/public key needed to spend coinbase transactions
  42. };
  43. #endif