Compare commits

..

2 Commits

Author SHA1 Message Date
RichardAH
bbacb6296d Merge branch 'dev' into patch-ctid 2025-04-24 16:38:40 +10:00
Denis Angell
eef47da061 fix: ledger_index 2025-04-24 01:58:41 +02:00
4 changed files with 30 additions and 33 deletions

View File

@@ -1506,13 +1506,15 @@ Transactor::addWeakTSHFromSandbox(detail::ApplyViewBase const& pv)
TER
Transactor::doTSH(
bool strong, // only strong iff true, only weak iff false
std::vector<std::pair<AccountID, bool>> tsh,
hook::HookStateMap& stateMap,
std::vector<hook::HookResult>& results,
std::shared_ptr<STObject const> const& provisionalMeta)
{
auto& view = ctx_.view();
std::vector<std::pair<AccountID, bool>> tsh =
hook::getTransactionalStakeHolders(ctx_.tx, view);
// add the extra TSH marked out by the specific transactor (if applicable)
if (!strong)
for (auto& weakTsh : additionalWeakTSH_)
@@ -1770,9 +1772,6 @@ Transactor::operator()()
// application to the ledger
std::map<AccountID, std::set<uint256>> aawMap;
std::vector<std::pair<AccountID, bool>> tsh =
hook::getTransactionalStakeHolders(ctx_.tx, ctx_.view());
// Pre-application (Strong TSH) Hooks are executed here
// These TSH have the right to rollback.
// Weak TSH and callback are executed post-application.
@@ -1801,7 +1800,7 @@ Transactor::operator()()
// (who have the right to rollback the txn), any weak TSH will be
// executed after doApply has been successful (callback as well)
result = doTSH(true, tsh, stateMap, hookResults, {});
result = doTSH(true, stateMap, hookResults, {});
}
// write state if all chains executed successfully
@@ -2055,7 +2054,7 @@ Transactor::operator()()
hook::HookStateMap stateMap;
std::vector<hook::HookResult> weakResults;
doTSH(false, tsh, stateMap, weakResults, proMeta);
doTSH(false, stateMap, weakResults, proMeta);
// execute any hooks that nominated for 'again as weak'
for (auto const& [accID, hookHashes] : aawMap)

View File

@@ -188,7 +188,6 @@ protected:
TER
doTSH(
bool strong, // only do strong TSH iff true, otheriwse only weak
std::vector<std::pair<AccountID, bool>> tsh,
hook::HookStateMap& stateMap,
std::vector<hook::HookResult>& result,
std::shared_ptr<STObject const> const& provisionalMeta);

View File

@@ -5469,11 +5469,7 @@ class Import_test : public beast::unit_test::suite
// burn 100'000 coins
{
test::jtx::Env env{
*this,
network::makeNetworkVLConfig(21337, keys),
nullptr,
beast::severities::kDisabled,
};
*this, network::makeNetworkVLConfig(21337, keys)};
auto const envCoins = env.current()->info().drops;
BEAST_EXPECT(envCoins == 100'000'000'000'000'000);
@@ -5513,11 +5509,7 @@ class Import_test : public beast::unit_test::suite
// burn all coins
{
test::jtx::Env env{
*this,
network::makeNetworkVLConfig(21337, keys),
nullptr,
beast::severities::kDisabled,
};
*this, network::makeNetworkVLConfig(21337, keys)};
auto const envCoins = env.current()->info().drops;
BEAST_EXPECT(envCoins == 100'000'000'000'000'000);
@@ -5557,11 +5549,7 @@ class Import_test : public beast::unit_test::suite
// burn no coins
{
test::jtx::Env env{
*this,
network::makeNetworkVLConfig(21337, keys),
nullptr,
beast::severities::kDisabled,
};
*this, network::makeNetworkVLConfig(21337, keys)};
auto const envCoins = env.current()->info().drops;
BEAST_EXPECT(envCoins == 100'000'000'000'000'000);

View File

@@ -101,7 +101,8 @@ class Catalogue_test : public beast::unit_test::suite
{
testcase("catalogue_create: Invalid parameters");
using namespace test::jtx;
Env env{*this, envconfig(), features};
Env env{
*this, envconfig(), features, nullptr, beast::severities::kInfo};
// No parameters
{
@@ -176,7 +177,8 @@ class Catalogue_test : public beast::unit_test::suite
using namespace test::jtx;
// Create environment and some test ledgers
Env env{*this, envconfig(), features};
Env env{
*this, envconfig(), features, nullptr, beast::severities::kInfo};
prepareLedgerData(env, 5);
boost::filesystem::path tempDir =
@@ -215,7 +217,8 @@ class Catalogue_test : public beast::unit_test::suite
{
testcase("catalogue_load: Invalid parameters");
using namespace test::jtx;
Env env{*this, envconfig(), features};
Env env{
*this, envconfig(), features, nullptr, beast::severities::kInfo};
// No parameters
{
@@ -262,7 +265,8 @@ class Catalogue_test : public beast::unit_test::suite
using namespace test::jtx;
// Create environment and test data
Env env{*this, envconfig(), features};
Env env{
*this, envconfig(), features, nullptr, beast::severities::kInfo};
prepareLedgerData(env, 5);
// Store some key state information before catalogue creation
@@ -318,7 +322,8 @@ class Catalogue_test : public beast::unit_test::suite
*this,
test::jtx::envconfig(test::jtx::port_increment, 3),
features,
};
nullptr,
beast::severities::kInfo};
// Now load the catalogue
Json::Value params{Json::objectValue};
@@ -513,7 +518,8 @@ class Catalogue_test : public beast::unit_test::suite
return cfg;
}),
features,
};
nullptr,
beast::severities::kInfo};
prepareLedgerData(env1, 5);
// Create catalogue with network ID 123
@@ -538,7 +544,8 @@ class Catalogue_test : public beast::unit_test::suite
return cfg;
}),
features,
};
nullptr,
beast::severities::kInfo};
{
Json::Value params{Json::objectValue};
@@ -561,7 +568,8 @@ class Catalogue_test : public beast::unit_test::suite
using namespace test::jtx;
// Create environment and test data
Env env{*this, envconfig(), features};
Env env{
*this, envconfig(), features, nullptr, beast::severities::kInfo};
prepareLedgerData(env, 3);
boost::filesystem::path tempDir =
@@ -652,7 +660,8 @@ class Catalogue_test : public beast::unit_test::suite
using namespace test::jtx;
// Create environment and test data
Env env{*this, envconfig(), features};
Env env{
*this, envconfig(), features, nullptr, beast::severities::kInfo};
prepareLedgerData(env, 3);
boost::filesystem::path tempDir =
@@ -727,7 +736,8 @@ class Catalogue_test : public beast::unit_test::suite
using namespace test::jtx;
// Create environment and test data
Env env{*this, envconfig(), features};
Env env{
*this, envconfig(), features, nullptr, beast::severities::kInfo};
prepareLedgerData(env, 5);
boost::filesystem::path tempDir =
@@ -816,7 +826,8 @@ class Catalogue_test : public beast::unit_test::suite
using namespace test::jtx;
// Create environment
Env env{*this, envconfig(), features};
Env env{
*this, envconfig(), features, nullptr, beast::severities::kInfo};
boost::filesystem::path tempDir =
boost::filesystem::temp_directory_path() /