mirror of
https://github.com/EvernodeXRPL/hpcore.git
synced 2026-04-29 15:37:59 +00:00
Updated hpfs binary and its relevant hpcore changes. (#282)
* Hpfs index file is updated to match the file with the hpfs version. * Added updated hpfs binary. * Version log changes because Plog is not initialized at the time of version init.
This commit is contained in:
committed by
GitHub
parent
5833431157
commit
137d7633e0
@@ -5,6 +5,7 @@
|
||||
#include "../util/h32.hpp"
|
||||
#include "../sc/sc.hpp"
|
||||
#include "../crypto.hpp"
|
||||
#include "../util/version.hpp"
|
||||
|
||||
namespace hpfs
|
||||
{
|
||||
@@ -523,7 +524,7 @@ namespace hpfs
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
seq_no = st.st_size / (sizeof(uint64_t) + sizeof(util::h32));
|
||||
seq_no = (st.st_size - version::HPFS_VERSION_BYTES_LEN) / (sizeof(uint64_t) + sizeof(util::h32));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -551,7 +552,7 @@ namespace hpfs
|
||||
return -1;
|
||||
}
|
||||
|
||||
const off_t offset = ((seq_no - 1) * (sizeof(uint64_t) + sizeof(util::h32))) + sizeof(uint64_t);
|
||||
const off_t offset = version::HPFS_VERSION_BYTES_LEN + ((seq_no - 1) * (sizeof(uint64_t) + sizeof(util::h32))) + sizeof(uint64_t);
|
||||
// If calculated offset is beyond our file size means,
|
||||
// Requested seq_no is invalid or we do not have that seq_no in our hpfs log file.
|
||||
if (offset >= st.st_size)
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace version
|
||||
|
||||
if (end == std::string::npos)
|
||||
{
|
||||
LOG_ERROR << "Invalid version " << version;
|
||||
std::cerr << "Invalid version " << version << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace version
|
||||
|
||||
if (end == std::string::npos)
|
||||
{
|
||||
LOG_ERROR << "Invalid version " << version;
|
||||
std::cerr << "Invalid version " << version << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ namespace version
|
||||
// 2 bytes each for 3 version components. 2 bytes reserved.
|
||||
constexpr const size_t VERSION_BYTES_LEN = 8;
|
||||
|
||||
// Hpfs version header length. This is currently same length as hpcore version header.
|
||||
// This value needs to be updated when hpfs version header length changes.
|
||||
constexpr const size_t HPFS_VERSION_BYTES_LEN = 8;
|
||||
|
||||
// Binary representations of the versions. (populated during version init)
|
||||
extern uint8_t HP_VERSION_BYTES[VERSION_BYTES_LEN];
|
||||
extern uint8_t LEDGER_VERSION_BYTES[VERSION_BYTES_LEN];
|
||||
|
||||
BIN
test/bin/hpfs
BIN
test/bin/hpfs
Binary file not shown.
Reference in New Issue
Block a user