Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 2.0 regression in tx method with binary output #4812

Merged
merged 7 commits into from
Nov 16, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/test/rpc/Transaction_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,13 +791,13 @@ class Transaction_test : public beast::unit_test::suite
auto const USD{gw["USD"]};

env.fund(XRP(1000000), alice, gw);
std::shared_ptr<STTx const> txn = env.tx();
std::shared_ptr<STTx const> const txn = env.tx();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, you're calling getTransactionID four times. Why not store it here, and use it at all of the calls?

        uint256 const txID = txn->getTransactionID();

(You'll have to change the lambda capture to get &txID instead of txn.)

BEAST_EXPECT(
to_string(txn->getTransactionID()) ==
"3F8BDE5A5F82C4F4708E5E9255B713E303E6E1A371FD5C7A704AFD1387C23981");
env.close();
std::shared_ptr<STObject const> meta =
env.closed()->txRead(env.tx()->getTransactionID()).second;
env.closed()->txRead(txn->getTransactionID()).second;

std::string const expected_tx_blob = serializeHex(*txn);
std::string const expected_meta_blob = serializeHex(*meta);
Expand Down Expand Up @@ -849,6 +849,9 @@ class Transaction_test : public beast::unit_test::suite
run() override
{
using namespace test::jtx;
test::jtx::forAllApiVersions(
std::bind_front(&Transaction_test::testBinaryRequest, this));

FeatureBitset const all{supported_amendments()};
testWithFeats(all);
}
Expand All @@ -861,8 +864,7 @@ class Transaction_test : public beast::unit_test::suite
testCTIDValidation(features);
testCTIDRPC(features);
test::jtx::forAllApiVersions(
std::bind_front(&Transaction_test::testRequest, this, features),
std::bind_front(&Transaction_test::testBinaryRequest, this));
std::bind_front(&Transaction_test::testRequest, this, features));
}
};

Expand Down