Skip to content

policy: allow RBF descendant carveout whenever conflicts exist, not just when number of conflicts == 1 #16819

@fanquake

Description

@fanquake

Comments left over from #16421.

From aj:

Can't we actually cope with merging packages this way too though? If you've got a tx that has parents A, B, C; and that conflicts with tx's X (parent A) and Y (parent B), then beforehand you had:

..., A, X, [children X]
..., B, Y, [children Y]

(maybe some tx's were descendants of both X and Y, but it's worse if there weren't any like that) and afterwards you have:

..., A, tx
..., B, tx

You don't have C in the mempool because that would fail the "replacement-adds-unconfirmed" test later.

So you know tx's ancestor checks pass, because they're actually worked out; you know A,B's ancestor checks pass because they don't change, tx's descendant check is trivial, and you know A,B and all their parent's descendant checks passed, because they did so when X and Y were there -- as far as sizes go, if they were all at their limit, then the max size for tx is the minimum of the descendant sizes of each tx that was replaced.

So I think you could replace the setConflicts.size() == 1 test with:

if (!setConflicts.empty()) {
   auto conflict = setIterConflicting.begin();
   assert(conflict != setIterConflicting.end());
   uint64_t bump = (*conflict)->GetSizeWithDescendants();
   while(++conflict != setIterConflicting.end()) {
       bump = std::min(bump, (*conflict)->GetSizeWithDescendants());
   }
   nLimitDescendants += 1;
   nLimitDescendantSize += bump;
}

From sipa

I haven't thought hard about the effect on potential DoS issues this policy change may have.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions