mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Improvements to protocol serialization:
A few serialization changes coming from m-of-n development: o Improve readability of SField.cpp. o Better initialization of STObject. o Trimming of STObject public methods. o Add STObject::getFieldObject and STObject::setFieldObject. o Make STObject::isEquivalent more robust. o Improvements to whitespace, overrides, and virtuals.
This commit is contained in:
committed by
Vinnie Falco
parent
2f3834359e
commit
92799187ed
@@ -34,6 +34,9 @@ static std::mutex SField_mutex;
|
||||
static std::map<int, SField const*> knownCodeToField;
|
||||
static std::map<int, std::unique_ptr<SField const>> unknownCodeToField;
|
||||
|
||||
// Storage for static const member.
|
||||
SField::IsSigning const SField::notSigning;
|
||||
|
||||
int SField::num = 0;
|
||||
|
||||
typedef std::lock_guard <std::mutex> StaticScopedLockType;
|
||||
@@ -173,9 +176,9 @@ SField const sfDeliveredAmount = make::one(&sfDeliveredAmount, STI_AMOUNT, 18, "
|
||||
// variable length
|
||||
TypedField<STBlob> const sfPublicKey = make::one<STBlob>(&sfPublicKey, STI_VL, 1, "PublicKey");
|
||||
TypedField<STBlob> const sfSigningPubKey = make::one<STBlob>(&sfSigningPubKey, STI_VL, 3, "SigningPubKey");
|
||||
TypedField<STBlob> const sfSignature = make::one<STBlob>(&sfSignature, STI_VL, 6, "Signature", SField::sMD_Default, false);
|
||||
TypedField<STBlob> const sfSignature = make::one<STBlob>(&sfSignature, STI_VL, 6, "Signature", SField::sMD_Default, SField::notSigning);
|
||||
SField const sfMessageKey = make::one(&sfMessageKey, STI_VL, 2, "MessageKey");
|
||||
SField const sfTxnSignature = make::one(&sfTxnSignature, STI_VL, 4, "TxnSignature", SField::sMD_Default, false);
|
||||
SField const sfTxnSignature = make::one(&sfTxnSignature, STI_VL, 4, "TxnSignature", SField::sMD_Default, SField::notSigning);
|
||||
SField const sfDomain = make::one(&sfDomain, STI_VL, 7, "Domain");
|
||||
SField const sfFundCode = make::one(&sfFundCode, STI_VL, 8, "FundCode");
|
||||
SField const sfRemoveCode = make::one(&sfRemoveCode, STI_VL, 9, "RemoveCode");
|
||||
@@ -216,7 +219,7 @@ SField const sfMemo = make::one(&sfMemo, STI_OBJEC
|
||||
// array of objects
|
||||
// ARRAY/1 is reserved for end of array
|
||||
SField const sfSigningAccounts = make::one(&sfSigningAccounts, STI_ARRAY, 2, "SigningAccounts");
|
||||
SField const sfTxnSignatures = make::one(&sfTxnSignatures, STI_ARRAY, 3, "TxnSignatures", SField::sMD_Default, false);
|
||||
SField const sfTxnSignatures = make::one(&sfTxnSignatures, STI_ARRAY, 3, "TxnSignatures", SField::sMD_Default, SField::notSigning);
|
||||
SField const sfSignatures = make::one(&sfSignatures, STI_ARRAY, 4, "Signatures");
|
||||
SField const sfTemplate = make::one(&sfTemplate, STI_ARRAY, 5, "Template");
|
||||
SField const sfNecessary = make::one(&sfNecessary, STI_ARRAY, 6, "Necessary");
|
||||
@@ -225,7 +228,7 @@ SField const sfAffectedNodes = make::one(&sfAffectedNodes, STI_ARRAY, 8, "Af
|
||||
SField const sfMemos = make::one(&sfMemos, STI_ARRAY, 9, "Memos");
|
||||
|
||||
SField::SField (SerializedTypeID tid, int fv, const char* fn,
|
||||
int meta, bool signing)
|
||||
int meta, IsSigning signing)
|
||||
: fieldCode (field_code (tid, fv))
|
||||
, fieldType (tid)
|
||||
, fieldValue (fv)
|
||||
@@ -244,7 +247,7 @@ SField::SField (int fc)
|
||||
, fieldValue (0)
|
||||
, fieldMeta (sMD_Never)
|
||||
, fieldNum (++num)
|
||||
, signingField (true)
|
||||
, signingField (IsSigning::yes)
|
||||
, rawJsonName (getName ())
|
||||
, jsonName (rawJsonName.c_str ())
|
||||
{
|
||||
@@ -257,7 +260,7 @@ SField::SField (SerializedTypeID tid, int fv)
|
||||
: fieldCode (field_code (tid, fv)), fieldType (tid), fieldValue (fv),
|
||||
fieldMeta (sMD_Default),
|
||||
fieldNum (++num),
|
||||
signingField (true),
|
||||
signingField (IsSigning::yes),
|
||||
jsonName (nullptr)
|
||||
{
|
||||
fieldName = std::to_string (tid) + '/' + std::to_string (fv);
|
||||
|
||||
Reference in New Issue
Block a user