aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_basic/connection_context.h
diff options
context:
space:
mode:
authortobtoht <tob@featherwallet.org>2025-02-13 17:35:32 +0000
committertobtoht <tob@featherwallet.org>2025-02-13 17:35:32 +0000
commit71c8a726e52513ca358c50a9400988d67a92f7e2 (patch)
tree29ab3bbc94fe9cd0b61d11a925a9acbbb594334e /src/cryptonote_basic/connection_context.h
parentbea29939125c8e85cc266b46ebd0b07b0eb04747 (diff)
parented70c162244b7b42119e2011bb5cf90061160629 (diff)
downloadmonzero-core-71c8a726e52513ca358c50a9400988d67a92f7e2.tar.gz
monzero-core-71c8a726e52513ca358c50a9400988d67a92f7e2.tar.xz
monzero-core-71c8a726e52513ca358c50a9400988d67a92f7e2.zip
Merge pull request #9759
ed70c1622 Some cleanup in span/connection_context + few more checks (Lee *!* Clagett)
Diffstat (limited to 'src/cryptonote_basic/connection_context.h')
-rw-r--r--src/cryptonote_basic/connection_context.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cryptonote_basic/connection_context.h b/src/cryptonote_basic/connection_context.h
index 818999a60..db24e28fa 100644
--- a/src/cryptonote_basic/connection_context.h
+++ b/src/cryptonote_basic/connection_context.h
@@ -34,6 +34,7 @@
#include <atomic>
#include <algorithm>
#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/optional/optional_fwd.hpp>
#include "net/net_utils_base.h"
#include "crypto/hash.h"
@@ -42,7 +43,7 @@ namespace cryptonote
struct cryptonote_connection_context: public epee::net_utils::connection_context_base
{
cryptonote_connection_context(): m_state(state_before_handshake), m_remote_blockchain_height(0), m_last_response_height(0),
- m_last_request_time(boost::date_time::not_a_date_time), m_callback_request_count(0),
+ m_expected_heights_start(0), m_last_request_time(boost::date_time::not_a_date_time), m_callback_request_count(0),
m_last_known_hash(crypto::null_hash), m_pruning_seed(0), m_rpc_port(0), m_rpc_credits_per_hash(0), m_anchor(false), m_score(0),
m_expect_response(0), m_expect_height(0), m_num_requested(0) {}
@@ -92,11 +93,18 @@ namespace cryptonote
//! \return Maximum number of bytes permissible for `command`.
static size_t get_max_bytes(int command) noexcept;
+ //! Use this instead of `m_state = state_normal`.
+ void set_state_normal();
+
+ boost::optional<crypto::hash> get_expected_hash(uint64_t height) const;
+
state m_state;
std::vector<std::pair<crypto::hash, uint64_t>> m_needed_objects;
+ std::vector<crypto::hash> m_expected_heights;
std::unordered_set<crypto::hash> m_requested_objects;
uint64_t m_remote_blockchain_height;
uint64_t m_last_response_height;
+ uint64_t m_expected_heights_start;
boost::posix_time::ptime m_last_request_time;
copyable_atomic m_callback_request_count; //in debug purpose: problem with double callback rise
crypto::hash m_last_known_hash;