Skip to content

Commit

Permalink
remove aggPubKey and aggHeight
Browse files Browse the repository at this point in the history
  • Loading branch information
winnie-chaintope authored and Naviabheeman committed Jun 5, 2020
1 parent 329c273 commit babecf2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/federationparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ CPubKey CFederationParams::ReadAggregatePubkey(const std::vector<unsigned char>&
p.aggpubkey = CPubKey(pubkey.begin(), pubkey.end());
p.height = height;
aggregatePubkeyHeight.push_back(p);
aggregatePubkey.push_back(p.aggpubkey);
aggregateHeight.push_back(p.height);
if(!p.aggpubkey.IsFullyValid()) {
throw std::runtime_error(strprintf("Aggregate Public Key for Signed Block is invalid: %s", HexStr(pubkey)));
}
Expand Down Expand Up @@ -201,7 +199,7 @@ bool CFederationParams::ReadGenesisBlock(std::string genesisHex)

//verify proof
const uint256 blockHash = genesis.GetHashForSign();
if(!aggregatePubkey.back().Verify_Schnorr(blockHash, genesis.proof))
if(!aggregatePubkeyHeight.back().aggpubkey.Verify_Schnorr(blockHash, genesis.proof))
throw std::runtime_error("ReadGenesisBlock: Proof verification failed");

return true;
Expand Down
4 changes: 1 addition & 3 deletions src/federationparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CFederationParams
* Parse aggPubkey in block header.
*/
CPubKey ReadAggregatePubkey(const std::vector<unsigned char>& pubkey, uint height);
const CPubKey& GetLatestAggregatePubkey() const { return aggregatePubkey.back(); }
const CPubKey& GetLatestAggregatePubkey() const { return aggregatePubkeyHeight.back().aggpubkey; }
bool ReadGenesisBlock(std::string genesisHex);
const CBlock& GenesisBlock() const { return genesis; }
const std::string& getDataDir() const { return dataDir; }
Expand Down Expand Up @@ -85,9 +85,7 @@ class CFederationParams
CMessageHeader::MessageStartChars pchMessageStart;
std::string strNetworkID;
std::string dataDir;
std::vector<CPubKey> aggregatePubkey;
std::vector<aggPubkeyAndHeight> aggregatePubkeyHeight;
std::vector<uint> aggregateHeight;
CBlock genesis;
std::vector<std::string> vSeeds;
std::vector<SeedSpec6> vFixedSeeds;
Expand Down
2 changes: 1 addition & 1 deletion src/validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ void InitScriptExecutionCache();


/** Functions for disk access for blocks */
bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos);
bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos, int height);
bool ReadBlockFromDisk(CBlock& block, const CBlockIndex* pindex);
bool ReadRawBlockFromDisk(std::vector<uint8_t>& block, const CDiskBlockPos& pos, const CMessageHeader::MessageStartChars& message_start);
bool ReadRawBlockFromDisk(std::vector<uint8_t>& block, const CBlockIndex* pindex, const CMessageHeader::MessageStartChars& message_start);
Expand Down

0 comments on commit babecf2

Please sign in to comment.