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