From 3800875406fecab5123564e58ddb698bce550441 Mon Sep 17 00:00:00 2001 From: warptangent Date: Mon, 8 Feb 2016 07:51:57 -0800 Subject: Make HardFork object available to BlockchainDB and derived DB implementations This will later allow the HardFork object's DB update functions to be called when the DB transaction that persists across block add/remove is open. --- src/cryptonote_core/blockchain.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/cryptonote_core') diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index e43875bdc..94ef4b894 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -290,6 +290,8 @@ bool Blockchain::init(BlockchainDB* db, const bool testnet, const bool fakechain } m_hardfork->init(); + m_db->set_hard_fork(m_hardfork); + // if the blockchain is new, add the genesis block // this feels kinda kludgy to do it this way, but can be looked at later. // TODO: add function to create and store genesis block, -- cgit v1.2.3 From e02577f594ecd0a619ef3efaf65de90df9c20289 Mon Sep 17 00:00:00 2001 From: warptangent Date: Mon, 8 Feb 2016 08:09:07 -0800 Subject: Move HardFork DB update to BlockchainDB::add_block() Ensures the database is consistent. Also simplifes blockchain_import in that verify mode off has less to work around. --- src/cryptonote_core/blockchain.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/cryptonote_core') diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 94ef4b894..6fe998260 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2692,9 +2692,6 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash& TIME_MEASURE_FINISH(addblock); - // this will not fail since check succeeded above - m_hardfork->add(bl, new_height - 1); - // do this after updating the hard fork state since the size limit may change due to fork update_next_cumulative_size_limit(); -- cgit v1.2.3 From e298b14a55c7f5792481a488104e6358127b6aa3 Mon Sep 17 00:00:00 2001 From: warptangent Date: Mon, 8 Feb 2016 08:19:24 -0800 Subject: Blockchain: Update comments on removing block --- src/cryptonote_core/blockchain.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/cryptonote_core') diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 6fe998260..f9247ae27 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -461,6 +461,11 @@ block Blockchain::pop_block_from_blockchain() { cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc); + // FIXME: HardFork + // Besides the below, popping a block should also remove the last entry + // in hf_versions. + // + // FIXME: HardFork // This is not quite correct, as we really want to add the txes // to the pool based on the version determined after all blocks // are popped. -- cgit v1.2.3