aboutsummaryrefslogtreecommitdiff
path: root/src/qt/paymentserver.cpp
diff options
context:
space:
mode:
authorlaanwj <126646+laanwj@users.noreply.github.com>2022-03-08 19:41:38 +0100
committerlaanwj <126646+laanwj@users.noreply.github.com>2022-03-10 12:56:19 +0100
commitb7dbc83f23f67048cd6f66f5587381d73fad4894 (patch)
tree0f50a374bf7a1cceb506e8625baa01b9a9efd408 /src/qt/paymentserver.cpp
parentc9ed9927bbb7c422c4e01c0c1adc9722b8671009 (diff)
downloadbitcoin-b7dbc83f23f67048cd6f66f5587381d73fad4894.tar.xz
qt: Remove network detection based on address in BIP21
This is some very ugly and brittle code that switches the global network based on a provided address, remove it. I think in practice it's very unlikely for testnet BIP21 payment URIs to be used, and if so it's for testing so it's easy enough to manually copy it. Or to specify `-testnet` explicitly. There is already no case for `-regtest` or `-signet`.
Diffstat (limited to 'src/qt/paymentserver.cpp')
-rw-r--r--src/qt/paymentserver.cpp23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp
index cb09035b45..c82f0683fc 100644
--- a/src/qt/paymentserver.cpp
+++ b/src/qt/paymentserver.cpp
@@ -78,32 +78,11 @@ void PaymentServer::ipcParseCommandLine(int argc, char* argv[])
for (int i = 1; i < argc; i++)
{
QString arg(argv[i]);
- if (arg.startsWith("-"))
- continue;
+ if (arg.startsWith("-")) continue;
- // If the bitcoin: URI contains a payment request, we are not able to detect the
- // network as that would require fetching and parsing the payment request.
- // That means clicking such an URI which contains a testnet payment request
- // will start a mainnet instance and throw a "wrong network" error.
if (arg.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
{
- if (savedPaymentRequests.contains(arg)) continue;
savedPaymentRequests.insert(arg);
-
- SendCoinsRecipient r;
- if (GUIUtil::parseBitcoinURI(arg, &r) && !r.address.isEmpty())
- {
- auto tempChainParams = CreateChainParams(gArgs, CBaseChainParams::MAIN);
-
- if (IsValidDestinationString(r.address.toStdString(), *tempChainParams)) {
- SelectParams(CBaseChainParams::MAIN);
- } else {
- tempChainParams = CreateChainParams(gArgs, CBaseChainParams::TESTNET);
- if (IsValidDestinationString(r.address.toStdString(), *tempChainParams)) {
- SelectParams(CBaseChainParams::TESTNET);
- }
- }
- }
}
}
}