mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Request missing history when behind the ledger cap. (#165)
This commit is contained in:
@@ -63,7 +63,6 @@ table Npl_Message { //NPL type message schema
|
||||
}
|
||||
|
||||
table History_Request_Message { //Ledger History request type message schema
|
||||
minimum_lcl:[ubyte];
|
||||
required_lcl:[ubyte];
|
||||
}
|
||||
|
||||
|
||||
@@ -999,15 +999,8 @@ inline flatbuffers::Offset<Npl_Message> CreateNpl_MessageDirect(
|
||||
struct History_Request_Message FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
||||
typedef History_Request_MessageBuilder Builder;
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_MINIMUM_LCL = 4,
|
||||
VT_REQUIRED_LCL = 6
|
||||
VT_REQUIRED_LCL = 4
|
||||
};
|
||||
const flatbuffers::Vector<uint8_t> *minimum_lcl() const {
|
||||
return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_MINIMUM_LCL);
|
||||
}
|
||||
flatbuffers::Vector<uint8_t> *mutable_minimum_lcl() {
|
||||
return GetPointer<flatbuffers::Vector<uint8_t> *>(VT_MINIMUM_LCL);
|
||||
}
|
||||
const flatbuffers::Vector<uint8_t> *required_lcl() const {
|
||||
return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_REQUIRED_LCL);
|
||||
}
|
||||
@@ -1016,8 +1009,6 @@ struct History_Request_Message FLATBUFFERS_FINAL_CLASS : private flatbuffers::Ta
|
||||
}
|
||||
bool Verify(flatbuffers::Verifier &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_MINIMUM_LCL) &&
|
||||
verifier.VerifyVector(minimum_lcl()) &&
|
||||
VerifyOffset(verifier, VT_REQUIRED_LCL) &&
|
||||
verifier.VerifyVector(required_lcl()) &&
|
||||
verifier.EndTable();
|
||||
@@ -1028,9 +1019,6 @@ struct History_Request_MessageBuilder {
|
||||
typedef History_Request_Message Table;
|
||||
flatbuffers::FlatBufferBuilder &fbb_;
|
||||
flatbuffers::uoffset_t start_;
|
||||
void add_minimum_lcl(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> minimum_lcl) {
|
||||
fbb_.AddOffset(History_Request_Message::VT_MINIMUM_LCL, minimum_lcl);
|
||||
}
|
||||
void add_required_lcl(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> required_lcl) {
|
||||
fbb_.AddOffset(History_Request_Message::VT_REQUIRED_LCL, required_lcl);
|
||||
}
|
||||
@@ -1048,23 +1036,18 @@ struct History_Request_MessageBuilder {
|
||||
|
||||
inline flatbuffers::Offset<History_Request_Message> CreateHistory_Request_Message(
|
||||
flatbuffers::FlatBufferBuilder &_fbb,
|
||||
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> minimum_lcl = 0,
|
||||
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> required_lcl = 0) {
|
||||
History_Request_MessageBuilder builder_(_fbb);
|
||||
builder_.add_required_lcl(required_lcl);
|
||||
builder_.add_minimum_lcl(minimum_lcl);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
inline flatbuffers::Offset<History_Request_Message> CreateHistory_Request_MessageDirect(
|
||||
flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const std::vector<uint8_t> *minimum_lcl = nullptr,
|
||||
const std::vector<uint8_t> *required_lcl = nullptr) {
|
||||
auto minimum_lcl__ = minimum_lcl ? _fbb.CreateVector<uint8_t>(*minimum_lcl) : 0;
|
||||
auto required_lcl__ = required_lcl ? _fbb.CreateVector<uint8_t>(*required_lcl) : 0;
|
||||
return msg::fbuf::p2pmsg::CreateHistory_Request_Message(
|
||||
_fbb,
|
||||
minimum_lcl__,
|
||||
required_lcl__);
|
||||
}
|
||||
|
||||
|
||||
@@ -246,12 +246,12 @@ namespace msg::fbuf::p2pmsg
|
||||
* @param msg Flatbuffer History request message received from the peer.
|
||||
* @return A History request struct representing the message.
|
||||
*/
|
||||
const p2p::history_request create_history_request_from_msg(const History_Request_Message &msg)
|
||||
const p2p::history_request create_history_request_from_msg(const History_Request_Message &msg, const flatbuffers::Vector<uint8_t> *lcl)
|
||||
{
|
||||
p2p::history_request hr;
|
||||
|
||||
if (msg.minimum_lcl())
|
||||
hr.minimum_lcl = flatbuff_bytes_to_sv(msg.minimum_lcl());
|
||||
if (lcl)
|
||||
hr.requester_lcl = flatbuff_bytes_to_sv(lcl);
|
||||
|
||||
if (msg.required_lcl())
|
||||
hr.required_lcl = flatbuff_bytes_to_sv(msg.required_lcl());
|
||||
@@ -418,7 +418,6 @@ namespace msg::fbuf::p2pmsg
|
||||
flatbuffers::Offset<History_Request_Message> hrmsg =
|
||||
CreateHistory_Request_Message(
|
||||
builder,
|
||||
sv_to_flatbuff_bytes(builder, hr.minimum_lcl),
|
||||
sv_to_flatbuff_bytes(builder, hr.required_lcl));
|
||||
|
||||
flatbuffers::Offset<Content> message = CreateContent(builder, Message_History_Request_Message, hrmsg.Union());
|
||||
@@ -426,7 +425,7 @@ namespace msg::fbuf::p2pmsg
|
||||
|
||||
// Now that we have built the content message,
|
||||
// we need to sign it and place it inside a container message.
|
||||
create_containermsg_from_content(container_builder, builder, {}, false);
|
||||
create_containermsg_from_content(container_builder, builder, hr.requester_lcl, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace msg::fbuf::p2pmsg
|
||||
|
||||
const p2p::proposal create_proposal_from_msg(const Proposal_Message &msg, const flatbuffers::Vector<uint8_t> *pubkey, const uint64_t timestamp, const flatbuffers::Vector<uint8_t> *lcl);
|
||||
|
||||
const p2p::history_request create_history_request_from_msg(const History_Request_Message &msg);
|
||||
const p2p::history_request create_history_request_from_msg(const History_Request_Message &msg, const flatbuffers::Vector<uint8_t> *lcl);
|
||||
|
||||
const p2p::history_response create_history_response_from_msg(const History_Response_Message &msg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user