mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Save raw inputs alongside the ledger (#167)
* Saving raw inputs in the ledger. * Store full history in separate folder. * Moved full history fb structs to a seperate fbs file * Removed raw_inputs from the proposal * Fixed code comments * Saving raw user input string * Code refactoring * Resolved PR comments
This commit is contained in:
@@ -728,7 +728,31 @@ namespace consensus
|
||||
*/
|
||||
int update_ledger_and_execute_contract(const p2p::proposal &cons_prop, std::string &new_lcl, hpfs::h32 &new_state)
|
||||
{
|
||||
if (ledger::save_ledger(cons_prop) == -1)
|
||||
// Map to temporarily store the raw inputs along with the hash.
|
||||
std::unordered_map<std::string, usr::raw_user_input> raw_inputs;
|
||||
|
||||
// Add raw_inputs to the proposal if full history mode is on.
|
||||
if (conf::cfg.fullhistory)
|
||||
{
|
||||
for (const auto &hash : cons_prop.hash_inputs)
|
||||
{
|
||||
const auto itr = ctx.candidate_user_inputs.find(hash);
|
||||
if (itr != ctx.candidate_user_inputs.end())
|
||||
{
|
||||
// Add raw_input to the map along with the input hash.
|
||||
candidate_user_input &cand_input = itr->second;
|
||||
// Taking the raw input string from the buffer_view.
|
||||
std::string input;
|
||||
if (usr::input_store.read_buf(cand_input.input, input) != -1)
|
||||
{
|
||||
usr::raw_user_input raw_input(cand_input.userpubkey, std::move(input));
|
||||
raw_inputs.emplace(hash, std::move(raw_input));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ledger::save_ledger(cons_prop, std::move(raw_inputs)) == -1)
|
||||
return -1;
|
||||
|
||||
new_lcl = ledger::ctx.get_lcl();
|
||||
|
||||
Reference in New Issue
Block a user