HomePhabricator

[mempool] check ancestor/descendant limits for packages

Description

[mempool] check ancestor/descendant limits for packages

Summary:

[refactor] pass size/count instead of entry to CalculateAncestorsAndCheckLimits

This does not change existing behavior.
The ancestor/descendant limits are inclusive of the entries themselves,
but CalculateAncestorsAndCheckLimits() does not need access to them.

https://github.com/bitcoin/bitcoin/pull/21800/commits/f551841d3ec080a2d7a7988c7b35088dff6c5830


[mempool] check ancestor/descendant limits for packages

When calculating ancestor/descendant counts for transactions in the
package, as a heuristic, count every transaction in the package as an
ancestor and descendant of every other transaction in the package.

This may overestimate, but will not underestimate, the
ancestor/descendant counts. This shortcut still produces an accurate
count for packages of 1 parent + 1 child.

https://github.com/bitcoin/bitcoin/pull/21800/commits/c6e016aa139c8363e9b38bbc1ba0dca55700b8a7


[policy] ancestor/descendant limits for packages

https://github.com/bitcoin/bitcoin/pull/21800/commits/3cd663a5d33aa7ef87994e452bced7f192d021a0


[test] helper function to increase transaction weight

Use our existing pad_tx function.

https://github.com/bitcoin/bitcoin/pull/21800/commits/313c09f7b7beddfdb74c284720d209c81dfdb94f


[test] parameterizable fee for make_chain and create_child_with_parents

https://github.com/bitcoin/bitcoin/pull/21800/commits/2b6b26e57c24d2f0abd442c1c33098e3121572ce


[test] mempool package ancestor/descendant limits

https://github.com/bitcoin/bitcoin/pull/21800/commits/accf3d5868460b4b14ab607fd66ac985b086fbb3

Notes;

  • tx.rehash() replaced with tx.get_id()
  • used helper functions ToHex and FromHex. tx_from_hex is not available due to missing backports.
  • our limit for number of transactions in a package is 50. This leads to some minor logical differences in the tests, because where Core uses 24 transactions (an even number) we use 49 (an odd number). This leads to some asymetric chain transactions branches where the source material has symetric branches, and vice-versa.

This concludes backport of core#21800

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D12162

Details

Provenance
glozow <gloriajzhao@gmail.com>Authored on Jul 15 2021, 06:09
PiRKCommitted on Oct 7 2022, 13:26
PiRKPushed on Oct 7 2022, 13:26
Reviewer
Restricted Project
Differential Revision
D12162: [mempool] check ancestor/descendant limits for packages
Parents
rABCbc86cb45331a: [Cashtab] Equal airdrop distribution ratio option
Branches
Unknown
Tags
Unknown