aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.h
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-03-23 16:20:08 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-04-11 11:07:58 +0000
commit064ab123401814b755c776d8e53f132f6a151657 (patch)
treec08e17486a0cd16e9ff46a2a2158d714aecceaa1 /src/cryptonote_core/blockchain.h
parentfunctional_tests: add bans tests (diff)
downloadmonero-064ab123401814b755c776d8e53f132f6a151657.tar.xz
functional_tests: add more blockchain related tests
Related to emission, reorgs, getting tx data back, output distribution and histogram
Diffstat (limited to 'src/cryptonote_core/blockchain.h')
-rw-r--r--src/cryptonote_core/blockchain.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h
index c1677ed37..3588bbd1b 100644
--- a/src/cryptonote_core/blockchain.h
+++ b/src/cryptonote_core/blockchain.h
@@ -336,6 +336,7 @@ namespace cryptonote
* @brief creates a new block to mine against
*
* @param b return-by-reference block to be filled in
+ * @param from_block optional block hash to start mining from (main chain tip if NULL)
* @param miner_address address new coins for the block will go to
* @param di return-by-reference tells the miner what the difficulty target is
* @param height return-by-reference tells the miner what height it's mining against
@@ -345,6 +346,7 @@ namespace cryptonote
* @return true if block template filled in successfully, else false
*/
bool create_block_template(block& b, const account_public_address& miner_address, difficulty_type& di, uint64_t& height, uint64_t& expected_reward, const blobdata& ex_nonce);
+ bool create_block_template(block& b, const crypto::hash *from_block, const account_public_address& miner_address, difficulty_type& di, uint64_t& height, uint64_t& expected_reward, const blobdata& ex_nonce);
/**
* @brief checks if a block is known about with a given hash
@@ -1180,7 +1182,7 @@ namespace cryptonote
*
* @return false if the reorganization fails, otherwise true
*/
- bool switch_to_alternative_blockchain(std::list<blocks_ext_by_hash::iterator>& alt_chain, bool discard_disconnected_chain);
+ bool switch_to_alternative_blockchain(std::list<blocks_ext_by_hash::const_iterator>& alt_chain, bool discard_disconnected_chain);
/**
* @brief removes the most recent block from the blockchain
@@ -1234,6 +1236,18 @@ namespace cryptonote
bool handle_alternative_block(const block& b, const crypto::hash& id, block_verification_context& bvc);
/**
+ * @brief builds a list of blocks connecting a block to the main chain
+ *
+ * @param prev_id the block hash of the tip of the alt chain
+ * @param alt_chain the chain to be added to
+ * @param timestamps returns the timestamps of previous blocks
+ * @param bvc the block verification context for error return
+ *
+ * @return true on success, false otherwise
+ */
+ bool build_alt_chain(const crypto::hash &prev_id, std::list<blocks_ext_by_hash::const_iterator>& alt_chain, std::vector<uint64_t> &timestamps, block_verification_context& bvc) const;
+
+ /**
* @brief gets the difficulty requirement for a new block on an alternate chain
*
* @param alt_chain the chain to be added to
@@ -1241,7 +1255,7 @@ namespace cryptonote
*
* @return the difficulty requirement
*/
- difficulty_type get_next_difficulty_for_alternative_chain(const std::list<blocks_ext_by_hash::iterator>& alt_chain, block_extended_info& bei) const;
+ difficulty_type get_next_difficulty_for_alternative_chain(const std::list<blocks_ext_by_hash::const_iterator>& alt_chain, block_extended_info& bei) const;
/**
* @brief sanity checks a miner transaction before validating an entire block
@@ -1401,7 +1415,7 @@ namespace cryptonote
*
* @return true unless start_height is greater than the current blockchain height
*/
- bool complete_timestamps_vector(uint64_t start_height, std::vector<uint64_t>& timestamps);
+ bool complete_timestamps_vector(uint64_t start_height, std::vector<uint64_t>& timestamps) const;
/**
* @brief calculate the block weight limit for the next block to be added