2015-03-03 07:49:12 -08:00
|
|
|
#ifndef BITCOIN_TEST_TEST_BITCOIN_H
|
|
|
|
#define BITCOIN_TEST_TEST_BITCOIN_H
|
|
|
|
|
2018-02-09 15:16:55 -08:00
|
|
|
#include "consensus/upgrades.h"
|
2015-07-28 11:11:20 -07:00
|
|
|
#include "pubkey.h"
|
2015-03-03 07:49:12 -08:00
|
|
|
#include "txdb.h"
|
|
|
|
|
|
|
|
#include <boost/filesystem.hpp>
|
|
|
|
#include <boost/thread.hpp>
|
|
|
|
|
2015-03-12 01:34:42 -07:00
|
|
|
/** Basic testing setup.
|
|
|
|
* This just configures logging and chain parameters.
|
|
|
|
*/
|
|
|
|
struct BasicTestingSetup {
|
2015-07-28 11:11:20 -07:00
|
|
|
ECCVerifyHandle globalVerifyHandle;
|
|
|
|
|
2015-07-28 11:15:46 -07:00
|
|
|
BasicTestingSetup();
|
2015-03-12 01:34:42 -07:00
|
|
|
~BasicTestingSetup();
|
|
|
|
};
|
|
|
|
|
2017-11-05 09:02:21 -08:00
|
|
|
// Setup w.r.t. zk-SNARK API
|
|
|
|
struct JoinSplitTestingSetup: public BasicTestingSetup {
|
|
|
|
JoinSplitTestingSetup();
|
|
|
|
~JoinSplitTestingSetup();
|
|
|
|
};
|
|
|
|
|
2015-03-12 01:34:42 -07:00
|
|
|
/** Testing setup that configures a complete environment.
|
|
|
|
* Included are data directory, coins database, script check threads
|
|
|
|
* and wallet (if enabled) setup.
|
|
|
|
*/
|
2017-11-05 09:02:21 -08:00
|
|
|
struct TestingSetup: public JoinSplitTestingSetup {
|
2015-03-03 07:49:12 -08:00
|
|
|
CCoinsViewDB *pcoinsdbview;
|
|
|
|
boost::filesystem::path pathTemp;
|
|
|
|
boost::thread_group threadGroup;
|
|
|
|
|
2015-07-28 11:15:46 -07:00
|
|
|
TestingSetup();
|
2015-03-03 07:49:12 -08:00
|
|
|
~TestingSetup();
|
|
|
|
};
|
|
|
|
|
2015-11-14 14:04:15 -08:00
|
|
|
class CTxMemPoolEntry;
|
|
|
|
class CTxMemPool;
|
|
|
|
|
|
|
|
struct TestMemPoolEntryHelper
|
|
|
|
{
|
|
|
|
// Default values
|
|
|
|
CAmount nFee;
|
|
|
|
int64_t nTime;
|
|
|
|
double dPriority;
|
|
|
|
unsigned int nHeight;
|
|
|
|
bool hadNoDependencies;
|
2015-10-29 11:06:13 -07:00
|
|
|
bool spendsCoinbase;
|
2018-02-09 15:16:55 -08:00
|
|
|
uint32_t nBranchId;
|
2015-11-14 14:04:15 -08:00
|
|
|
|
|
|
|
TestMemPoolEntryHelper() :
|
|
|
|
nFee(0), nTime(0), dPriority(0.0), nHeight(1),
|
2018-02-09 15:16:55 -08:00
|
|
|
hadNoDependencies(false), spendsCoinbase(false),
|
|
|
|
nBranchId(SPROUT_BRANCH_ID) { }
|
2015-11-14 14:04:15 -08:00
|
|
|
|
|
|
|
CTxMemPoolEntry FromTx(CMutableTransaction &tx, CTxMemPool *pool = NULL);
|
|
|
|
|
|
|
|
// Change the default value
|
|
|
|
TestMemPoolEntryHelper &Fee(CAmount _fee) { nFee = _fee; return *this; }
|
|
|
|
TestMemPoolEntryHelper &Time(int64_t _time) { nTime = _time; return *this; }
|
|
|
|
TestMemPoolEntryHelper &Priority(double _priority) { dPriority = _priority; return *this; }
|
|
|
|
TestMemPoolEntryHelper &Height(unsigned int _height) { nHeight = _height; return *this; }
|
|
|
|
TestMemPoolEntryHelper &HadNoDependencies(bool _hnd) { hadNoDependencies = _hnd; return *this; }
|
2015-10-29 11:06:13 -07:00
|
|
|
TestMemPoolEntryHelper &SpendsCoinbase(bool _flag) { spendsCoinbase = _flag; return *this; }
|
2018-02-09 15:16:55 -08:00
|
|
|
TestMemPoolEntryHelper &BranchId(uint32_t _branchId) { nBranchId = _branchId; return *this; }
|
2015-11-14 14:04:15 -08:00
|
|
|
};
|
2015-03-03 07:49:12 -08:00
|
|
|
#endif
|