finish fn result refactor (#7947)

This commit is contained in:
pwang200
2026-08-08 23:13:33 -04:00
committed by GitHub
parent 75fac65e27
commit ef438aec26
3 changed files with 77 additions and 28 deletions

View File

@@ -58,14 +58,19 @@ ApplyContext::discard()
std::optional<TxMeta>
ApplyContext::apply(TER ter)
{
if (vmReturnCode_.has_value())
// tecINTERNAL reports an xrpld bug, not a result: nothing the VM recorded
// before we hit it belongs in the metadata.
if (ter != tecINTERNAL)
{
if (vmReturnCode_.has_value())
{
// NOLINTNEXTLINE(bugprone-unchecked-optional-access) view_ emplaced in constructor
view_->setVMReturnCode(*vmReturnCode_);
}
// NOLINTNEXTLINE(bugprone-unchecked-optional-access) view_ emplaced in constructor
view_->setVMReturnCode(*vmReturnCode_);
view_->setGasUsed(gasUsed_);
}
// NOLINTNEXTLINE(bugprone-unchecked-optional-access) view_ emplaced in constructor
view_->setGasUsed(gasUsed_);
// NOLINTNEXTLINE(bugprone-unchecked-optional-access) view_ emplaced in constructor
return view_->apply(base_, tx, ter, parentBatchId_, (flags_ & TapDryRun) != 0u, journal);
}