mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-04 18:55:49 +00:00
rework logic for bootstrap ips, parsing correctly inline comments
This commit is contained in:
@@ -509,7 +509,8 @@ Change::activateXahauGenesis()
|
||||
|
||||
hookDef->setFieldH256(sfHookHash, hookHash);
|
||||
hookDef->setFieldH256(sfHookOn, hookOn);
|
||||
hookDef->setFieldH256(sfHookNamespace, UINT256_BIT[hookCount++]);
|
||||
hookDef->setFieldH256(sfHookNamespace,
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000000"));
|
||||
|
||||
// parameters
|
||||
{
|
||||
|
||||
@@ -470,6 +470,7 @@ OverlayImpl::remove(std::shared_ptr<PeerFinder::Slot> const& slot)
|
||||
void
|
||||
OverlayImpl::start()
|
||||
{
|
||||
|
||||
PeerFinder::Config config = PeerFinder::Config::makeConfig(
|
||||
app_.config(),
|
||||
serverHandler_.setup().overlay.port,
|
||||
@@ -479,58 +480,50 @@ OverlayImpl::start()
|
||||
m_peerFinder->setConfig(config);
|
||||
m_peerFinder->start();
|
||||
|
||||
// Populate our boot cache: if there are no entries in [ips] then we use
|
||||
// the entries in [ips_fixed].
|
||||
auto bootstrapIps =
|
||||
app_.config().IPS.empty() ? app_.config().IPS_FIXED : app_.config().IPS;
|
||||
|
||||
if (bootstrapIps.empty())
|
||||
// bootstrapIps.push_back("0.0.0.0 21337");
|
||||
bootstrapIps.push_back("bacab.alloy.ee 21337");
|
||||
|
||||
m_resolver.resolve(
|
||||
bootstrapIps,
|
||||
[this](
|
||||
std::string const& name,
|
||||
std::vector<beast::IP::Endpoint> const& addresses) {
|
||||
std::vector<std::string> ips;
|
||||
ips.reserve(addresses.size());
|
||||
for (auto const& addr : addresses)
|
||||
{
|
||||
if (addr.port() == 0)
|
||||
ips.push_back(to_string(addr.at_port(DEFAULT_PEER_PORT)));
|
||||
else
|
||||
ips.push_back(to_string(addr));
|
||||
}
|
||||
|
||||
std::string const base("config: ");
|
||||
if (!ips.empty())
|
||||
m_peerFinder->addFallbackStrings(base + name, ips);
|
||||
});
|
||||
|
||||
// Add the ips_fixed from the rippled.cfg file
|
||||
if (!app_.config().standalone() && !app_.config().IPS_FIXED.empty())
|
||||
auto addIps = [&](std::vector<std::string> bootstrapIps) -> void
|
||||
{
|
||||
|
||||
beast::Journal const& j = app_.journal("Overlay");
|
||||
for (auto& ip : bootstrapIps)
|
||||
{
|
||||
std::size_t pos = ip.find('#');
|
||||
if (pos != std::string::npos)
|
||||
ip.erase(pos);
|
||||
|
||||
JLOG(j.trace()) << "Found boostrap IP: " << ip;
|
||||
}
|
||||
|
||||
m_resolver.resolve(
|
||||
app_.config().IPS_FIXED,
|
||||
[this](
|
||||
bootstrapIps,
|
||||
[&](
|
||||
std::string const& name,
|
||||
std::vector<beast::IP::Endpoint> const& addresses) {
|
||||
std::vector<beast::IP::Endpoint> ips;
|
||||
std::vector<std::string> ips;
|
||||
ips.reserve(addresses.size());
|
||||
|
||||
for (auto& addr : addresses)
|
||||
beast::Journal const& j = app_.journal("Overlay");
|
||||
for (auto const& addr : addresses)
|
||||
{
|
||||
if (addr.port() == 0)
|
||||
ips.emplace_back(addr.address(), DEFAULT_PEER_PORT);
|
||||
else
|
||||
ips.emplace_back(addr);
|
||||
std::string addrStr =
|
||||
addr.port() == 0
|
||||
? to_string(addr.at_port(DEFAULT_PEER_PORT))
|
||||
: to_string(addr);
|
||||
JLOG(j.trace()) << "Parsed boostrap IP: " << addrStr;
|
||||
ips.push_back(addrStr);
|
||||
}
|
||||
|
||||
std::string const base("config: ");
|
||||
if (!ips.empty())
|
||||
m_peerFinder->addFixedPeer(name, ips);
|
||||
m_peerFinder->addFallbackStrings(base + name, ips);
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (!app_.config().IPS.empty())
|
||||
addIps(app_.config().IPS);
|
||||
|
||||
if (!app_.config().IPS_FIXED.empty())
|
||||
addIps(app_.config().IPS_FIXED);
|
||||
|
||||
auto const timer = std::make_shared<Timer>(*this);
|
||||
std::lock_guard lock(mutex_);
|
||||
list_.emplace(timer.get(), timer);
|
||||
|
||||
@@ -125,7 +125,7 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
||||
ripple::uint256("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFFFFFFFFBFFFFF"));
|
||||
std::cout << "06\n";
|
||||
BEAST_EXPECT(govSLE->getFieldH256(sfHookNamespace) ==
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000001"));
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000000"));
|
||||
std::cout << "07\n";
|
||||
BEAST_EXPECT(govSLE->getFieldU16(sfHookApiVersion) == 0);
|
||||
auto const govFee = govSLE->getFieldAmount(sfFee);
|
||||
@@ -154,9 +154,9 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
||||
std::cout << "15\n";
|
||||
BEAST_EXPECT(rwdSLE->getFieldH256(sfHookOn) ==
|
||||
ripple::uint256("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFBFFFFFFFFFFFFFFFFFFBFFFFF"));
|
||||
std::cout << "16\n";
|
||||
std::cout << "16 :: " << rwdSLE->getFieldH256(sfHookNamespace) << "\n";
|
||||
BEAST_EXPECT(rwdSLE->getFieldH256(sfHookNamespace) ==
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000010"));
|
||||
ripple::uint256("0000000000000000000000000000000000000000000000000000000000000000"));
|
||||
std::cout << "17\n";
|
||||
BEAST_EXPECT(rwdSLE->getFieldU16(sfHookApiVersion) == 0);
|
||||
auto const rwdFee = rwdSLE->getFieldAmount(sfFee);
|
||||
@@ -171,9 +171,52 @@ struct XahauGenesis_test : public beast::unit_test::suite
|
||||
|
||||
// RH TODO:
|
||||
// check hookparameters
|
||||
// check wasm hash
|
||||
// check gensis hooks array
|
||||
// check start ledger
|
||||
|
||||
// governance hook tests:
|
||||
// last member tries to remove themselves
|
||||
// try to add more than 20 members
|
||||
// add a member normally
|
||||
// remove a member normally
|
||||
// add a member normally then re-action by adding another vote
|
||||
// add a member normally then ensure it's not undone by removing one of the votes
|
||||
// remove a member normally then re-action by adding another vote
|
||||
// remove a member normally then ensure it's not undone when removing one of the votes
|
||||
// action a hook change
|
||||
// action a hook change to a non-existent hook
|
||||
// action a reward rate change
|
||||
// action a reward delay change
|
||||
// L2 versions of all of the above
|
||||
|
||||
// reward hook tests:
|
||||
// test claim reward before time
|
||||
// test claim reward after time
|
||||
// test claim reward when UNL report empty
|
||||
// test claim reward when UNL report full
|
||||
|
||||
// genesis mint tests:
|
||||
// test send from non-genesis account emitted txn
|
||||
// test send from non-genesis account non-emitted txn
|
||||
// test send from genesis account emitted txn
|
||||
// test send from genesis account non-emitted txn
|
||||
// test send to account that doesn't exist
|
||||
// test send an overflow amount
|
||||
// test set governance flags
|
||||
// test no-destinations specified
|
||||
|
||||
// unl report test:
|
||||
// test several validators all get on the list
|
||||
// test several validators all vote different vl import keys
|
||||
// test badly behaved validators dont get on the list
|
||||
// test no validators on list
|
||||
// test whole unl on list
|
||||
|
||||
// account counter
|
||||
// test import created accounts get a sequence
|
||||
// test payment created accounts get a sequence
|
||||
// test genesis mint created accounts get a sequence
|
||||
// test rpc
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user