diff --git a/src/stratum.cpp b/src/stratum.cpp index d9cfffb44..94081e8ac 100644 --- a/src/stratum.cpp +++ b/src/stratum.cpp @@ -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);