Merge pull request #7131
c1d6547
protocol: include first new block in chain entry response (moneromooo-monero)
This commit is contained in:
commit
54a4071473
|
@ -298,6 +298,7 @@ namespace cryptonote
|
||||||
uint64_t cumulative_difficulty_top64;
|
uint64_t cumulative_difficulty_top64;
|
||||||
std::vector<crypto::hash> m_block_ids;
|
std::vector<crypto::hash> m_block_ids;
|
||||||
std::vector<uint64_t> m_block_weights;
|
std::vector<uint64_t> m_block_weights;
|
||||||
|
cryptonote::blobdata first_block;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(start_height)
|
KV_SERIALIZE(start_height)
|
||||||
|
@ -309,6 +310,7 @@ namespace cryptonote
|
||||||
KV_SERIALIZE_OPT(cumulative_difficulty_top64, (uint64_t)0)
|
KV_SERIALIZE_OPT(cumulative_difficulty_top64, (uint64_t)0)
|
||||||
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(m_block_ids)
|
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(m_block_ids)
|
||||||
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(m_block_weights)
|
KV_SERIALIZE_CONTAINER_POD_AS_BLOB(m_block_weights)
|
||||||
|
KV_SERIALIZE(first_block)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
typedef epee::misc_utils::struct_init<request_t> request;
|
typedef epee::misc_utils::struct_init<request_t> request;
|
||||||
|
|
|
@ -1826,6 +1826,16 @@ skip:
|
||||||
LOG_ERROR_CCONTEXT("Failed to handle NOTIFY_REQUEST_CHAIN.");
|
LOG_ERROR_CCONTEXT("Failed to handle NOTIFY_REQUEST_CHAIN.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (r.m_block_ids.size() >= 2)
|
||||||
|
{
|
||||||
|
cryptonote::block b;
|
||||||
|
if (!m_core.get_block_by_hash(r.m_block_ids[1], b))
|
||||||
|
{
|
||||||
|
LOG_ERROR_CCONTEXT("Failed to handle NOTIFY_REQUEST_CHAIN: first block not found");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
r.first_block = cryptonote::block_to_blob(b);
|
||||||
|
}
|
||||||
MLOG_P2P_MESSAGE("-->>NOTIFY_RESPONSE_CHAIN_ENTRY: m_start_height=" << r.start_height << ", m_total_height=" << r.total_height << ", m_block_ids.size()=" << r.m_block_ids.size());
|
MLOG_P2P_MESSAGE("-->>NOTIFY_RESPONSE_CHAIN_ENTRY: m_start_height=" << r.start_height << ", m_total_height=" << r.total_height << ", m_block_ids.size()=" << r.m_block_ids.size());
|
||||||
post_notify<NOTIFY_RESPONSE_CHAIN_ENTRY>(r, context);
|
post_notify<NOTIFY_RESPONSE_CHAIN_ENTRY>(r, context);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue