mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Move sources to src and build objs in obj.
This commit is contained in:
56
src/ValidationCollection.h
Normal file
56
src/ValidationCollection.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef __VALIDATION_COLLECTION__
|
||||
#define __VALIDATION_COLLECTION__
|
||||
|
||||
#include "../obj/src/newcoin.pb.h"
|
||||
#include "uint256.h"
|
||||
#include "types.h"
|
||||
#include "Ledger.h"
|
||||
#include <list>
|
||||
|
||||
class ValidationCollection
|
||||
{
|
||||
|
||||
// from ledger hash to the validation
|
||||
//std::map<uint256, std::vector<newcoin::Validation> > mValidations;
|
||||
//std::map<uint256, std::vector<newcoin::Validation> > mIgnoredValidations;
|
||||
|
||||
// this maps ledgerIndex to an array of groups. Each group is a list of validations.
|
||||
// a validation can be in multiple groups since compatibility isn't transitive
|
||||
//
|
||||
class Group
|
||||
{
|
||||
public:
|
||||
std::vector<newcoin::Validation> mValidations;
|
||||
Ledger::pointer mSuperLedger;
|
||||
|
||||
bool addIfCompatible(Ledger::pointer ledger,newcoin::Validation& valid);
|
||||
};
|
||||
|
||||
std::map<uint32, std::vector< Group > > mIndexGroups; // all the groups at each index
|
||||
//std::map<uint32, std::vector< newcoin::Validation > > mIndexValidations; // all the validations at each index
|
||||
|
||||
bool hasValidation(uint32 ledgerIndex,uint160& hanko,uint32 seqnum);
|
||||
void addToGroup(newcoin::Validation& valid);
|
||||
void addToDB(newcoin::Validation& valid,int weCare);
|
||||
public:
|
||||
ValidationCollection();
|
||||
|
||||
void save();
|
||||
void load();
|
||||
|
||||
void addValidation(newcoin::Validation& valid);
|
||||
|
||||
void getValidations(uint32 ledgerIndex,std::vector<newcoin::Validation>& retVec);
|
||||
|
||||
|
||||
// It can miss some compatible ledgers of course if you don't know them
|
||||
|
||||
// fills out retLedger if there is a consensusLedger you can check
|
||||
// fills out retHash if there isn't a consensusLedger to check. We need to fetch this ledger
|
||||
// returns false if there isn't a consensus yet or we are in the consensus
|
||||
bool getConsensusLedger(uint32 ledgerIndex, uint256& ourHash, Ledger::pointer& retLedger, uint256& retHash);
|
||||
|
||||
int getSeqNum(uint32 ledgerIndex);
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user