From 1d3a17b59d90e243e713618536df2b26231d0f72 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 30 Nov 2012 00:12:25 -0800 Subject: [PATCH] Structures for self-descriptive directory nodes. --- src/cpp/ripple/Ledger.h | 4 ++-- src/cpp/ripple/LedgerFormats.cpp | 6 ++++++ src/cpp/ripple/SerializeProto.h | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/cpp/ripple/Ledger.h b/src/cpp/ripple/Ledger.h index d9ddc14cb4..6e9226634a 100644 --- a/src/cpp/ripple/Ledger.h +++ b/src/cpp/ripple/Ledger.h @@ -262,7 +262,7 @@ public: // Directories are doubly linked lists of nodes. // Given a directory root and and index compute the index of a node. - static uint256 getDirNodeIndex(const uint256& uDirRoot, const uint64 uNodeIndex=0); + static uint256 getDirNodeIndex(const uint256& uDirRoot, const uint64 uNodeIndex = 0); // Return a node: root or normal SLE::pointer getDirNode(LedgerStateParms& parms, const uint256& uNodeIndex); @@ -271,7 +271,7 @@ public: // Quality // - static uint256 getQualityIndex(const uint256& uBase, const uint64 uNodeDir=0); + static uint256 getQualityIndex(const uint256& uBase, const uint64 uNodeDir = 0); static uint256 getQualityNext(const uint256& uBase); static uint64 getQuality(const uint256& uBase); diff --git a/src/cpp/ripple/LedgerFormats.cpp b/src/cpp/ripple/LedgerFormats.cpp index 5605cd0413..cbc45dba9c 100644 --- a/src/cpp/ripple/LedgerFormats.cpp +++ b/src/cpp/ripple/LedgerFormats.cpp @@ -46,6 +46,12 @@ static bool LEFInit() ; DECLARE_LEF(DirectoryNode, ltDIR_NODE) + << SOElement(sfOwner, SOE_OPTIONAL) // for owner directories + << SOElement(sfTakerPaysCurrency, SOE_OPTIONAL) // for order book directories + << SOElement(sfTakerPaysIssuer, SOE_OPTIONAL) // for order book directories + << SOElement(sfTakerGetsCurrency, SOE_OPTIONAL) // for order book directories + << SOElement(sfTakerGetsIssuer, SOE_OPTIONAL) // for order book directories + << SOElement(sfExhangeRate, SOE_OPTIONAL) // for order book directories << SOElement(sfIndexes, SOE_REQUIRED) << SOElement(sfRootIndex, SOE_REQUIRED) << SOElement(sfIndexNext, SOE_OPTIONAL) diff --git a/src/cpp/ripple/SerializeProto.h b/src/cpp/ripple/SerializeProto.h index 006abd0282..a10ab314be 100644 --- a/src/cpp/ripple/SerializeProto.h +++ b/src/cpp/ripple/SerializeProto.h @@ -65,6 +65,7 @@ FIELD(BookNode, UINT64, 3) FIELD(OwnerNode, UINT64, 4) FIELD(BaseFee, UINT64, 5) + FIELD(ExchangeRate, UINT64, 6) // 128-bit FIELD(EmailHash, HASH128, 1) @@ -84,6 +85,12 @@ FIELD(InvoiceID, HASH256, 17) FIELD(Nickname, HASH256, 18) + // 160-bit (common) + FIELD(TakerPaysCurrency, HASH160, 1) + FIELD(TakerPaysIssuer, HASH160, 2) + FIELD(TakerGetsCurrency, HASH160, 3) + FIELD(TakerGetsIssuer, HASH160, 4) + // currency amount (common) FIELD(Amount, AMOUNT, 1) FIELD(Balance, AMOUNT, 2)