diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-08-17 21:35:02 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-08-17 21:35:02 +0200 |
commit | 4b2cc123ff48fdd2c62dbffc24c604c45c6fbf1d (patch) | |
tree | bfe654f3fb0b4b5ae5ffdb96919080c716449069 /src/cryptonote_protocol | |
parent | Merge pull request #2297 (diff) | |
parent | protocol: pass blockchain cumulative difficulty when syncing (diff) | |
download | monero-4b2cc123ff48fdd2c62dbffc24c604c45c6fbf1d.tar.xz |
Merge pull request #2287
827afcb7 protocol: pass blockchain cumulative difficulty when syncing (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_protocol')
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_defs.h | 4 | ||||
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_handler.inl | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_defs.h b/src/cryptonote_protocol/cryptonote_protocol_defs.h index 6e6c83f04..71e205c23 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_defs.h +++ b/src/cryptonote_protocol/cryptonote_protocol_defs.h @@ -197,11 +197,13 @@ namespace cryptonote struct CORE_SYNC_DATA { uint64_t current_height; + uint64_t cumulative_difficulty; crypto::hash top_id; uint8_t top_version; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(current_height) + KV_SERIALIZE(cumulative_difficulty) KV_SERIALIZE_VAL_POD_AS_BLOB(top_id) KV_SERIALIZE_OPT(top_version, (uint8_t)0) END_KV_SERIALIZE_MAP() @@ -229,11 +231,13 @@ namespace cryptonote { uint64_t start_height; uint64_t total_height; + uint64_t cumulative_difficulty; std::list<crypto::hash> m_block_ids; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(start_height) KV_SERIALIZE(total_height) + KV_SERIALIZE(cumulative_difficulty) KV_SERIALIZE_CONTAINER_POD_AS_BLOB(m_block_ids) END_KV_SERIALIZE_MAP() }; diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index 5b3b059a4..265e60b3f 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -309,6 +309,7 @@ namespace cryptonote { m_core.get_blockchain_top(hshd.current_height, hshd.top_id); hshd.top_version = m_core.get_hard_fork_version(hshd.current_height); + hshd.cumulative_difficulty = m_core.get_block_cumulative_difficulty(hshd.current_height); hshd.current_height +=1; return true; } |