Bug fixes.

This commit is contained in:
JoelKatz
2012-09-27 20:40:34 -07:00
parent 5ab9871fe6
commit b8a84ec83e
3 changed files with 40 additions and 23 deletions

View File

@@ -7,6 +7,10 @@
#include <boost/lexical_cast.hpp>
// These must stay at the top of this file
std::map<int, SField::ptr> SField::codeToField;
boost::mutex SField::mapMutex;
SField sfInvalid(-1), sfGeneric(0);
SField sfLedgerEntry(FIELD_CODE(STI_LEDGERENTRY, 1), STI_LEDGERENTRY, 1, "LedgerEntry");
SField sfTransaction(FIELD_CODE(STI_TRANSACTION, 1), STI_TRANSACTION, 1, "Transaction");
@@ -18,8 +22,6 @@ SField sfValidation(FIELD_CODE(STI_VALIDATION, 1), STI_VALIDATION, 1, "Validatio
#undef FIELD
#undef TYPE
std::map<int, SField::ptr> SField::codeToField;
boost::mutex SField::mapMutex;
SField::ref SField::getField(int code)
{

View File

@@ -1,10 +1,14 @@
#include "LedgerFormats.h"
#define LEF_BASE \
{ sfLedgerEntryType, SOE_REQUIRED }, \
{ sfFlags, SOE_REQUIRED }, \
{ sfLedgerIndex, SOE_OPTIONAL },
LedgerEntryFormat LedgerFormats[]=
{
{ "AccountRoot", ltACCOUNT_ROOT, {
{ sfFlags, SOE_REQUIRED },
{ "AccountRoot", ltACCOUNT_ROOT, { LEF_BASE
{ sfAccount, SOE_REQUIRED },
{ sfSequence, SOE_REQUIRED },
{ sfBalance, SOE_REQUIRED },
@@ -20,7 +24,8 @@ LedgerEntryFormat LedgerFormats[]=
{ sfPublishSize, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "Contract", ltCONTRACT, {
{ "Contract", ltCONTRACT, { LEF_BASE
{ sfLedgerEntryType,SOE_REQUIRED },
{ sfFlags, SOE_REQUIRED },
{ sfAccount, SOE_REQUIRED },
{ sfBalance, SOE_REQUIRED },
@@ -36,25 +41,29 @@ LedgerEntryFormat LedgerFormats[]=
{ sfExpireCode, SOE_REQUIRED },
{ sfInvalid, SOE_END } }
},
{ "DirectoryNode", ltDIR_NODE, {
{ "DirectoryNode", ltDIR_NODE, { LEF_BASE
{ sfLedgerEntryType,SOE_REQUIRED },
{ sfFlags, SOE_REQUIRED },
{ sfIndexes, SOE_REQUIRED },
{ sfIndexNext, SOE_OPTIONAL },
{ sfIndexPrevious, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "GeneratorMap", ltGENERATOR_MAP, {
{ "GeneratorMap", ltGENERATOR_MAP, { LEF_BASE
{ sfLedgerEntryType,SOE_REQUIRED },
{ sfFlags, SOE_REQUIRED },
{ sfGenerator, SOE_REQUIRED },
{ sfInvalid, SOE_END } }
},
{ "Nickname", ltNICKNAME, {
{ "Nickname", ltNICKNAME, { LEF_BASE
{ sfLedgerEntryType,SOE_REQUIRED },
{ sfFlags, SOE_REQUIRED },
{ sfAccount, SOE_REQUIRED },
{ sfMinimumOffer, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "Offer", ltOFFER, {
{ "Offer", ltOFFER, { LEF_BASE
{ sfLedgerEntryType,SOE_REQUIRED },
{ sfFlags, SOE_REQUIRED },
{ sfAccount, SOE_REQUIRED },
{ sfSequence, SOE_REQUIRED },
@@ -68,7 +77,8 @@ LedgerEntryFormat LedgerFormats[]=
{ sfExpiration, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "RippleState", ltRIPPLE_STATE, {
{ "RippleState", ltRIPPLE_STATE, { LEF_BASE
{ sfLedgerEntryType,SOE_REQUIRED },
{ sfFlags, SOE_REQUIRED },
{ sfBalance, SOE_REQUIRED },
{ sfLowID, SOE_REQUIRED },

View File

@@ -1,9 +1,14 @@
#include "TransactionFormats.h"
#define TF_BASE \
{ sfTransactionType, SOE_REQUIRED }, \
{ sfFlags, SOE_REQUIRED }, \
{ sfSignature, SOE_OPTIONAL },
TransactionFormat InnerTxnFormats[]=
{
{ "AccountSet", ttACCOUNT_SET, {
{ "AccountSet", ttACCOUNT_SET, { TF_BASE
{ sfFlags, SOE_REQUIRED },
{ sfSourceTag, SOE_OPTIONAL },
{ sfEmailHash, SOE_OPTIONAL },
@@ -15,7 +20,7 @@ TransactionFormat InnerTxnFormats[]=
{ sfPublishSize, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "Claim", ttCLAIM, {
{ "Claim", ttCLAIM, { TF_BASE
{ sfFlags, SOE_REQUIRED },
{ sfGenerator, SOE_REQUIRED },
{ sfPublicKey, SOE_REQUIRED },
@@ -23,7 +28,7 @@ TransactionFormat InnerTxnFormats[]=
{ sfSourceTag, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "CreditSet", ttCREDIT_SET, {
{ "CreditSet", ttCREDIT_SET, { TF_BASE
{ sfFlags, SOE_REQUIRED },
{ sfDestination, SOE_REQUIRED },
{ sfSourceTag, SOE_OPTIONAL },
@@ -33,7 +38,7 @@ TransactionFormat InnerTxnFormats[]=
{ sfInvalid, SOE_END } }
},
/*
{ "Invoice", ttINVOICE, {
{ "Invoice", ttINVOICE, { TF_BASE
{ sfFlags, SOE_REQUIRED },
{ sfTarget, SOE_REQUIRED },
{ sfAmount, SOE_REQUIRED },
@@ -43,7 +48,7 @@ TransactionFormat InnerTxnFormats[]=
{ sfInvalid, SOE_END } }
},
*/
{ "NicknameSet", ttNICKNAME_SET, {
{ "NicknameSet", ttNICKNAME_SET, { TF_BASE
{ sfFlags, SOE_REQUIRED },
{ sfNickname, SOE_REQUIRED },
{ sfMinimumOffer, SOE_OPTIONAL },
@@ -51,7 +56,7 @@ TransactionFormat InnerTxnFormats[]=
{ sfSourceTag, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "OfferCreate", ttOFFER_CREATE, {
{ "OfferCreate", ttOFFER_CREATE, { TF_BASE
{ sfFlags, SOE_REQUIRED},
{ sfTakerPays, SOE_REQUIRED },
{ sfTakerGets, SOE_REQUIRED },
@@ -59,19 +64,19 @@ TransactionFormat InnerTxnFormats[]=
{ sfExpiration, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "OfferCancel", ttOFFER_CANCEL, {
{ "OfferCancel", ttOFFER_CANCEL, { TF_BASE
{ sfFlags, SOE_REQUIRED },
{ sfOfferSequence, SOE_REQUIRED },
{ sfSourceTag, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "PasswordFund", ttPASSWORD_FUND, {
{ "PasswordFund", ttPASSWORD_FUND, { TF_BASE
{ sfFlags, SOE_REQUIRED },
{ sfDestination, SOE_REQUIRED },
{ sfSourceTag, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "PasswordSet", ttPASSWORD_SET, {
{ "PasswordSet", ttPASSWORD_SET, { TF_BASE
{ sfFlags, SOE_REQUIRED },
{ sfAuthorizedKey, SOE_REQUIRED },
{ sfGenerator, SOE_REQUIRED },
@@ -80,7 +85,7 @@ TransactionFormat InnerTxnFormats[]=
{ sfSourceTag, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "Payment", ttPAYMENT, {
{ "Payment", ttPAYMENT, { TF_BASE
{ sfFlags, SOE_REQUIRED },
{ sfDestination, SOE_REQUIRED },
{ sfAmount, SOE_REQUIRED },
@@ -90,7 +95,7 @@ TransactionFormat InnerTxnFormats[]=
{ sfInvoiceID, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "WalletAdd", ttWALLET_ADD, {
{ "WalletAdd", ttWALLET_ADD, { TF_BASE
{ sfFlags, SOE_REQUIRED },
{ sfAmount, SOE_REQUIRED },
{ sfAuthorizedKey, SOE_REQUIRED },
@@ -99,7 +104,7 @@ TransactionFormat InnerTxnFormats[]=
{ sfSourceTag, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "Contract", ttCONTRACT, {
{ "Contract", ttCONTRACT, { TF_BASE
{ sfFlags, SOE_REQUIRED },
{ sfExpiration, SOE_REQUIRED },
{ sfBondAmount, SOE_REQUIRED },
@@ -111,7 +116,7 @@ TransactionFormat InnerTxnFormats[]=
{ sfExpireCode, SOE_OPTIONAL },
{ sfInvalid, SOE_END } }
},
{ "RemoveContract", ttCONTRACT_REMOVE, {
{ "RemoveContract", ttCONTRACT_REMOVE, { TF_BASE
{ sfFlags, SOE_REQUIRED },
{ sfTarget, SOE_REQUIRED },
{ sfInvalid, SOE_END } }