Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring about key compressed flag #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/BitcoinAddress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ CTxDestination CBitcoinAddress::Get() const
}

// ####### これも CKeyID に移行する候補.
/*
bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const
{
if (!IsValid() || m_data.m_vchVersion != Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS))
Expand All @@ -67,6 +68,7 @@ bool CBitcoinAddress::GetKeyID(CKeyID& keyID) const
keyID = CKeyID(id);
return true;
}
*/

bool CBitcoinAddress::IsScript() const
{
Expand Down
11 changes: 1 addition & 10 deletions src/BitcoinAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,23 @@ class CTxDestination;
* Script-hash-addresses have version 5 (or 196 testnet).
* The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script.
*/
// ※ CKeyID は排除。CKeyID 側に処理は移行済み.
class CBitcoinAddress {
public:
// bool Set(const CKeyID &id);
bool IsValid() const;
bool IsValid(const CChainParams &params) const;

CBitcoinAddress() {}
CBitcoinAddress(const base58string& strAddress) { m_data.SetBase58string(strAddress); }

CTxDestination Get() const;
bool GetKeyID(CKeyID &keyID) const;
// bool GetKeyID(CKeyID &keyID) const;
bool IsScript() const;

bool operator < (const CBitcoinAddress& rhs) const { return this->m_data < rhs.m_data; }
bool operator == (const CBitcoinAddress& rhs) const { return this->m_data == rhs.m_data; }

bool SetBase58string(const base58string& str) { return m_data.SetBase58string(str) && IsValid(); }

private:
// CBitcoinAddress(const CScriptID &dest); // { Set(dest); }
// CBitcoinAddress(const CKeyID &dest); // CKeyID はもう受け付けない。CKeyID 側で処理をする.
// CBitcoinAddress(const CTxDestination &dest); // { Set(dest); }
// bool Set(const CTxDestination &dest);
// bool Set(const CScriptID &id);

public:
friend class CTxDestination;

Expand Down
2 changes: 1 addition & 1 deletion src/base58.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class CBase58Data{
std::vector<unsigned char> m_vchVersion;

//! the actually encoded data
VectorUchar m_vchData;
VectorUchar m_vchData;

public: // ### 仮.
CBase58Data();
Expand Down
6 changes: 5 additions & 1 deletion src/rpc/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ UniValue validateaddress(const JSONRPCRequest& request)
if (pwalletMain && pwalletMain->mapAddressBook.count(dest))
ret.push_back(Pair("account", pwalletMain->mapAddressBook[dest].name));
CKeyID keyID;
if (pwalletMain && address.GetKeyID(keyID) && pwalletMain->mapKeyMetadata.count(keyID) && !pwalletMain->mapKeyMetadata[keyID].hdKeypath.empty())
if (pwalletMain
&& address.GetKeyID(keyID)
&& pwalletMain->mapKeyMetadata.count(keyID)
&& !pwalletMain->mapKeyMetadata[keyID].hdKeypath.empty()
)
{
ret.push_back(Pair("hdkeypath", pwalletMain->mapKeyMetadata[keyID].hdKeypath));
ret.push_back(Pair("hdmasterkeyid", pwalletMain->mapKeyMetadata[keyID].m_hdMasterKeyID.GetHex()));
Expand Down