mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-18 09:35:49 +00:00
inital version of touch amendment
This commit is contained in:
@@ -1079,6 +1079,31 @@ Transactor::checkMultiSign(PreclaimContext const& ctx)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// increment the touch counter on an account
|
||||
static void
|
||||
touchAccount(
|
||||
ApplyView& view,
|
||||
AccountID const& id,
|
||||
std::optional<std::shared_ptr<SLE>> sle)
|
||||
{
|
||||
if (!view.rules().enabled(featureTouch))
|
||||
return;
|
||||
|
||||
if (!sle)
|
||||
*sle = view.peek(keylet::account(id));
|
||||
|
||||
if (!(*sle))
|
||||
return;
|
||||
|
||||
uint64_t tc = (*sle)->isFieldPresent(sfTouchCount)
|
||||
? (*sle)->getFieldU64(sfTouchCount)
|
||||
: 0;
|
||||
|
||||
(*sle)->setFieldU64(sfTouchCount, tc + 1);
|
||||
|
||||
view.update(*sle);
|
||||
}
|
||||
|
||||
static void
|
||||
removeUnfundedOffers(
|
||||
ApplyView& view,
|
||||
@@ -1511,6 +1536,8 @@ Transactor::doTSH(
|
||||
if ((!canRollback && strong) || (canRollback && !strong))
|
||||
continue;
|
||||
|
||||
touchAccount(view, tshAccountID, {});
|
||||
|
||||
auto klTshHook = keylet::hook(tshAccountID);
|
||||
|
||||
auto tshHook = view.read(klTshHook);
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace detail {
|
||||
// Feature.cpp. Because it's only used to reserve storage, and determine how
|
||||
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
|
||||
// the actual number of amendments. A LogicError on startup will verify this.
|
||||
static constexpr std::size_t numFeatures = 68;
|
||||
static constexpr std::size_t numFeatures = 69;
|
||||
|
||||
/** Amendments that this server supports and the default voting behavior.
|
||||
Whether they are enabled depends on the Rules defined in the validated
|
||||
@@ -356,6 +356,7 @@ extern uint256 const featureHooksUpdate1;
|
||||
extern uint256 const fixXahauV1;
|
||||
extern uint256 const fixXahauV2;
|
||||
extern uint256 const featureRemit;
|
||||
extern uint256 const featureTouch;
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
|
||||
@@ -433,6 +433,7 @@ extern SF_UINT64 const sfReferenceCount;
|
||||
extern SF_UINT64 const sfRewardAccumulator;
|
||||
extern SF_UINT64 const sfAccountCount;
|
||||
extern SF_UINT64 const sfAccountIndex;
|
||||
extern SF_UINT64 const sfTouchCount;
|
||||
|
||||
// 128-bit
|
||||
extern SF_UINT128 const sfEmailHash;
|
||||
|
||||
@@ -462,6 +462,7 @@ REGISTER_FEATURE(HooksUpdate1, Supported::yes, VoteBehavior::De
|
||||
REGISTER_FIX (fixXahauV1, Supported::yes, VoteBehavior::DefaultNo);
|
||||
REGISTER_FIX (fixXahauV2, Supported::yes, VoteBehavior::DefaultNo);
|
||||
REGISTER_FEATURE(Remit, Supported::yes, VoteBehavior::DefaultNo);
|
||||
REGISTER_FEATURE(Touch, Supported::yes, VoteBehavior::DefaultNo);
|
||||
|
||||
// The following amendments are obsolete, but must remain supported
|
||||
// because they could potentially get enabled.
|
||||
|
||||
@@ -66,6 +66,7 @@ LedgerFormats::LedgerFormats()
|
||||
{sfGovernanceFlags, soeOPTIONAL},
|
||||
{sfGovernanceMarks, soeOPTIONAL},
|
||||
{sfAccountIndex, soeOPTIONAL},
|
||||
{sfTouchCount, soeOPTIONAL},
|
||||
},
|
||||
commonFields);
|
||||
|
||||
|
||||
@@ -183,6 +183,7 @@ CONSTRUCT_TYPED_SFIELD(sfEmitBurden, "EmitBurden", UINT64,
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookInstructionCount, "HookInstructionCount", UINT64, 17);
|
||||
CONSTRUCT_TYPED_SFIELD(sfHookReturnCode, "HookReturnCode", UINT64, 18);
|
||||
CONSTRUCT_TYPED_SFIELD(sfReferenceCount, "ReferenceCount", UINT64, 19);
|
||||
CONSTRUCT_TYPED_SFIELD(sfTouchCount, "TouchCount", UINT64, 97);
|
||||
CONSTRUCT_TYPED_SFIELD(sfAccountIndex, "AccountIndex", UINT64, 98);
|
||||
CONSTRUCT_TYPED_SFIELD(sfAccountCount, "AccountCount", UINT64, 99);
|
||||
CONSTRUCT_TYPED_SFIELD(sfRewardAccumulator, "RewardAccumulator", UINT64, 100);
|
||||
|
||||
Reference in New Issue
Block a user