Permit memos up to 1Kb.

* Overlong memos are basically treated like invalid signatures.
* Ability to clear message key.
This commit is contained in:
David Schwartz
2014-02-19 15:28:43 -08:00
committed by Vinnie Falco
parent ae649ec917
commit 370bfb7a22
10 changed files with 62 additions and 5 deletions

View File

@@ -160,6 +160,7 @@ FIELD (FundCode, VL, 8)
FIELD (RemoveCode, VL, 9)
FIELD (ExpireCode, VL, 10)
FIELD (CreateCode, VL, 11)
FIELD (MemoType, VL, 12)
// account
FIELD (Account, ACCOUNT, 1)
@@ -187,6 +188,7 @@ FIELD (PreviousFields, OBJECT, 6)
FIELD (FinalFields, OBJECT, 7)
FIELD (NewFields, OBJECT, 8)
FIELD (TemplateEntry, OBJECT, 9)
FIELD (Memo, OBJECT, 10)
// array of objects
// ARRAY/1 is reserved for end of array
@@ -197,5 +199,6 @@ FIELD (Template, ARRAY, 5)
FIELD (Necessary, ARRAY, 6)
FIELD (Sufficient, ARRAY, 7)
FIELD (AffectedNodes, ARRAY, 8)
FIELD (Memos, ARRAY, 9)
// vim:ts=4

View File

@@ -832,6 +832,25 @@ const STAmount& STObject::getFieldAmount (SField::ref field) const
return *cf;
}
const STArray& STObject::getFieldArray (SField::ref field) const
{
static STArray empty;
const SerializedType* rf = peekAtPField (field);
if (!rf) throw std::runtime_error ("Field not found");
SerializedTypeID id = rf->getSType ();
if (id == STI_NOTPRESENT) return empty;
const STArray* cf = dynamic_cast<const STArray*> (rf);
if (!cf)
throw std::runtime_error ("Wrong field type");
return *cf;
}
const STPathSet& STObject::getFieldPathSet (SField::ref field) const
{
static STPathSet empty;

View File

@@ -20,6 +20,8 @@
#ifndef RIPPLE_SERIALIZEDOBJECT_H
#define RIPPLE_SERIALIZEDOBJECT_H
class STArray;
class STObject
: public SerializedType
, public CountedObject <STObject>
@@ -197,6 +199,7 @@ public:
const STAmount& getFieldAmount (SField::ref field) const;
const STPathSet& getFieldPathSet (SField::ref field) const;
const STVector256& getFieldV256 (SField::ref field) const;
const STArray& getFieldArray (SField::ref field) const;
void setFieldU8 (SField::ref field, unsigned char);
void setFieldU16 (SField::ref field, uint16);

View File

@@ -100,6 +100,7 @@ void TxFormats::addCommonFields (Item& item)
<< SOElement(sfAccountTxnID, SOE_OPTIONAL)
<< SOElement(sfFee, SOE_REQUIRED)
<< SOElement(sfOperationLimit, SOE_OPTIONAL)
<< SOElement(sfMemos, SOE_OPTIONAL)
<< SOElement(sfSigningPubKey, SOE_REQUIRED)
<< SOElement(sfTxnSignature, SOE_OPTIONAL)
;