mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Implement new amendment majority semantics :
This implements the tracking of when an amendment achieved a majority in the ledger, ensuring that there's always network-wide agreement on which amendments have achieved a majority and how long they've held it. * New fields * Change transactor changes * AmendmentTable API and implementation changes * Update amendment enabled status on validated ledgers * Reinstate support for ledger sequence in fee transactions
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/basics/StringUtilities.h>
|
||||
#include <ripple/protocol/Quality.h>
|
||||
#include <ripple/protocol/STArray.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -388,6 +389,37 @@ cdirNext (ReadView const& view,
|
||||
return true;
|
||||
}
|
||||
|
||||
enabledAmendments_t
|
||||
getEnabledAmendments (ReadView const& view)
|
||||
{
|
||||
enabledAmendments_t amendments;
|
||||
auto const sleAmendments = view.read(keylet::amendments());
|
||||
|
||||
if (sleAmendments)
|
||||
{
|
||||
for (auto const &a : sleAmendments->getFieldV256 (sfAmendments))
|
||||
amendments.insert (a);
|
||||
}
|
||||
|
||||
return amendments;
|
||||
}
|
||||
|
||||
majorityAmendments_t
|
||||
getMajorityAmendments (ReadView const& view)
|
||||
{
|
||||
majorityAmendments_t majorities;
|
||||
auto const sleAmendments = view.read(keylet::amendments());
|
||||
|
||||
if (sleAmendments && sleAmendments->isFieldPresent (sfMajorities))
|
||||
{
|
||||
auto const& majArray = sleAmendments->getFieldArray (sfMajorities);
|
||||
for (auto const& m : majArray)
|
||||
majorities[m.getFieldH256 (sfAmendment)] = m.getFieldU32 (sfCloseTime);
|
||||
}
|
||||
|
||||
return majorities;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// Modifiers
|
||||
|
||||
Reference in New Issue
Block a user