Page MenuHomePhabricator

[validation/mempool] use Spend/AddCoin instead of UpdateCoins
ClosedPublic

Authored by PiRK on Oct 7 2022, 09:22.

Details

Summary

UpdateCoins is an unnecessary dependency on validation. All we need to
do is add and remove coins to check inputs. We don't need the extra
logic for checking coinbases and handling TxUndos.

Also remove the wrapper function in validation.h which constructs a
throwaway TxUndo object before calling UpdateCoins because it is now
unused.

This is a backport of core#23157 [6/8]
https://github.com/bitcoin/bitcoin/pull/23157/commits/9e8d7ad5d9cc4b013826daead9cee09aad539401

Notes:

  • there was another occurence of the removed UpdateCoins function in the unit test added in rABC880d847f076f7b38c849ce3f31120f2f582a0ba0 . For that case, as the tx is a coinbase transaction (without inputs), UpdateCoins was just calling AddCoins.
  • the removed UpdateCoins function was slighlty modified in D1479 to avoid building an uneccessary CTxUndo

Depends on D12171

Test Plan

ninja all check-all