Add NetworkID field to Transaction common fields, enforced when network id > 1024

This commit is contained in:
Richard Holland
2022-12-19 13:43:32 +00:00
parent 05f961c77c
commit 39ecdb6795
14 changed files with 268 additions and 0 deletions

View File

@@ -138,6 +138,7 @@ public:
std::string START_LEDGER;
// Network parameters
uint32_t NETWORK_ID = 0;
// The number of fee units a reference transaction costs
static constexpr FeeUnit32 TRANSACTION_FEE_BASE{10};

View File

@@ -102,6 +102,7 @@ struct ConfigSection
#define SECTION_BETA_RPC_API "beta_rpc_api"
#define SECTION_SWEEP_INTERVAL "sweep_interval"
#define SECTION_XPOP_HISTORY "xpop_history"
#define SECTION_NETWORK_ID "network_id"
} // namespace ripple

View File

@@ -483,6 +483,18 @@ Config::loadFromString(std::string const& fileContents)
if (getSingleSection(secConfig, SECTION_XPOP_HISTORY, strTemp, j_))
XPOP_HISTORY = beast::lexicalCastThrow<bool>(strTemp);
if (getSingleSection(secConfig, SECTION_NETWORK_ID, strTemp, j_))
{
if (strTemp == "main")
NETWORK_ID = 0;
else if (strTemp == "testnet")
NETWORK_ID = 1;
else if (strTemp == "devnet")
NETWORK_ID = 2;
else
NETWORK_ID = beast::lexicalCastThrow<uint32_t>(strTemp);
}
if (getSingleSection(secConfig, SECTION_PEER_PRIVATE, strTemp, j_))
PEER_PRIVATE = beast::lexicalCastThrow<bool>(strTemp);