mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-28 06:25:49 +00:00
Make validation code work.
This commit is contained in:
@@ -68,7 +68,7 @@ PROTO_SRCS = env.Protoc([], 'src/newcoin.proto', PROTOCOUTDIR='obj', PROTOCP
|
||||
env.Clean(PROTO_SRCS, 'site_scons/site_tools/protoc.pyc')
|
||||
|
||||
# Remove unused source files.
|
||||
UNUSED_SRCS = ['src/HttpReply.cpp', 'src/ValidationCollection.cpp']
|
||||
UNUSED_SRCS = ['src/HttpReply.cpp']
|
||||
|
||||
for file in UNUSED_SRCS:
|
||||
NEWCOIN_SRCS.remove(file)
|
||||
|
||||
@@ -13,13 +13,13 @@ const uint32 SerializedValidation::sFullFlag = 0x00010000;
|
||||
const uint32 SerializedValidation::sValidationMagic = 0x4c575200; // "LGR"
|
||||
|
||||
SerializedValidation::SerializedValidation(SerializerIterator& sit, bool checkSignature)
|
||||
: STObject(sValidationFormat, sit), mSignature(sit, "Signature")
|
||||
: STObject(sValidationFormat, sit), mSignature(sit, "Signature"), mTrusted(false)
|
||||
{
|
||||
if (!isValid()) throw std::runtime_error("Invalid validation");
|
||||
}
|
||||
|
||||
SerializedValidation::SerializedValidation(const uint256& ledgerHash, const NewcoinAddress& naSeed, bool isFull)
|
||||
: STObject(sValidationFormat), mSignature("Signature")
|
||||
: STObject(sValidationFormat), mSignature("Signature"), mTrusted(false)
|
||||
{
|
||||
setValueFieldH256(sfLedgerHash, ledgerHash);
|
||||
setValueFieldVL(sfSigningKey, NewcoinAddress::createNodePublic(naSeed).getNodePublic());
|
||||
|
||||
@@ -8,6 +8,9 @@ class SerializedValidation : public STObject
|
||||
{
|
||||
protected:
|
||||
STVariableLength mSignature;
|
||||
bool mTrusted;
|
||||
|
||||
void setNode();
|
||||
|
||||
public:
|
||||
typedef boost::shared_ptr<SerializedValidation> pointer;
|
||||
@@ -26,9 +29,11 @@ public:
|
||||
NewcoinAddress getSignerPublic() const;
|
||||
bool isValid() const;
|
||||
bool isFull() const;
|
||||
bool isTrusted() const { return mTrusted; }
|
||||
CKey::pointer getSigningKey() const;
|
||||
uint256 getSigningHash() const;
|
||||
|
||||
void setTrusted() { mTrusted = true; }
|
||||
void addSigned(Serializer&) const;
|
||||
void addSignature(Serializer&) const;
|
||||
std::vector<unsigned char> getSigned() const;
|
||||
|
||||
Reference in New Issue
Block a user