More serialization work.

This commit is contained in:
JoelKatz
2012-09-26 16:26:39 -07:00
parent e7d9b99133
commit 3f469c914d
6 changed files with 50 additions and 56 deletions

View File

@@ -4,24 +4,28 @@
#include "HashPrefixes.h"
SOElement SerializedValidation::sValidationFormat[] = {
{ sfFlags, "Flags", STI_UINT32, SOE_FLAGS, 0 },
{ sfLedgerHash, "LedgerHash", STI_HASH256, SOE_REQUIRED, 0 },
{ sfSigningTime, "SignTime", STI_UINT32, SOE_REQUIRED, 0 },
{ sfSigningKey, "SigningKey", STI_VL, SOE_REQUIRED, 0 },
{ sfInvalid, NULL, STI_DONE, SOE_NEVER, -1 },
{ sfFlags, SOE_REQUIRED },
{ sfLedgerHash, SOE_REQUIRED },
{ sfLedgerSequence, SOE_OPTIONAL },
{ sfCloseTime, SOE_OPTIONAL },
{ sfLoadFee, SOE_OPTIONAL },
{ sfBaseFee, SOE_OPTIONAL },
{ sfSigningTime, SOE_REQUIRED },
{ sfSigningKey, SOE_REQUIRED },
{ sfInvalid, SOE_END }
};
const uint32 SerializedValidation::sFullFlag = 0x00010000;
SerializedValidation::SerializedValidation(SerializerIterator& sit, bool checkSignature)
: STObject(sValidationFormat, sit), mSignature(sit, "Signature"), mTrusted(false)
: STObject(sValidationFormat, sit, sfValidation), mSignature(sit, sfSignature), mTrusted(false)
{
if (checkSignature && !isValid()) throw std::runtime_error("Invalid validation");
}
SerializedValidation::SerializedValidation(const uint256& ledgerHash, uint32 signTime,
const NewcoinAddress& naSeed, bool isFull)
: STObject(sValidationFormat), mSignature("Signature"), mTrusted(false)
: STObject(sValidationFormat, sfValidation), mSignature(sfSignature), mTrusted(false)
{
setValueFieldH256(sfLedgerHash, ledgerHash);
setValueFieldU32(sfSigningTime, signTime);