aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlexander Blair <snipa@jagtech.io>2021-01-01 22:43:45 -0800
committerAlexander Blair <snipa@jagtech.io>2021-01-01 22:43:46 -0800
commita4ffad75ac43af94a28604c2dab955791879fd1f (patch)
tree0fb299932cad4630adbce99164033b19d9aac6fe /tests
parentMerge pull request #7244 (diff)
parentprotocol: more sanity checks in new chain block hashes (diff)
downloadmonero-a4ffad75ac43af94a28604c2dab955791879fd1f.tar.xz
Merge pull request #7247
57f7c2e53 protocol: more sanity checks in new chain block hashes (moneromooo-monero)
Diffstat (limited to 'tests')
-rw-r--r--tests/core_proxy/core_proxy.cpp7
-rw-r--r--tests/core_proxy/core_proxy.h3
-rw-r--r--tests/unit_tests/node_server.cpp3
3 files changed, 10 insertions, 3 deletions
diff --git a/tests/core_proxy/core_proxy.cpp b/tests/core_proxy/core_proxy.cpp
index 8095f03e3..09be8758b 100644
--- a/tests/core_proxy/core_proxy.cpp
+++ b/tests/core_proxy/core_proxy.cpp
@@ -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);
diff --git a/tests/core_proxy/core_proxy.h b/tests/core_proxy/core_proxy.h
index ebc3a89c2..94f148e8c 100644
--- a/tests/core_proxy/core_proxy.h
+++ b/tests/core_proxy/core_proxy.h
@@ -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);
diff --git a/tests/unit_tests/node_server.cpp b/tests/unit_tests/node_server.cpp
index 0569d3748..4d6f09e69 100644
--- a/tests/unit_tests/node_server.cpp
+++ b/tests/unit_tests/node_server.cpp
@@ -55,7 +55,8 @@ public:
bool init(const boost::program_options::variables_map& vm) {return true ;}
bool deinit(){return true;}
bool get_short_chain_history(std::list<crypto::hash>& ids) const { return true; }
- bool have_block(const crypto::hash& id) const {return true;}
+ bool have_block(const crypto::hash& id, int *where = NULL) const {return false;}
+ bool have_block_unlocked(const crypto::hash& id, int *where = NULL) const {return false;}
void get_blockchain_top(uint64_t& height, crypto::hash& top_id)const{height=0;top_id=crypto::null_hash;}
bool handle_incoming_tx(const cryptonote::tx_blob_entry& tx_blob, cryptonote::tx_verification_context& tvc, cryptonote::relay_method tx_relay, bool relayed) { return true; }
bool handle_incoming_txs(const std::vector<cryptonote::tx_blob_entry>& tx_blob, std::vector<cryptonote::tx_verification_context>& tvc, cryptonote::relay_method tx_relay, bool relayed) { return true; }