From 9b15c88b0e5f33bd1d29af64c39e034e0d63da37 Mon Sep 17 00:00:00 2001 From: Scott Schurr Date: Thu, 13 Aug 2015 15:13:23 -0700 Subject: [PATCH] Make Rules available outside of Transactors (RIPD-182): Allows multisign to be enabled with a Feature. --- src/ripple/app/ledger/LedgerMaster.h | 3 +++ src/ripple/app/ledger/impl/LedgerMaster.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/ripple/app/ledger/LedgerMaster.h b/src/ripple/app/ledger/LedgerMaster.h index 2ef28b7148..14024fa951 100644 --- a/src/ripple/app/ledger/LedgerMaster.h +++ b/src/ripple/app/ledger/LedgerMaster.h @@ -81,6 +81,9 @@ public: // The validated ledger is the last fully validated ledger virtual Ledger::pointer getValidatedLedger () = 0; + // The Rules are in the last fully validated ledger if there is one. + virtual Rules getValidatedRules() = 0; + // This is the last ledger we published to clients and can lag the validated // ledger virtual Ledger::ref getPublishedLedger () = 0; diff --git a/src/ripple/app/ledger/impl/LedgerMaster.cpp b/src/ripple/app/ledger/impl/LedgerMaster.cpp index 4e01925ffa..0fac61325f 100644 --- a/src/ripple/app/ledger/impl/LedgerMaster.cpp +++ b/src/ripple/app/ledger/impl/LedgerMaster.cpp @@ -1376,6 +1376,18 @@ public: return mValidLedger.get (); } + Rules getValidatedRules () + { + // Once we have a guarantee that there's always a last validated + // ledger then we can dispense with the if. + + // Return the Rules from the last validated ledger. + if (auto const ledger = getValidatedLedger()) + return ledger->rules(); + + return Rules(); + } + // This is the last ledger we published to clients and can lag the validated // ledger. Ledger::ref getPublishedLedger ()