Skip to content

Prefer emplace to insert in CTxMemPool::addUnchecked for map insertion

Summary

This is a small code quality & performance nit.

By using emplace instead of insert, we avoid the potential creation of temporary objects (the std::pair) on the stack, and instead we constructs the std::pair in-place by passing arguments directly to the final allocated std::pair that lives in the map node.

Test Plan

No semantic or behavioral changes are introduced.

  • ninja all check

Merge request reports