mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
* Increased stage time window. * Introduced central state tracker. * Used shared mutex for target state update. * Refactored lcl and state sync checks in consensus. * lcl/state sync loop wait time improvements.
28 lines
709 B
C++
28 lines
709 B
C++
#include "state_common.hpp"
|
|
#include "../hpfs/hpfs.hpp"
|
|
#include "../hplog.hpp"
|
|
|
|
namespace state_common
|
|
{
|
|
state_context ctx;
|
|
|
|
/**
|
|
* Get the contract state hash.
|
|
*/
|
|
int init()
|
|
{
|
|
hpfs::h32 initial_state;
|
|
if (hpfs::start_fs_session(conf::ctx.state_rw_dir) == -1 ||
|
|
hpfs::get_hash(initial_state, conf::ctx.state_rw_dir, "/") == -1 ||
|
|
hpfs::stop_fs_session(conf::ctx.state_rw_dir) == -1)
|
|
{
|
|
LOG_ERROR << "Failed to get initial state hash.";
|
|
return -1;
|
|
}
|
|
|
|
ctx.set_state(initial_state);
|
|
LOG_INFO << "Initial state: " << initial_state;
|
|
|
|
return 0;
|
|
}
|
|
} // namespace state_common
|