Skip to content

Commit

Permalink
Merge bitcoin#11259: Remove duplicate destination decoding
Browse files Browse the repository at this point in the history
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 bitcoin#11117, this patch removes an extra unnecessary destination decoding that was identified while reviewing bitcoin#11117. It is also the only case where `IsValidDestinationString` is called before `DecodeDestination`.

  For reference see [comment](bitcoin#11117 (comment)).

Tree-SHA512: f5ff5cb28a576ccd819a058f102188bde55654f30618520cc680c91d2f6e536fe038fc7220dd2d2dd64c6175fcb23f89b94b48444521e11ddec0b2f8ef2c05dd
  • Loading branch information
laanwj authored and PastaPastaPasta committed Feb 29, 2020
1 parent 2521970 commit a321e61
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
11 changes: 0 additions & 11 deletions src/base58.cpp
Expand Up @@ -232,7 +232,6 @@ class CBitcoinAddress : public CBase58Data {
CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); }

CTxDestination Get() const;
bool GetKeyID(CKeyID &keyID) const;
};

class CBitcoinAddressVisitor : public boost::static_visitor<bool>
Expand Down Expand Up @@ -294,16 +293,6 @@ CTxDestination CBitcoinAddress::Get() const
return CNoDestination();
}

bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const
{
if (!IsValid() || vchVersion != Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS))
return false;
uint160 id;
memcpy(&id, vchData.data(), 20);
keyID = CKeyID(id);
return true;
}

void CBitcoinSecret::SetKey(const CKey& vchSecret)
{
assert(vchSecret.IsValid());
Expand Down
4 changes: 2 additions & 2 deletions src/qt/transactiondesc.cpp
Expand Up @@ -107,8 +107,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
if (nNet > 0)
{
// Credit
if (IsValidDestinationString(rec->strAddress)) {
CTxDestination address = rec->txDest;
CTxDestination address = DecodeDestination(rec->strAddress);
if (IsValidDestination(address)) {
if (wallet->mapAddressBook.count(address))
{
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
Expand Down

0 comments on commit a321e61

Please sign in to comment.