aboutsummaryrefslogtreecommitdiff
path: root/src/test/util
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-10-24 11:36:30 +0200
committerMacroFake <falke.marco@gmail.com>2022-10-24 11:33:33 +0200
commitfa2d01470a9f1a91f35ed8013635ac47dabd868b (patch)
tree6369302f63b120bbc296a256ba4e0c958fc581a5 /src/test/util
parent3db23fd821e0a08e246a60c198676be42de5bcd6 (diff)
test: Use type-safe NodeSeconds for TestMemPoolEntryHelper
Diffstat (limited to 'src/test/util')
-rw-r--r--src/test/util/txmempool.cpp3
-rw-r--r--src/test/util/txmempool.h16
2 files changed, 9 insertions, 10 deletions
diff --git a/src/test/util/txmempool.cpp b/src/test/util/txmempool.cpp
index 12cc1a4a3d..1873cf5ec8 100644
--- a/src/test/util/txmempool.cpp
+++ b/src/test/util/txmempool.cpp
@@ -34,6 +34,5 @@ CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction& tx) co
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransactionRef& tx) const
{
- return CTxMemPoolEntry(tx, nFee, nTime, nHeight,
- spendsCoinbase, sigOpCost, lp);
+ return CTxMemPoolEntry{tx, nFee, TicksSinceEpoch<std::chrono::seconds>(time), nHeight, spendsCoinbase, sigOpCost, lp};
}
diff --git a/src/test/util/txmempool.h b/src/test/util/txmempool.h
index 70b9ed88db..2fe7d69693 100644
--- a/src/test/util/txmempool.h
+++ b/src/test/util/txmempool.h
@@ -6,6 +6,7 @@
#define BITCOIN_TEST_UTIL_TXMEMPOOL_H
#include <txmempool.h>
+#include <util/time.h>
namespace node {
struct NodeContext;
@@ -13,11 +14,10 @@ struct NodeContext;
CTxMemPool::Options MemPoolOptionsForTest(const node::NodeContext& node);
-struct TestMemPoolEntryHelper
-{
+struct TestMemPoolEntryHelper {
// Default values
CAmount nFee{0};
- int64_t nTime{0};
+ NodeSeconds time{};
unsigned int nHeight{1};
bool spendsCoinbase{false};
unsigned int sigOpCost{4};
@@ -27,11 +27,11 @@ struct TestMemPoolEntryHelper
CTxMemPoolEntry FromTx(const CTransactionRef& tx) const;
// Change the default value
- TestMemPoolEntryHelper &Fee(CAmount _fee) { nFee = _fee; return *this; }
- TestMemPoolEntryHelper &Time(int64_t _time) { nTime = _time; return *this; }
- TestMemPoolEntryHelper &Height(unsigned int _height) { nHeight = _height; return *this; }
- TestMemPoolEntryHelper &SpendsCoinbase(bool _flag) { spendsCoinbase = _flag; return *this; }
- TestMemPoolEntryHelper &SigOpsCost(unsigned int _sigopsCost) { sigOpCost = _sigopsCost; return *this; }
+ TestMemPoolEntryHelper& Fee(CAmount _fee) { nFee = _fee; return *this; }
+ TestMemPoolEntryHelper& Time(NodeSeconds tp) { time = tp; return *this; }
+ TestMemPoolEntryHelper& Height(unsigned int _height) { nHeight = _height; return *this; }
+ TestMemPoolEntryHelper& SpendsCoinbase(bool _flag) { spendsCoinbase = _flag; return *this; }
+ TestMemPoolEntryHelper& SigOpsCost(unsigned int _sigopsCost) { sigOpCost = _sigopsCost; return *this; }
};
#endif // BITCOIN_TEST_UTIL_TXMEMPOOL_H