Skip to content

Commit

Permalink
[fold] Remove dead code and sle rename
Browse files Browse the repository at this point in the history
  • Loading branch information
seelabs committed Jul 10, 2023
1 parent 988c608 commit 800cccc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 92 deletions.
8 changes: 4 additions & 4 deletions src/ripple/app/tx/impl/XChainBridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1773,13 +1773,13 @@ XChainCreateClaimID::preclaim(PreclaimContext const& ctx)

{
// Check reserve
auto const sle = ctx.view.read(keylet::account(account));
if (!sle)
auto const sleAcc = ctx.view.read(keylet::account(account));
if (!sleAcc)
return terNO_ACCOUNT;

auto const balance = (*sle)[sfBalance];
auto const balance = (*sleAcc)[sfBalance];
auto const reserve =
ctx.view.fees().accountReserve((*sle)[sfOwnerCount] + 1);
ctx.view.fees().accountReserve((*sleAcc)[sfOwnerCount] + 1);

if (balance < reserve)
return tecINSUFFICIENT_RESERVE;
Expand Down
88 changes: 0 additions & 88 deletions src/test/app/XChain_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,35 +551,6 @@ struct XChain_test : public beast::unit_test::suite,
XEnv(*this)
.disableFeature(featureXChainBridge)
.tx(create_bridge(mcAlice, jvb), ter(temDISABLED));

// coverage test: An attempt to create many bridge objects until
// we get tecDIR_FULL... but it doesn't seem to happen?
if (0)
{
XEnv env(*this);
for (uint32_t i = 5; i < 4096; ++i)
{
using namespace std::literals;
char curr[20];
snprintf(curr, 20, "%03X", i);
Account door{Account::master};
IOU mcIssue = mcAlice[curr], scIssue = door[curr];
auto jvb{bridge(mcDoor, mcIssue, door, scIssue)};
if (i < 4096)
{
env.tx(create_bridge(Account::master, jvb));
if (i % 64 == 0)
env.close();
assert(env.ter() == tesSUCCESS);
}
else
{
env.tx(
create_bridge(Account::master, jvb), ter(tecDIR_FULL));
break;
}
}
}
}

void
Expand Down Expand Up @@ -2729,51 +2700,6 @@ struct XChain_test : public beast::unit_test::suite,
BEAST_EXPECT(transfer.has_happened(amt, split_reward_quorum));
}

// Coverage test: Don't define signers list on door -> should
// get tecXCHAIN_NO_SIGNERS_LIST. It is not reachable (when I don't
// define a signers list the masterkey flag is set).
// -----------------------------------------------------------------
if (0)
{
XEnv mcEnv(*this);
XEnv scEnv(*this, true);

Account door{scCarol};
IOU mcIssue = mcAlice["USD"], scIssue = door["USD"];
auto jvb{bridge(mcDoor, mcIssue, door, scIssue)};

mcEnv.tx(create_bridge(mcDoor, jvb)).close();

scEnv.tx(create_bridge(door, jvb))
.close()
.tx(xchain_create_claim_id(scAlice, jvb, reward, mcAlice))
.close();

auto dst(std::optional<Account>{scBob});
auto const amt = mcIssue(1000);
std::uint32_t const claimID = 1;
mcEnv.tx(xchain_commit(mcAlice, jvb, claimID, amt, dst)).close();

BalanceTransfer transfer(
scEnv, Account::master, scBob, scAlice, payees, false);

scEnv
.multiTx(
claim_attestations(
scAttester,
jvb,
mcAlice,
amt,
payees,
true,
claimID,
dst,
signers),
ter(tecXCHAIN_NO_SIGNERS_LIST))
.close();
BEAST_EXPECT(transfer.has_not_happened());
}

// Claim with just one attestation signed by the Master key
// => should not succeed
// -----------------------------------------------------------------
Expand Down Expand Up @@ -4402,13 +4328,6 @@ struct XChainSim_test : public beast::unit_test::suite,
accounts[acct].init(env, acct);
}

void
reinit_accounts()
{
for (auto& a : accounts)
init(a.first);
}

void
receive(
jtx::Account const& acct,
Expand Down Expand Up @@ -4527,13 +4446,6 @@ struct XChainSim_test : public beast::unit_test::suite,
b_.init(acct);
}

void
reinit_accounts()
{
a_.reinit_accounts();
b_.reinit_accounts();
}

ChainStateTrack a_;
ChainStateTrack b_;
};
Expand Down

0 comments on commit 800cccc

Please sign in to comment.