merge bitcoin-core/gui#563: Remove network detection based on address in BIP21

This commit is contained in:
Kittywhiskers Van Gogh 2022-03-08 19:41:38 +01:00
parent f088334c8a
commit 0c545ac0e9
No known key found for this signature in database
GPG Key ID: 30CD0C065E5C4AAD
2 changed files with 2 additions and 23 deletions

View File

@ -658,7 +658,7 @@ int GuiMain(int argc, char* argv[])
return EXIT_FAILURE;
}
#ifdef ENABLE_WALLET
// Parse URIs on command line -- this can affect Params()
// Parse URIs on command line
PaymentServer::ipcParseCommandLine(argc, argv);
#endif

View File

@ -79,32 +79,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 dash: 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)) // dash: 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);
}
}
}
}
}
}