stratum: honour the "x" worker name again
mining.authorize maps the worker name "x" to -stratumaddress, but it tested
CBitcoinAddress("x").ToString() == "x". "x" is not a valid address, so the
CBitcoinAddress holds no data and never prints as "x": the default address was
never used, and every "x" miner was refused with "Invalid DragonX address: x".
stratummine's default worker is "x", so the reference miner failed with "did not
receive complete RandomX work" unless it was given an explicit address.
Compare the worker name as sent (after stripping a ".rig" suffix) instead.
Found in the 2026-11-29 stress run: on a local RandomX chain with -stratumaddress
set, authorize "x" got the error above, while the same session authorized with the
address itself received set_randomx_key/set_target/notify and mined accepted shares.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+4
-2
@@ -1274,14 +1274,16 @@ UniValue stratum_mining_authorize(StratumClient& client, const UniValue& params)
|
||||
boost::trim_right(username);
|
||||
}
|
||||
|
||||
CBitcoinAddress addr(get_stripped_username(username));
|
||||
const std::string strippedUsername = get_stripped_username(username);
|
||||
CBitcoinAddress addr(strippedUsername);
|
||||
|
||||
// If given the special address "x", mine to the default address given by -stratumaddress
|
||||
// This means a miner can run a private pool without TLS and not
|
||||
// worry about MITM attacks that change addresses, and leaks less metadata.
|
||||
// It also means many miners can be used and updating their mining address does not
|
||||
// require any changes on each miner, just restart dragonxd with a new -stratumaddress
|
||||
if(addr.ToString() == "x") {
|
||||
// Compare the name as sent: "x" is not a valid address, so addr.ToString() never returns it.
|
||||
if(strippedUsername == "x") {
|
||||
addr = CBitcoinAddress(GetArg("-stratumaddress", ""));
|
||||
const std::string msg = strprintf("%s: Authorized client with default stratum address=%s", __func__, addr.ToString());
|
||||
LogPrint("stratum", "%s\n", msg);
|
||||
|
||||
Reference in New Issue
Block a user