Enable amendments in genesis ledger (RIPD-1281)

When started with "--start", put all known, non-vetoed
amendments in the genesis ledger. This avoids the need
to wait 256 ledgers before amendments are enabled when
testing with a fresh ledger.
This commit is contained in:
JoelKatz
2016-11-21 11:04:18 -08:00
committed by Nik Bougalis
parent dc3571184a
commit e00a6b0e5a
9 changed files with 87 additions and 10 deletions

View File

@@ -186,7 +186,11 @@ public:
//------------------------------------------------------------------------------
Ledger::Ledger (create_genesis_t, Config const& config, Family& family)
Ledger::Ledger (
create_genesis_t,
Config const& config,
std::vector<uint256> const& amendments,
Family& family)
: mImmutable (false)
, txMap_ (std::make_shared <SHAMap> (SHAMapType::TRANSACTION,
family, SHAMap::version{1}))
@@ -205,6 +209,14 @@ Ledger::Ledger (create_genesis_t, Config const& config, Family& family)
sle->setAccountID (sfAccount, id);
sle->setFieldAmount (sfBalance, info_.drops);
rawInsert(sle);
if (! amendments.empty())
{
auto const sle = std::make_shared<SLE>(keylet::amendments());
sle->setFieldV256 (sfAmendments, STVector256{amendments});
rawInsert(sle);
}
stateMap_->flushDirty (hotACCOUNT_NODE, info_.seq);
setImmutable(config);
}

View File

@@ -94,8 +94,14 @@ public:
of XRP in the system. No more XRP than the amount which
starts in this account can ever exist, with amounts
used to pay fees being destroyed.
Amendments specified are enabled in the genesis ledger
*/
Ledger (create_genesis_t, Config const& config, Family& family);
Ledger (
create_genesis_t,
Config const& config,
std::vector<uint256> const& amendments,
Family& family);
Ledger (
LedgerInfo const& info,