mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Separated lcl string usage to sequence no and hash. (#251)
This commit is contained in:
@@ -173,8 +173,8 @@ namespace usr
|
||||
|
||||
std::string input_data;
|
||||
std::string nonce;
|
||||
uint64_t max_lcl_seqno;
|
||||
if (parser.extract_input_container(input_data, nonce, max_lcl_seqno, input_container) != -1)
|
||||
uint64_t max_lcl_seq_no;
|
||||
if (parser.extract_input_container(input_data, nonce, max_lcl_seq_no, input_container) != -1)
|
||||
{
|
||||
// Check for max nonce size.
|
||||
if (nonce.size() > MAX_INPUT_NONCE_SIZE)
|
||||
@@ -191,7 +191,7 @@ namespace usr
|
||||
return -1;
|
||||
}
|
||||
|
||||
const int nonce_status = nonce_map.check(user.pubkey, nonce, sig, max_lcl_seqno, true);
|
||||
const int nonce_status = nonce_map.check(user.pubkey, nonce, sig, max_lcl_seq_no, true);
|
||||
if (nonce_status == 0)
|
||||
{
|
||||
//Add to the submitted input list.
|
||||
@@ -228,7 +228,7 @@ namespace usr
|
||||
{
|
||||
std::vector<uint8_t> msg;
|
||||
const p2p::sequence_hash lcl_id = ledger::ctx.get_lcl_id();
|
||||
parser.create_status_response(msg, lcl_id.seq_no, ledger::get_lcl_string(lcl_id));
|
||||
parser.create_status_response(msg, lcl_id.seq_no, lcl_id.hash.to_string_view());
|
||||
user.session.send(msg);
|
||||
return 0;
|
||||
}
|
||||
@@ -365,7 +365,7 @@ namespace usr
|
||||
|
||||
// Extract information from input container.
|
||||
msg::usrmsg::usrmsg_parser parser(submitted.protocol);
|
||||
if (parser.extract_input_container(extracted.input, extracted.nonce, extracted.max_lcl_seqno, submitted.input_container) == -1)
|
||||
if (parser.extract_input_container(extracted.input, extracted.nonce, extracted.max_lcl_seq_no, submitted.input_container) == -1)
|
||||
{
|
||||
LOG_DEBUG << "User input bad input container format.";
|
||||
return msg::usrmsg::REASON_BAD_MSG_FORMAT;
|
||||
@@ -385,7 +385,7 @@ namespace usr
|
||||
const uint64_t lcl_seq_no, size_t &total_input_size, std::string &hash, util::buffer_view &input)
|
||||
{
|
||||
// Ignore the input if our ledger has passed the input TTL.
|
||||
if (extracted_input.max_lcl_seqno <= lcl_seq_no)
|
||||
if (extracted_input.max_lcl_seq_no <= lcl_seq_no)
|
||||
{
|
||||
LOG_DEBUG << "User input bad max ledger seq expired.";
|
||||
return msg::usrmsg::REASON_MAX_LEDGER_EXPIRED;
|
||||
@@ -400,7 +400,7 @@ namespace usr
|
||||
return msg::usrmsg::REASON_ROUND_INPUTS_OVERFLOW;
|
||||
}
|
||||
|
||||
const int nonce_status = nonce_map.check(user_pubkey, extracted_input.nonce, extracted_input.sig, extracted_input.max_lcl_seqno);
|
||||
const int nonce_status = nonce_map.check(user_pubkey, extracted_input.nonce, extracted_input.sig, extracted_input.max_lcl_seq_no);
|
||||
if (nonce_status > 0)
|
||||
{
|
||||
LOG_DEBUG << (nonce_status == 1 ? "User input nonce expired." : "User input with same nonce/sig already submitted.");
|
||||
|
||||
Reference in New Issue
Block a user