Compare commits

...

1 Commits

Author SHA1 Message Date
Denis Angell
2965d3d96c fix tsh 2025-04-28 12:32:44 +02:00
2 changed files with 7 additions and 5 deletions

View File

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

View File

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