protocol: more sanity checks in new chain block hashes

This commit is contained in:
moneromooo-monero 2020-12-31 21:12:30 +00:00
parent 36dfd41e01
commit 57f7c2e53f
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
8 changed files with 90 additions and 21 deletions

View file

@ -245,12 +245,17 @@ bool tests::proxy_core::init(const boost::program_options::variables_map& /*vm*/
return true;
}
bool tests::proxy_core::have_block(const crypto::hash& id) {
bool tests::proxy_core::have_block_unlocked(const crypto::hash& id, int *where) {
if (m_hash2blkidx.end() == m_hash2blkidx.find(id))
return false;
if (where) *where = HAVE_BLOCK_MAIN_CHAIN;
return true;
}
bool tests::proxy_core::have_block(const crypto::hash& id, int *where) {
return have_block_unlocked(id, where);
}
void tests::proxy_core::build_short_history(std::list<crypto::hash> &m_history, const crypto::hash &m_start) {
m_history.push_front(get_block_hash(m_genesis));
/*std::unordered_map<crypto::hash, tests::block_index>::const_iterator cit = m_hash2blkidx.find(m_lastblk);

View file

@ -74,7 +74,8 @@ namespace tests
bool init(const boost::program_options::variables_map& vm);
bool deinit(){return true;}
bool get_short_chain_history(std::list<crypto::hash>& ids);
bool have_block(const crypto::hash& id);
bool have_block(const crypto::hash& id, int *where = NULL);
bool have_block_unlocked(const crypto::hash& id, int *where = NULL);
void get_blockchain_top(uint64_t& height, crypto::hash& top_id);
bool handle_incoming_tx(const cryptonote::tx_blob_entry& tx_blob, cryptonote::tx_verification_context& tvc, cryptonote::relay_method tx_relay, bool relayed);
bool handle_incoming_txs(const std::vector<cryptonote::tx_blob_entry>& tx_blobs, std::vector<cryptonote::tx_verification_context>& tvc, cryptonote::relay_method tx_relay, bool relayed);