mirror of
https://github.com/XRPLF/rippled.git
synced 2026-08-22 23:00:55 +00:00
Pseudo-accounts to use sequence 0
This commit is contained in:
@@ -884,6 +884,8 @@ ValidNewAccountRoot::visitEntry(
|
||||
{
|
||||
accountsCreated_++;
|
||||
accountSeq_ = (*after)[sfSequence];
|
||||
pseudoAccount_ =
|
||||
after->isFieldPresent(sfAMMID) || after->isFieldPresent(sfVaultID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -912,8 +914,13 @@ ValidNewAccountRoot::finalize(
|
||||
tx.getTxnType() == ttXCHAIN_ADD_ACCOUNT_CREATE_ATTESTATION) &&
|
||||
result == tesSUCCESS)
|
||||
{
|
||||
std::uint32_t const startingSeq{
|
||||
view.rules().enabled(featureDeletableAccounts) ? view.seq() : 1};
|
||||
std::uint32_t const startingSeq = //
|
||||
(pseudoAccount_ &&
|
||||
view.rules().enabled(featureSingleAssetVault)) //
|
||||
? 0 //
|
||||
: view.rules().enabled(featureDeletableAccounts) //
|
||||
? view.seq() //
|
||||
: 1;
|
||||
|
||||
if (accountSeq_ != startingSeq)
|
||||
{
|
||||
|
||||
@@ -438,6 +438,7 @@ class ValidNewAccountRoot
|
||||
{
|
||||
std::uint32_t accountsCreated_ = 0;
|
||||
std::uint32_t accountSeq_ = 0;
|
||||
bool pseudoAccount_ = false;
|
||||
|
||||
public:
|
||||
void
|
||||
|
||||
@@ -1058,8 +1058,16 @@ createPseudoAccount(
|
||||
auto account = std::make_shared<SLE>(keylet::account(accountId));
|
||||
account->setAccountID(sfAccount, accountId);
|
||||
account->setFieldAmount(sfBalance, STAmount{});
|
||||
std::uint32_t const seqno{
|
||||
view.rules().enabled(featureDeletableAccounts) ? view.seq() : 1};
|
||||
|
||||
// Pseudo-accounts can't submit transactions, so set the sequence number
|
||||
// to 0 to make them easier to spot and verify, and add an extra level
|
||||
// of protection.
|
||||
std::uint32_t const seqno = //
|
||||
view.rules().enabled(featureSingleAssetVault) //
|
||||
? 0 //
|
||||
: view.rules().enabled(featureDeletableAccounts) //
|
||||
? view.seq() //
|
||||
: 1;
|
||||
account->setFieldU32(sfSequence, seqno);
|
||||
// Ignore reserves requirement, disable the master key, allow default
|
||||
// rippling, and enable deposit authorization to prevent payments into
|
||||
|
||||
Reference in New Issue
Block a user