Merge #11259: Remove duplicate destination decoding
86e6dd4b6
Remove duplicate destination decoding (João Barbosa)8d0041e60
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](https://github.com/bitcoin/bitcoin/pull/11117#discussion_r137145517). Tree-SHA512: f5ff5cb28a576ccd819a058f102188bde55654f30618520cc680c91d2f6e536fe038fc7220dd2d2dd64c6175fcb23f89b94b48444521e11ddec0b2f8ef2c05dd
This commit is contained in:
commit
089b742a21
2 changed files with 2 additions and 19 deletions
|
@ -232,8 +232,6 @@ public:
|
||||||
CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); }
|
CBitcoinAddress(const char* pszAddress) { SetString(pszAddress); }
|
||||||
|
|
||||||
CTxDestination Get() const;
|
CTxDestination Get() const;
|
||||||
bool GetKeyID(CKeyID &keyID) const;
|
|
||||||
bool IsScript() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CBitcoinAddressVisitor : public boost::static_visitor<bool>
|
class CBitcoinAddressVisitor : public boost::static_visitor<bool>
|
||||||
|
@ -295,21 +293,6 @@ CTxDestination CBitcoinAddress::Get() const
|
||||||
return CNoDestination();
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CBitcoinAddress::IsScript() const
|
|
||||||
{
|
|
||||||
return IsValid() && vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CBitcoinSecret::SetKey(const CKey& vchSecret)
|
void CBitcoinSecret::SetKey(const CKey& vchSecret)
|
||||||
{
|
{
|
||||||
assert(vchSecret.IsValid());
|
assert(vchSecret.IsValid());
|
||||||
|
|
|
@ -91,8 +91,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||||
if (nNet > 0)
|
if (nNet > 0)
|
||||||
{
|
{
|
||||||
// Credit
|
// Credit
|
||||||
if (IsValidDestinationString(rec->address)) {
|
|
||||||
CTxDestination address = DecodeDestination(rec->address);
|
CTxDestination address = DecodeDestination(rec->address);
|
||||||
|
if (IsValidDestination(address)) {
|
||||||
if (wallet->mapAddressBook.count(address))
|
if (wallet->mapAddressBook.count(address))
|
||||||
{
|
{
|
||||||
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
|
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
|
||||||
|
|
Loading…
Reference in a new issue