aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/unit_tests/blockchain_db.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/unit_tests/blockchain_db.cpp b/tests/unit_tests/blockchain_db.cpp
index bda8c167e..127a15b44 100644
--- a/tests/unit_tests/blockchain_db.cpp
+++ b/tests/unit_tests/blockchain_db.cpp
@@ -155,7 +155,7 @@ template <typename T>
class BlockchainDBTest : public testing::Test
{
protected:
- BlockchainDBTest() : m_db(new T())
+ BlockchainDBTest() : m_db(new T()), m_hardfork(*m_db, 1, 0)
{
for (auto& i : t_blocks)
{
@@ -184,11 +184,18 @@ protected:
}
BlockchainDB* m_db;
+ HardFork m_hardfork;
std::string m_prefix;
std::vector<block> m_blocks;
std::vector<std::vector<transaction> > m_txs;
std::vector<std::string> m_filenames;
+ void init_hard_fork()
+ {
+ m_hardfork.init();
+ m_db->set_hard_fork(&m_hardfork);
+ }
+
void get_filenames()
{
m_filenames = m_db->get_filenames();
@@ -257,6 +264,7 @@ TYPED_TEST(BlockchainDBTest, AddBlock)
// make sure open does not throw
ASSERT_NO_THROW(this->m_db->open(fname));
this->get_filenames();
+ this->init_hard_fork();
// adding a block with no parent in the blockchain should throw.
// note: this shouldn't be possible, but is a good (and cheap) failsafe.
@@ -300,6 +308,7 @@ TYPED_TEST(BlockchainDBTest, RetrieveBlockData)
// make sure open does not throw
ASSERT_NO_THROW(this->m_db->open(fname));
this->get_filenames();
+ this->init_hard_fork();
ASSERT_NO_THROW(this->m_db->add_block(this->m_blocks[0], t_sizes[0], t_diffs[0], t_coins[0], this->m_txs[0]));