Implement helper class for CTxMemPoolEntry constructor

This is only for unit tests.
This commit is contained in:
Alex Morcos
2015-11-14 17:04:15 -05:00
committed by Jack Grigg
parent 934fd19744
commit f41775b2c8
5 changed files with 68 additions and 28 deletions

View File

@@ -36,4 +36,29 @@ struct TestingSetup: public JoinSplitTestingSetup {
~TestingSetup();
};
class CTxMemPoolEntry;
class CTxMemPool;
struct TestMemPoolEntryHelper
{
// Default values
CAmount nFee;
int64_t nTime;
double dPriority;
unsigned int nHeight;
bool hadNoDependencies;
TestMemPoolEntryHelper() :
nFee(0), nTime(0), dPriority(0.0), nHeight(1),
hadNoDependencies(false) { }
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; }
};
#endif