Add virtualsize computation to mempool
This adds virtualsize to the mempool, which will be used for modifying
the mining/eviction priority of transactions (which matters under conditions
of mempool congestion.)
The virtual size is conceptually the actual transaction/package size with
added fudge factors to represent consumption of other block-limited resources
besides block space. Currently, just SigOps.
In Core, they don't separately track virtual size but rather use virtual size
in place of the size itself. (Core's defines it as:
size_mempool = virtualsize_mempool = max(virtualsize_bip141, sigopscount*20)
We cannot just copy Core here for two important reasons:
- Our sigops limit varies with block size -- see comment in miner.cpp which means if we used virtualsize everywhere then we could generate invalid block templates where it it thought it had more sigops than are actually available. (this problem will be addressed with sigchecks upgrade, where the limit is flat)
- On BCH we avoid sudden changes in basic policy rules, because we want to keep consistent mempool policy. If we changed the min feerate from sat/byte to sat/vbyte this would introduce an easy double spend vector just like if we were to suddenly raise the unconf chain length limit.
(this Diff merely adds the virtualsize computation, which is as-yet unused)
This is an alternative to D4897, with slightly more accurate behaviour for
calculating the virtual size of packages and slightly less memory usage.
(only requires one additional tracking variable -- descendant sigops)
Test Plan: ninja check
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D4906