mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-12 05:34:57 +01:00
Introduce wrappers around CBitcoinAddress
This patch removes the need for the intermediary Base58 type
CBitcoinAddress, by providing {Encode,Decode,IsValid}Destination
function that directly operate on the conversion between strings
and CTxDestination.
This commit is contained in:
@@ -218,17 +218,15 @@ void PaymentServer::ipcParseCommandLine(int argc, char* argv[])
|
||||
SendCoinsRecipient r;
|
||||
if (GUIUtil::parseBitcoinURI(arg, &r) && !r.address.isEmpty())
|
||||
{
|
||||
CBitcoinAddress address(r.address.toStdString());
|
||||
auto tempChainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
|
||||
if (address.IsValid(*tempChainParams))
|
||||
{
|
||||
if (IsValidDestinationString(r.address.toStdString(), *tempChainParams)) {
|
||||
SelectParams(CBaseChainParams::MAIN);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
tempChainParams = CreateChainParams(CBaseChainParams::TESTNET);
|
||||
if (address.IsValid(*tempChainParams))
|
||||
if (IsValidDestinationString(r.address.toStdString(), *tempChainParams)) {
|
||||
SelectParams(CBaseChainParams::TESTNET);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -441,8 +439,7 @@ void PaymentServer::handleURIOrFile(const QString& s)
|
||||
SendCoinsRecipient recipient;
|
||||
if (GUIUtil::parseBitcoinURI(s, &recipient))
|
||||
{
|
||||
CBitcoinAddress address(recipient.address.toStdString());
|
||||
if (!address.IsValid()) {
|
||||
if (!IsValidDestinationString(recipient.address.toStdString())) {
|
||||
Q_EMIT message(tr("URI handling"), tr("Invalid payment address %1").arg(recipient.address),
|
||||
CClientUIInterface::MSG_ERROR);
|
||||
}
|
||||
@@ -560,7 +557,7 @@ bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, Sen
|
||||
CTxDestination dest;
|
||||
if (ExtractDestination(sendingTo.first, dest)) {
|
||||
// Append destination address
|
||||
addresses.append(QString::fromStdString(CBitcoinAddress(dest).ToString()));
|
||||
addresses.append(QString::fromStdString(EncodeDestination(dest)));
|
||||
}
|
||||
else if (!recipient.authenticatedMerchant.isEmpty()) {
|
||||
// Unauthenticated payment requests to custom bitcoin addresses are not supported
|
||||
|
||||
Reference in New Issue
Block a user