Page MenuHomePhabricator

Add virtualsize computation to mempool
ClosedPublic

Authored by markblundeberg on Sun, Jan 12, 05:07.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Commits
rABC622df4ff0609: Add virtualsize computation to mempool
Summary

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)

Depends on D4896 and D4905

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markblundeberg created this revision.Sun, Jan 12, 05:07
Herald added a reviewer: Restricted Project. · View Herald TranscriptSun, Jan 12, 05:07
deadalnix accepted this revision.Sun, Jan 12, 14:56
This revision is now accepted and ready to land.Sun, Jan 12, 14:56