Skip to content

Commit

Permalink
[fold] address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcobb23 committed Apr 29, 2020
1 parent 8100770 commit 2590960
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/ripple/rpc/handlers/AccountTx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ populateProtoResponse(
if (txnMeta)
{
RPC::convert(*txnProto->mutable_meta(), txnMeta);
if (!txnMeta->hasDeliveredAmount())
if (!txnProto->meta().has_delivered_amount())
{
if (auto amt = getDeliveredAmount(
context,
Expand Down
73 changes: 35 additions & 38 deletions src/test/rpc/Tx_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ class Tx_test : public beast::unit_test::suite
};

auto grpcAccountTx = [&grpcPort](
uint256 const& hash,
uint256 const& id,
auto binary,
AccountID const& account) {
GrpcAccountTxClient client(grpcPort);
Expand All @@ -559,7 +559,7 @@ class Tx_test : public beast::unit_test::suite

for (auto tx : client.reply.transactions())
{
if (uint256::fromVoid(tx.hash().data()) == hash)
if (uint256::fromVoid(tx.hash().data()) == id)
{
return std::
pair<bool, org::xrpl::rpc::v1::GetTransactionResponse>(
Expand Down Expand Up @@ -716,45 +716,42 @@ class Tx_test : public beast::unit_test::suite
cmpPaymentTx(result.second.transaction(), tx);
}

if (ledger && !b)
{
auto rawMeta = ledger->txRead(id).second;
if (rawMeta)
{
auto txMeta = std::make_shared<TxMeta>(
id, ledger->seq(), *rawMeta);
if (not ledger or b)
continue;

cmpMeta(result.second.meta(), txMeta);
cmpDeliveredAmount(
result.second.meta(),
result.second.transaction(),
txMeta,
tx);
auto rawMeta = ledger->txRead(id).second;
if (not rawMeta)
continue;

// Compare result to result from account_tx
auto mentioned = tx->getMentionedAccounts();
auto txMeta =
std::make_shared<TxMeta>(id, ledger->seq(), *rawMeta);

if (BEAST_EXPECT(mentioned.size()))
{
auto a = *mentioned.begin();
auto const accountTxResult =
grpcAccountTx(id, b, a);

BEAST_EXPECT(accountTxResult.first);
if (accountTxResult.first)
{
cmpPaymentTx(
accountTxResult.second.transaction(), tx);
cmpMeta(accountTxResult.second.meta(), txMeta);
cmpDeliveredAmount(
accountTxResult.second.meta(),
accountTxResult.second.transaction(),
txMeta,
tx);
}
}
}
}
cmpMeta(result.second.meta(), txMeta);
cmpDeliveredAmount(
result.second.meta(),
result.second.transaction(),
txMeta,
tx);

// Compare result to result from account_tx
auto mentioned = tx->getMentionedAccounts();

if (not BEAST_EXPECT(mentioned.size()))
continue;

auto account = *mentioned.begin();
auto const accountTxResult = grpcAccountTx(id, b, account);

if (not BEAST_EXPECT(accountTxResult.first))
continue;

cmpPaymentTx(accountTxResult.second.transaction(), tx);
cmpMeta(accountTxResult.second.meta(), txMeta);
cmpDeliveredAmount(
accountTxResult.second.meta(),
accountTxResult.second.transaction(),
txMeta,
tx);
}
index++;
}
Expand Down

0 comments on commit 2590960

Please sign in to comment.