Files
xahaud/src/SerializedValidation.h
JoelKatz 0630a4b7f4 We have to track the high node ID of trusted validators as a tie-breaker.
1) Change return from getCurrentValidations
2) Log tiebreaker logic to aid debugging
3) Change checkLastClosedLedger to use the new tie-breaker logic
4) Log when we refuse to switch to our own previous ledger
5) Track node ID in the serialized validation object
6) Simplify getCurrentValidations ledger suppression logic
2012-10-05 03:46:24 -07:00

49 lines
1.4 KiB
C++

#ifndef __VALIDATION__
#define __VALIDATION__
#include "SerializedObject.h"
#include "NewcoinAddress.h"
class SerializedValidation : public STObject
{
protected:
uint256 mPreviousHash;
uint160 mNodeID;
bool mTrusted;
void setNode();
public:
typedef boost::shared_ptr<SerializedValidation> pointer;
typedef const boost::shared_ptr<SerializedValidation>& ref;
static const uint32 sFullFlag;
// These throw if the object is not valid
SerializedValidation(SerializerIterator& sit, bool checkSignature = true);
SerializedValidation(const uint256& ledgerHash, uint32 signTime, const NewcoinAddress& naSeed, bool isFull);
uint256 getLedgerHash() const;
uint32 getSignTime() const;
uint32 getFlags() const;
NewcoinAddress getSignerPublic() const;
uint160 getNodeID() const { return mNodeID; }
bool isValid() const;
bool isFull() const;
bool isTrusted() const { return mTrusted; }
uint256 getSigningHash() const;
bool isValid(const uint256&) const;
void setTrusted() { mTrusted = true; }
std::vector<unsigned char> getSigned() const;
std::vector<unsigned char> getSignature() const;
// The validation this replaced
const uint256& getPreviousHash() { return mPreviousHash; }
bool isPreviousHash(const uint256& h) { return mPreviousHash == h; }
void setPreviousHash(const uint256& h) { mPreviousHash = h; }
};
#endif
// vim:ts=4