mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-22 11:35:49 +00:00
Compare commits
2 Commits
test-cron-
...
fix-manife
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
684c2ac108 | ||
|
|
4a65401448 |
@@ -471,6 +471,10 @@ ManifestCache::applyManifest(Manifest m)
|
||||
|
||||
auto masterKey = m.masterKey;
|
||||
map_.emplace(std::move(masterKey), std::move(m));
|
||||
|
||||
// Increment sequence to invalidate cached manifest messages
|
||||
seq_++;
|
||||
|
||||
return ManifestDisposition::accepted;
|
||||
}
|
||||
|
||||
|
||||
@@ -1482,9 +1482,13 @@ TxQ::accept(Application& app, OpenView& view)
|
||||
{
|
||||
uint32_t currentTime =
|
||||
view.parentCloseTime().time_since_epoch().count();
|
||||
uint256 klStart = keylet::cron(0, AccountID(beast::zero)).key;
|
||||
uint256 const klEnd =
|
||||
keylet::cron(currentTime + 1, AccountID(beast::zero)).key;
|
||||
bool fixCron = view.rules().enabled(fixCronStacking);
|
||||
std::optional<AccountID> accountID = std::nullopt;
|
||||
if (!fixCron)
|
||||
accountID = AccountID(beast::zero);
|
||||
|
||||
uint256 klStart = keylet::cron(0, accountID).key;
|
||||
uint256 const klEnd = keylet::cron(currentTime + 1, accountID).key;
|
||||
|
||||
std::set<AccountID> cronAccs;
|
||||
|
||||
|
||||
@@ -93,6 +93,16 @@ Cron::doApply()
|
||||
auto& view = ctx_.view();
|
||||
auto const& tx = ctx_.tx;
|
||||
|
||||
if (view.rules().enabled(fixCronStacking))
|
||||
{
|
||||
if (auto const seq = tx.getFieldU32(sfLedgerSequence);
|
||||
seq != view.info().seq)
|
||||
{
|
||||
JLOG(j_.warn()) << "Cron: wrong ledger seq=" << seq;
|
||||
return tefFAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
AccountID const& id = tx.getAccountID(sfOwner);
|
||||
|
||||
auto sle = view.peek(keylet::account(id));
|
||||
|
||||
@@ -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 = 88;
|
||||
static constexpr std::size_t numFeatures = 89;
|
||||
|
||||
/** Amendments that this server supports and the default voting behavior.
|
||||
Whether they are enabled depends on the Rules defined in the validated
|
||||
@@ -376,6 +376,7 @@ extern uint256 const featureIOUIssuerWeakTSH;
|
||||
extern uint256 const featureCron;
|
||||
extern uint256 const fixInvalidTxFlags;
|
||||
extern uint256 const featureExtendedHookState;
|
||||
extern uint256 const fixCronStacking;
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
|
||||
@@ -298,7 +298,7 @@ Keylet
|
||||
uritoken(AccountID const& issuer, Blob const& uri);
|
||||
|
||||
Keylet
|
||||
cron(uint32_t timestamp, AccountID const& id);
|
||||
cron(uint32_t timestamp, std::optional<AccountID> const& id = std::nullopt);
|
||||
|
||||
} // namespace keylet
|
||||
|
||||
|
||||
@@ -482,6 +482,7 @@ REGISTER_FEATURE(IOUIssuerWeakTSH, Supported::yes, VoteBehavior::De
|
||||
REGISTER_FEATURE(Cron, Supported::yes, VoteBehavior::DefaultNo);
|
||||
REGISTER_FIX (fixInvalidTxFlags, Supported::yes, VoteBehavior::DefaultYes);
|
||||
REGISTER_FEATURE(ExtendedHookState, Supported::yes, VoteBehavior::DefaultNo);
|
||||
REGISTER_FIX (fixCronStacking, Supported::yes, VoteBehavior::DefaultYes);
|
||||
|
||||
// The following amendments are obsolete, but must remain supported
|
||||
// because they could potentially get enabled.
|
||||
|
||||
@@ -466,7 +466,7 @@ uritoken(AccountID const& issuer, Blob const& uri)
|
||||
// Examples: 100M → ~5.4e-12, 1B → ~5.4e-11, 10B → ~5.4e-10, 100B → ~5.4e-9
|
||||
// (negligible).
|
||||
Keylet
|
||||
cron(uint32_t timestamp, AccountID const& id)
|
||||
cron(uint32_t timestamp, std::optional<AccountID> const& id)
|
||||
{
|
||||
static const uint256 ns = indexHash(LedgerNameSpace::CRON);
|
||||
|
||||
@@ -481,7 +481,14 @@ cron(uint32_t timestamp, AccountID const& id)
|
||||
h[10] = static_cast<uint8_t>((timestamp >> 8) & 0xFFU);
|
||||
h[11] = static_cast<uint8_t>((timestamp >> 0) & 0xFFU);
|
||||
|
||||
const uint256 accHash = indexHash(LedgerNameSpace::CRON, timestamp, id);
|
||||
if (!id.has_value())
|
||||
{
|
||||
// final 20 bytes are zero
|
||||
std::memset(h + 12, 0, 20);
|
||||
return {ltCRON, uint256::fromVoid(h)};
|
||||
}
|
||||
|
||||
const uint256 accHash = indexHash(LedgerNameSpace::CRON, timestamp, *id);
|
||||
|
||||
// final 20 bytes are account ID
|
||||
std::memcpy(h + 12, accHash.cdata(), 20);
|
||||
|
||||
Reference in New Issue
Block a user