Skip to content

Commit 089b742

Browse files
committed
Merge #11259: Remove duplicate destination decoding
86e6dd4 Remove duplicate destination decoding (João Barbosa) 8d0041e Remove unused GetKeyID and IsScript methods from CBitcoinAddress (João Barbosa) Pull request description: Follow up of #11117, this patch removes an extra unnecessary destination decoding that was identified while reviewing #11117. It is also the only case where `IsValidDestinationString` is called before `DecodeDestination`. For reference see [comment](bitcoin/bitcoin#11117 (comment)). Tree-SHA512: f5ff5cb28a576ccd819a058f102188bde55654f30618520cc680c91d2f6e536fe038fc7220dd2d2dd64c6175fcb23f89b94b48444521e11ddec0b2f8ef2c05dd
2 parents bcc8a62 + 86e6dd4 commit 089b742

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

src/base58.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,6 @@ class CBitcoinAddress : public CBase58Data {
232232
CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); }
233233

234234
CTxDestination Get() const;
235-
bool GetKeyID(CKeyID &keyID) const;
236-
bool IsScript() const;
237235
};
238236

239237
class CBitcoinAddressVisitor : public boost::static_visitor<bool>
@@ -295,21 +293,6 @@ CTxDestination CBitcoinAddress::Get() const
295293
return CNoDestination();
296294
}
297295

298-
bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const
299-
{
300-
if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS))
301-
return false;
302-
uint160 id;
303-
memcpy(&id, vchData.data(), 20);
304-
keyID = CKeyID(id);
305-
return true;
306-
}
307-
308-
bool CBitcoinAddress::IsScript() const
309-
{
310-
return IsValid() && vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS);
311-
}
312-
313296
void CBitcoinSecret::SetKey(const CKey& vchSecret)
314297
{
315298
assert(vchSecret.IsValid());

src/qt/transactiondesc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
9191
if (nNet > 0)
9292
{
9393
// Credit
94-
if (IsValidDestinationString(rec->address)) {
95-
CTxDestination address = DecodeDestination(rec->address);
94+
CTxDestination address = DecodeDestination(rec->address);
95+
if (IsValidDestination(address)) {
9696
if (wallet->mapAddressBook.count(address))
9797
{
9898
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";

0 commit comments

Comments
 (0)