crypto fix
All checks were successful
Deploy / build-deploy (push) Successful in 2m32s

This commit is contained in:
Jorijn van der Graaf 2026-08-19 23:55:01 +02:00
commit 2a4e2c1c85
8 changed files with 1381 additions and 41 deletions

View file

@ -327,22 +327,47 @@ int main(int argc, char** argv) {
out = Server::MakeRail(cfg);
// "off" is a legitimate choice and yields no rail; a mode nobody
// recognises silently would too, which is how a typo becomes a
// shop that quietly stops taking one kind of money.
// shop that quietly stops taking one kind of money. So an
// unrecognised mode is still a hard refusal — but a mode we DO
// recognise, failing on its runtime data, is not the same fault
// and must not be answered the same way (see below).
if (!out && mode != "off") {
// "eurc" is the one mode that constructs to nullptr for a
// reason other than a typo — its chains file or address pool
// did not load, and MakeEurcRail has already said which and
// why. Repeating "unknown rail" over the top of that would
// send the operator looking for a spelling mistake.
if (mode == "eurc") {
std::println(std::cerr,
"catcrafts-server: the eurc rail could not load its "
"chains file ({}) or address pool ({}) — see above",
eurcChainsPath.string(), eurcPoolPath.string());
} else {
static constexpr std::string_view kKnown[] = {
"mollie", "eurc", "fake", "fake-crypto"
};
const bool known = std::ranges::find(kKnown, mode) != std::end(kKnown);
if (!known) {
std::println(std::cerr, "catcrafts-server: unknown rail '{}'", mode);
return false;
}
return false;
// A KNOWN rail that could not load its data — for "eurc",
// its chains file or address pool. MakeEurcRail has already
// said which and why, so this only names the files.
//
// This is a WARNING and not a refusal, and the reason is the
// blast radius. An exhausted address pool is a state a
// stranger can drive the shop into (every crypto checkout
// spends an address), and answering it with "the process
// refuses to boot" turns a spent pool into the entire website
// down — every page, the bank rail included — held down by
// Restart=always until a human runs an offline wallet
// ceremony. That trade is never right: this box already
// "serves the whole site minus checkout" when no credentials
// exist at all (see the slot notes above), and one rail's
// data going bad is strictly less than that.
//
// Silent degradation is the other failure to avoid, so the
// warning is loud, the listening line below reports
// crypto=off, and tools/enable-eurc.sh refuses to call an
// enable successful without the rail's own load line.
std::println(std::cerr,
"catcrafts-server: WARNING: the '{}' rail could not load "
"its chains file ({}) or address pool ({}) — see above. "
"CONTINUING WITHOUT IT: that payment choice is off and "
"the rest of the site is unaffected.",
mode, eurcChainsPath.string(), eurcPoolPath.string());
out.reset();
return true;
}
return true;
};