mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-20 12:39:47 +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:
@@ -112,8 +112,9 @@ static std::string DummyAddress(const CChainParams ¶ms)
|
||||
sourcedata.insert(sourcedata.end(), dummydata, dummydata + sizeof(dummydata));
|
||||
for(int i=0; i<256; ++i) { // Try every trailing byte
|
||||
std::string s = EncodeBase58(sourcedata.data(), sourcedata.data() + sourcedata.size());
|
||||
if (!CBitcoinAddress(s).IsValid())
|
||||
if (!IsValidDestinationString(s)) {
|
||||
return s;
|
||||
}
|
||||
sourcedata[sourcedata.size()-1] += 1;
|
||||
}
|
||||
return "";
|
||||
@@ -248,7 +249,7 @@ QString formatBitcoinURI(const SendCoinsRecipient &info)
|
||||
|
||||
bool isDust(const QString& address, const CAmount& amount)
|
||||
{
|
||||
CTxDestination dest = CBitcoinAddress(address.toStdString()).Get();
|
||||
CTxDestination dest = DecodeDestination(address.toStdString());
|
||||
CScript script = GetScriptForDestination(dest);
|
||||
CTxOut txOut(amount, script);
|
||||
return IsDust(txOut, ::dustRelayFee);
|
||||
|
||||
Reference in New Issue
Block a user