mirror of
https://github.com/Xahau/xahaud.git
synced 2026-03-16 01:22:27 +00:00
Compare commits
5 Commits
cli-defini
...
fail-fast-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cf2be8e24 | ||
|
|
277e9f26bc | ||
|
|
ffcc58c8aa | ||
|
|
9246677e9c | ||
|
|
1f8418a58b |
12
.github/workflows/xahau-ga-nix.yml
vendored
12
.github/workflows/xahau-ga-nix.yml
vendored
@@ -375,15 +375,3 @@ jobs:
|
||||
echo "Error: rippled executable not found in ${{ env.build_dir }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Export server definitions
|
||||
run: |
|
||||
${{ env.build_dir }}/rippled --definitions | python3 -m json.tool > server_definitions.json
|
||||
|
||||
- name: Upload server definitions
|
||||
if: matrix.compiler_id == 'gcc-13-libstdcxx'
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: server-definitions
|
||||
path: server_definitions.json
|
||||
archive: false
|
||||
|
||||
@@ -310,12 +310,28 @@ LedgerMaster::setValidLedger(std::shared_ptr<Ledger const> const& l)
|
||||
if (auto const first =
|
||||
app_.getAmendmentTable().firstUnsupportedExpected())
|
||||
{
|
||||
JLOG(m_journal.error()) << "One or more unsupported amendments "
|
||||
"reached majority. Upgrade before "
|
||||
<< to_string(*first)
|
||||
<< " to prevent your server from "
|
||||
"becoming amendment blocked.";
|
||||
app_.getOPs().setAmendmentWarned();
|
||||
using namespace std::chrono_literals;
|
||||
auto const now = app_.timeKeeper().closeTime();
|
||||
if (*first > now && (*first - now) <= 1min)
|
||||
{
|
||||
// Shut down just before the amendment activates to
|
||||
// avoid processing ledgers with unknown fields.
|
||||
JLOG(m_journal.error())
|
||||
<< "Unsupported amendment activating imminently "
|
||||
"at "
|
||||
<< to_string(*first) << ". Shutting down.";
|
||||
app_.getOPs().setAmendmentBlocked();
|
||||
}
|
||||
else
|
||||
{
|
||||
JLOG(m_journal.error())
|
||||
<< "One or more unsupported amendments "
|
||||
"reached majority. Upgrade before "
|
||||
<< to_string(*first)
|
||||
<< " to prevent your server from "
|
||||
"becoming amendment blocked.";
|
||||
app_.getOPs().setAmendmentWarned();
|
||||
}
|
||||
}
|
||||
else
|
||||
app_.getOPs().clearAmendmentWarned();
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <xrpld/core/TimeKeeper.h>
|
||||
#include <xrpld/net/RPCCall.h>
|
||||
#include <xrpld/rpc/RPCHandler.h>
|
||||
#include <xrpld/rpc/handlers/Handlers.h>
|
||||
#include <xrpl/basics/Log.h>
|
||||
#include <xrpl/basics/StringUtilities.h>
|
||||
#include <xrpl/basics/contract.h>
|
||||
@@ -388,8 +387,7 @@ run(int argc, char** argv)
|
||||
po::value<std::string>(),
|
||||
"Specify the range of present ledgers for testing purposes. Min and "
|
||||
"max values are comma separated.")(
|
||||
"version", "Display the build version.")(
|
||||
"definitions", "Output server definitions as JSON and exit.");
|
||||
"version", "Display the build version.");
|
||||
|
||||
po::options_description data("Ledger/Data Options");
|
||||
data.add_options()("import", importText.c_str())(
|
||||
@@ -531,13 +529,6 @@ run(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (vm.count("definitions"))
|
||||
{
|
||||
auto defs = getStaticServerDefinitions();
|
||||
std::cout << Json::FastWriter().write(defs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef ENABLE_TESTS
|
||||
if (vm.count("unittest") || vm.count("unittest-child"))
|
||||
{
|
||||
|
||||
@@ -1634,6 +1634,16 @@ NetworkOPsImp::setAmendmentBlocked()
|
||||
{
|
||||
amendmentBlocked_ = true;
|
||||
setMode(OperatingMode::CONNECTED);
|
||||
if (!app_.config().standalone())
|
||||
{
|
||||
JLOG(m_journal.fatal())
|
||||
<< "One or more unsupported amendments activated. "
|
||||
"Shutting down. Upgrade the server to remain "
|
||||
"compatible with the network.";
|
||||
app_.signalStop(
|
||||
"One or more unsupported amendments activated. "
|
||||
"Server must be upgraded to remain compatible with the network.");
|
||||
}
|
||||
}
|
||||
|
||||
inline bool
|
||||
@@ -1789,8 +1799,23 @@ NetworkOPsImp::switchLastClosedLedger(
|
||||
|
||||
clearNeedNetworkLedger();
|
||||
|
||||
// Update fee computations.
|
||||
app_.getTxQ().processClosedLedger(app_, *newLCL, true);
|
||||
// Update fee computations. May throw if the ledger contains
|
||||
// transactions with fields unknown to this binary (e.g. after an
|
||||
// unsupported amendment activates). Catch to allow graceful shutdown.
|
||||
//@@start process-closed-ledger-catch
|
||||
try
|
||||
{
|
||||
app_.getTxQ().processClosedLedger(app_, *newLCL, true);
|
||||
}
|
||||
catch (std::runtime_error const& e)
|
||||
{
|
||||
if (!amendmentBlocked_)
|
||||
throw;
|
||||
JLOG(m_journal.error())
|
||||
<< "Failed to process closed ledger: " << e.what();
|
||||
return;
|
||||
}
|
||||
//@@end process-closed-ledger-catch
|
||||
|
||||
// Caller must own master lock
|
||||
{
|
||||
@@ -2449,7 +2474,7 @@ NetworkOPsImp::getServerInfo(bool human, bool admin, bool counters)
|
||||
"may be incorrectly configured or some [validator_list_sites] "
|
||||
"may be unreachable.";
|
||||
}
|
||||
if (admin && isAmendmentWarned())
|
||||
if (isAmendmentWarned())
|
||||
{
|
||||
Json::Value& w = warnings.append(Json::objectValue);
|
||||
w[jss::id] = warnRPC_UNSUPPORTED_MAJORITY;
|
||||
@@ -2893,6 +2918,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr<ReadView const> const& lpAccepted)
|
||||
// Ledgers are published only when they acquire sufficient validations
|
||||
// Holes are filled across connection loss or other catastrophe
|
||||
|
||||
//@@start pubLedger-accepted-ledger-construction
|
||||
std::shared_ptr<AcceptedLedger> alpAccepted =
|
||||
app_.getAcceptedLedgerCache().fetch(lpAccepted->info().hash);
|
||||
if (!alpAccepted)
|
||||
@@ -2901,6 +2927,7 @@ NetworkOPsImp::pubLedger(std::shared_ptr<ReadView const> const& lpAccepted)
|
||||
app_.getAcceptedLedgerCache().canonicalize_replace_client(
|
||||
lpAccepted->info().hash, alpAccepted);
|
||||
}
|
||||
//@@end pubLedger-accepted-ledger-construction
|
||||
|
||||
XRPL_ASSERT(
|
||||
alpAccepted->getLedger().get() == lpAccepted.get(),
|
||||
|
||||
@@ -129,8 +129,6 @@ doRipplePathFind(RPC::JsonContext&);
|
||||
Json::Value
|
||||
doServerDefinitions(RPC::JsonContext&);
|
||||
Json::Value
|
||||
getStaticServerDefinitions();
|
||||
Json::Value
|
||||
doServerInfo(RPC::JsonContext&); // for humans
|
||||
Json::Value
|
||||
doServerState(RPC::JsonContext&); // for machines
|
||||
|
||||
@@ -523,15 +523,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
Json::Value
|
||||
getStaticServerDefinitions()
|
||||
{
|
||||
static const Definitions defs{};
|
||||
Json::Value ret = defs();
|
||||
ret[jss::hash] = to_string(defs.getHash());
|
||||
return ret;
|
||||
}
|
||||
|
||||
Json::Value
|
||||
doServerDefinitions(RPC::JsonContext& context)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user