diff options
author | Alex Morcos <morcos@chaincode.com> | 2015-11-14 17:04:15 -0500 |
---|---|---|
committer | Alex Morcos <morcos@chaincode.com> | 2015-11-16 20:41:32 -0500 |
commit | e587bc3fd9ed7eb1aa787859748f37dd387f9cec (patch) | |
tree | 64af57efb50d03f9fc81f00dcf261d293cdfd803 /src/test/test_bitcoin.h | |
parent | 87ee0e2dbc1201a5104d524ace32c0134ead019f (diff) | |
download | bitcoin-e587bc3fd9ed7eb1aa787859748f37dd387f9cec.tar.xz |
Implement helper class for CTxMemPoolEntry constructor
This is only for unit tests.
Diffstat (limited to 'src/test/test_bitcoin.h')
-rw-r--r-- | src/test/test_bitcoin.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/test_bitcoin.h b/src/test/test_bitcoin.h index f657d72038..815b227411 100644 --- a/src/test/test_bitcoin.h +++ b/src/test/test_bitcoin.h @@ -54,4 +54,29 @@ struct TestChain100Setup : public TestingSetup { CKey coinbaseKey; // private/public key needed to spend coinbase transactions }; +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 |