chaincodes: abstract away more chaincode behavior

[squashme] replace struct CCainCode with a typedef uint256 ChainCode
This commit is contained in:
Cory Fields
2015-04-21 18:09:37 -04:00
committed by Jonas Schnelli
parent 8cf1485f3b
commit a574899671
6 changed files with 25 additions and 53 deletions

View File

@@ -136,7 +136,7 @@ public:
bool SignCompact(const uint256& hash, std::vector<unsigned char>& vchSig) const;
//! Derive BIP32 child key.
bool Derive(CKey& keyChild, unsigned char ccChild[32], unsigned int nChild, const unsigned char cc[32]) const;
bool Derive(CKey& keyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode& cc) const;
/**
* Verify thoroughly whether a private key and a public key match.
@@ -155,13 +155,13 @@ struct CExtKey {
unsigned char nDepth;
unsigned char vchFingerprint[4];
unsigned int nChild;
CChainCode chaincode;
ChainCode chaincode;
CKey key;
friend bool operator==(const CExtKey& a, const CExtKey& b)
{
return a.nDepth == b.nDepth && memcmp(&a.vchFingerprint[0], &b.vchFingerprint[0], 4) == 0 && a.nChild == b.nChild &&
memcmp(&a.chaincode.data[0], &b.chaincode.data[0], 32) == 0 && a.key == b.key;
a.chaincode == b.chaincode && a.key == b.key;
}
void Encode(unsigned char code[74]) const;