From 125984cd78ccb924cd82dcb454f723cdc25de72b Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Thu, 20 Dec 2012 11:23:01 -0800 Subject: [PATCH] Begin the infrastructure for putting fees in the ledger. --- src/cpp/ripple/LedgerFormats.cpp | 7 +++++++ src/cpp/ripple/LedgerFormats.h | 2 ++ src/cpp/ripple/SerializeProto.h | 4 ++++ src/cpp/ripple/TransactionFormats.cpp | 8 ++++++++ src/cpp/ripple/TransactionFormats.h | 2 ++ 5 files changed, 23 insertions(+) diff --git a/src/cpp/ripple/LedgerFormats.cpp b/src/cpp/ripple/LedgerFormats.cpp index 1e553398aa..ae443179c9 100644 --- a/src/cpp/ripple/LedgerFormats.cpp +++ b/src/cpp/ripple/LedgerFormats.cpp @@ -103,6 +103,13 @@ static bool LEFInit() << SOElement(sfFeatures, SOE_REQUIRED) ; + DECLARE_LEF(FeeSettings, ltFEE_SETTINGS) + << SOElement(sfBaseFee, SOE_REQUIRED) + << SOElement(sfReferenceFeeUnits, SOE_REQUIRED) + << SOElement(sfReserveBase, SOE_REQUIRED) + << SOElement(sfReserveIncrement, SOE_REQUIRED) + ; + return true; } diff --git a/src/cpp/ripple/LedgerFormats.h b/src/cpp/ripple/LedgerFormats.h index 3bc0afb509..e39e7a8945 100644 --- a/src/cpp/ripple/LedgerFormats.h +++ b/src/cpp/ripple/LedgerFormats.h @@ -16,6 +16,7 @@ enum LedgerEntryType ltCONTRACT = 'c', ltLEDGER_HASHES = 'h', ltFEATURES = 'f', + ltFEE_SETTINGS = 's', }; // Used as a prefix for computing ledger indexes (keys). @@ -32,6 +33,7 @@ enum LedgerNameSpace spaceContract = 'c', spaceSkipList = 's', spaceFeature = 'f', + spaceFee = 's', }; enum LedgerSpecificFlags diff --git a/src/cpp/ripple/SerializeProto.h b/src/cpp/ripple/SerializeProto.h index 286cf617f7..e536f9d199 100644 --- a/src/cpp/ripple/SerializeProto.h +++ b/src/cpp/ripple/SerializeProto.h @@ -60,6 +60,9 @@ FIELD(LastLedgerSequence, UINT32, 27) FIELD(TransactionIndex, UINT32, 28) FIELD(OperationLimit, UINT32, 29) + FIELD(ReferenceFeeUnits, UINT32, 30) + FIELD(ReserveBase, UINT32, 31) + FIELD(ReserveIncrement, UINT32, 32) // 64-bit integers FIELD(IndexNext, UINT64, 1) @@ -69,6 +72,7 @@ FIELD(BaseFee, UINT64, 5) FIELD(ExchangeRate, UINT64, 6) + // 128-bit FIELD(EmailHash, HASH128, 1) diff --git a/src/cpp/ripple/TransactionFormats.cpp b/src/cpp/ripple/TransactionFormats.cpp index 6835178922..b428ed7640 100644 --- a/src/cpp/ripple/TransactionFormats.cpp +++ b/src/cpp/ripple/TransactionFormats.cpp @@ -76,6 +76,14 @@ static bool TFInit() << SOElement(sfFeature, SOE_REQUIRED) ; + DECLARE_TF(SetFee, ttFEE) + << SOElement(sfFeatures, SOE_REQUIRED) + << SOElement(sfBaseFee, SOE_REQUIRED) + << SOElement(sfReferenceFeeUnits, SOE_REQUIRED) + << SOElement(sfReserveBase, SOE_REQUIRED) + << SOElement(sfReserveIncrement, SOE_REQUIRED) + ; + return true; } diff --git a/src/cpp/ripple/TransactionFormats.h b/src/cpp/ripple/TransactionFormats.h index a9cab9ba80..602b1fb3e9 100644 --- a/src/cpp/ripple/TransactionFormats.h +++ b/src/cpp/ripple/TransactionFormats.h @@ -6,6 +6,7 @@ enum TransactionType { ttINVALID = -1, + ttPAYMENT = 0, ttCLAIM = 1, // open ttWALLET_ADD = 2, @@ -21,6 +22,7 @@ enum TransactionType ttTRUST_SET = 20, ttFEATURE = 100, + ttFEE = 101, }; class TransactionFormat