Page MenuHomePhabricator

validation: don't compute txdata twice
AbandonedPublic

Authored by PiRK on Oct 20 2022, 13:35.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Summary

In D8203, the piece of the previous AcceptToMemoryPoolWorker function that uses txdata was not completely split from PreChecks, unlike in the source material where it was extracted to a separate`PolicyScriptChecks` function.

The way this backport was done lead to txdata being initialized twice in Bitcoin ABC instead of just once (in Bitcoin Core or in the previous Bitcoin ABC code).

This can be optimized by making PreChecks make its txdata available as an output argument to ConsensusScriptChecks instead of having to compute it again in AcceptSingleTransaction.

I ran the benchmarks and found no significant difference in performance before or after this change, for any of the benchs. So this is only about cleaning the code and having the comments in AcceptSingleTransaction make more sense. It will also make more sense when we backport the second commit of core#23381

Test Plan

ninja all check-all