From 8cf1485f3b7a976548128c0d3866747819cbea51 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 25 Jan 2014 20:05:00 +0100 Subject: Abstract chaincodes into CChainCode # Conflicts: # src/key.cpp # src/key.h --- src/key.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/key.h') diff --git a/src/key.h b/src/key.h index 104a8f5c72..d3c7a28e01 100644 --- a/src/key.h +++ b/src/key.h @@ -6,6 +6,7 @@ #ifndef BITCOIN_KEY_H #define BITCOIN_KEY_H +#include "pubkey.h" #include "serialize.h" #include "support/allocators/secure.h" #include "uint256.h" @@ -13,9 +14,6 @@ #include #include -class CPubKey; - -struct CExtPubKey; /** * secp256k1: @@ -157,13 +155,13 @@ struct CExtKey { unsigned char nDepth; unsigned char vchFingerprint[4]; unsigned int nChild; - unsigned char vchChainCode[32]; + CChainCode 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.vchChainCode[0], &b.vchChainCode[0], 32) == 0 && a.key == b.key; + memcmp(&a.chaincode.data[0], &b.chaincode.data[0], 32) == 0 && a.key == b.key; } void Encode(unsigned char code[74]) const; -- cgit v1.2.3 From a574899671d428682b339ff988363ecaf7dfcd07 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 21 Apr 2015 18:09:37 -0400 Subject: chaincodes: abstract away more chaincode behavior [squashme] replace struct CCainCode with a typedef uint256 ChainCode --- src/key.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/key.h') diff --git a/src/key.h b/src/key.h index d3c7a28e01..b2ef801ee8 100644 --- a/src/key.h +++ b/src/key.h @@ -136,7 +136,7 @@ public: bool SignCompact(const uint256& hash, std::vector& 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; -- cgit v1.2.3