Skip to content

Remove leftover RBF code from BTC - #2297

Merged
UdjinM6 merged 29 commits into
dashpay:developfrom
PastaPastaPasta:remove-rbf
Sep 20, 2018
Merged

UdjinM6 merged 29 commits into
dashpay:developfrom
PastaPastaPasta:remove-rbf

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Member

Removes leftover RBF code from BTC, it doesn't seem like this will create conflicts on backports. If it would create conflicts we can go ahead and close this PR

@UdjinM6

UdjinM6 commented Sep 15, 2018

Copy link
Copy Markdown

There are also few parts in AcceptToMemoryPoolWorker, see setConflicts, allConflicting etc.

@PastaPastaPasta

Copy link
Copy Markdown
Member Author

Builds without error, please re-review @UdjinM6

@UdjinM6 UdjinM6 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks more complete now 👍 but I guess now it's also more likely to have merge conflicts :D

Anyway, see inline comments :)

Comment thread src/validation.cpp Outdated

// This transaction should only count for fee estimation if it isn't a
// BIP 125 replacement transaction (may not be widely supported), the
// This transaction should only count for fee estimation if it the

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: it

Comment thread src/validation.cpp
if (plTxnReplaced)
plTxnReplaced->push_back(it->GetSharedTx());
}
pool.RemoveStaged(allConflicting, false, MemPoolRemovalReason::REPLACED);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also remove MemPoolRemovalReason::REPLACED in txmempool.h.

Comment thread src/init.cpp

nMaxTipAge = GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);

fEnableReplacement = GetBoolArg("-mempoolreplacement", DEFAULT_ENABLE_REPLACEMENT);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove fEnableReplacement in validation.h.

@PastaPastaPasta

Copy link
Copy Markdown
Member Author

@UdjinM6 comments resolved

UdjinM6
UdjinM6 previously approved these changes Sep 16, 2018

@UdjinM6 UdjinM6 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks clean, utACK

nmarley
nmarley previously approved these changes Sep 16, 2018

@nmarley nmarley left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

I found one place where an unused variable is left over and one spelling nit in a comment.

Generally I advise to stay close to the upstream so that we minimize the diff, but this is one case I think would be a good exception. I love that you were able to remove large pieces of code that do not apply to Dash.

Comment thread src/validation.cpp Outdated
hash.ToString(), ptxConflicting->GetHash().ToString()),
REJECT_INVALID, "txlockreq-tx-mempool-conflict");
}
// Transaction conflicts with mempool and RBF doesn't exsist in Dash

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: s/exsist/exist/

Comment thread src/net_processing.cpp Outdated
@@ -2007,7 +2007,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr

std::list<CTransactionRef> lRemovedTxn;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PastaPastaPasta Looks like this unused list can be removed now.

@PastaPastaPasta
PastaPastaPasta dismissed stale reviews from nmarley and UdjinM6 via 612ccb5 September 16, 2018 18:58
@PastaPastaPasta

Copy link
Copy Markdown
Member Author

Resolved @nmarley comments

@UdjinM6 UdjinM6 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

re-utACK

@codablock codablock left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 👍

@UdjinM6 UdjinM6 added this to the 12.4 milestone Sep 20, 2018
@UdjinM6
UdjinM6 merged commit 8ea4010 into dashpay:develop Sep 20, 2018
@PastaPastaPasta
PastaPastaPasta deleted the remove-rbf branch November 4, 2018 17:25
DCG-Claude added a commit to thepastaclaw/dash that referenced this pull request Nov 26, 2026
…chunks against clusters of size 2

7295986 Unit tests for CalculateFeerateDiagramsForRBF (Greg Sanders)
b767e6b test: unit test for ImprovesFeerateDiagram (Greg Sanders)
7e89b65 Add fuzz test for FeeFrac (Greg Sanders)
4d6528a fuzz: fuzz diagram creation and comparison (Greg Sanders)
e9c5aeb test: Add tests for CompareFeerateDiagram and CheckConflictTopology (Greg Sanders)
588a98d fuzz: Add fuzz target for ImprovesFeerateDiagram (Greg Sanders)
2079b80 Implement ImprovesFeerateDiagram (Greg Sanders)
66d966d Add FeeFrac unit tests (Greg Sanders)
ce8e225 Add FeeFrac utils (Greg Sanders)

Pull request description:

  This is a smaller piece of bitcoin#28984 broken off for easier review.

  Up to date explanation of diagram checks are here: https://delvingbitcoin.org/t/mempool-incentive-compatibility/553

  This infrastructure has two near term applications prior to cluster mempool:
  1) Limited Package RBF(bitcoin#28984): We want to allow package RBF only when we know it improves the mempool. This narrowly scoped functionality allows use with v3-like topologies, and will be expanded at some point post-cluster mempool when diagram checks can be done efficiently against bounded cluster sizes.
  2) Replacement for single tx RBF(in a cluster size of up to two) against conflicts of up to cluster size two. `ImprovesFeerateDiagram` interface will have to change for this use-case, which is a future direction to solve certain pins and improve mempool incentive compatibility: https://delvingbitcoin.org/t/ephemeral-anchors-and-mev/383#diagram-checks-fix-this-3

  And longer-term, this would be the proposed way we would compute incentive compatibility for all conflicts, post-cluster mempool.

ACKs for top commit:
  sipa:
    utACK 7295986
  glozow:
    code review ACK 7295986
  murchandamus:
    utACK 7295986
  ismaelsadeeq:
    Re-ACK bitcoin@7295986
  willcl-ark:
    crACK 7295986
  sdaftuar:
    ACK 7295986

Tree-SHA512: 79593e5a087801c06f06cc8b73aa3e7b96ab938d3b90f5d229c4e4bfca887a77b447605c49aa5eb7ddcead85706c534ac5eb6146ae2396af678f4beaaa5bea8e

Dash adaptations:
- src/util/CMakeLists.txt: adds util/feefrac.cpp to bitcoin_util in place of upstream's Makefile.am libbitcoin_util_a_SOURCES entry (Dash builds with CMake)
- src/kernel/CMakeLists.txt: adds ../util/feefrac.cpp to bitcoinkernel in place of upstream's Makefile.am libbitcoinkernel_la_SOURCES entry
- src/test/CMakeLists.txt: adds feefrac_tests.cpp to test_bitcoin in place of upstream's Makefile.test.include BITCOIN_TESTS entry
- src/test/fuzz/CMakeLists.txt: adds feefrac.cpp and feeratediagram.cpp to the fuzz target in place of upstream's Makefile.test.include entries
- src/test/fuzz/feeratediagram.cpp: drops the unused #include <policy/rbf.h>, which Dash does not have; the target only uses util/feefrac.h

Not applicable to Dash (intentionally omitted):
- src/Makefile.am: Dash removed Autotools (partial bitcoin#30664); the same entries are added to the CMakeLists.txt files instead
- src/Makefile.test.include: Dash removed Autotools; the test and fuzz entries are added to src/test/CMakeLists.txt and src/test/fuzz/CMakeLists.txt instead
- src/policy/rbf.cpp: Dash has no RBF (removed in dashpay#2297), so there is nowhere for ImprovesFeerateDiagram to go
- src/policy/rbf.h: Dash has no RBF (removed in dashpay#2297); the ImprovesFeerateDiagram declaration has no home
- src/test/fuzz/rbf.cpp: Dash has no RBF fuzz target; these additions only exercise RBF diagram checks
- src/test/rbf_tests.cpp: Dash has no RBF unit tests; these additions only test RBF diagram checks and mempool conflict topology
- src/txmempool.cpp: CalculateFeerateDiagramsForRBF/CheckConflictTopology only serve RBF replacement, which Dash does not do
- src/txmempool.h: util/feefrac.h include and declarations exist only for the RBF-only mempool functions left out of txmempool.cpp
DCG-Claude added a commit to thepastaclaw/dash that referenced this pull request Nov 26, 2026
ee1b9b2 CalculateFeerateDiagramsForRBF: update misleading description of old diagram contents (Greg Sanders)
a9d42b9 CompareFeerateDiagram: short-circuit comparison when detected as incomparable (Greg Sanders)
cebcced remove erroneous CompareFeerateDiagram comment about slope (Greg Sanders)
a0376e1 unit test: clarify unstated assumption for calc_feerate_diagram_rbf chunking (Greg Sanders)
890cb01 s/effected/affected/ (Greg Sanders)
d9391ec CalculateFeerateDiagramsForRBF: remove size tie-breaking from chunking conflicts (Greg Sanders)
b684d82 fuzz: Add more invariant checks for package_rbf (Greg Sanders)
2a3ada8 fuzz: finer grained ImprovesFeerateDiagram check on error result (Greg Sanders)
c377ae9 unit test: improve ImprovesFeerateDiagram coverage with one less vb case (Greg Sanders)
d2bf923 unit test: make calc_feerate_diagram_rbf less brittle (Greg Sanders)
defe023 fuzz: add PrioritiseTransaction coverage in diagram checks (Greg Sanders)
216d5ff unit test: add coverage showing priority affects diagram check results (Greg Sanders)
a80d809 unit test: add CheckConflictTopology case for not the only child (Greg Sanders)
69bd18c unit test: check tx4 conflict error message (Greg Sanders)
c0c37f0 unit test: have CompareFeerateDiagram tested with diagrams both ways (Greg Sanders)
b62e2c0 ImprovesFeerateDiagram: Spelling fix and removal of unused diagram vectors (Greg Sanders)
bb42402 doc: fix comment about non-existing CompareFeeFrac (Greg Sanders)

Pull request description:

  Follow-ups to bitcoin#29242

ACKs for top commit:
  glozow:
    ACK ee1b9b2, reviewed the changes and package_rbf fuzzer seems to run fine
  murchandamus:
    crACK ee1b9b2
  ismaelsadeeq:
    Code review ACK ee1b9b2
  willcl-ark:
    ACK ee1b9b2

Tree-SHA512: 8399fe12064fb49b0e4c73258968b57be1d9c2e35701b2d3b0bb67e2e4052e44216358238f92508e4697d0fb6176518d5b885474054d3deda242f669e99262a7

Not applicable to Dash (intentionally omitted):
- src/policy/rbf.cpp: Dash has no RBF (removed in dashpay#2297); ImprovesFeerateDiagram was never added (see Dash's bitcoin#29242 backport)
- src/test/fuzz/rbf.cpp: Dash has no RBF fuzz target; the hunk only exercises RBF diagram checks
- src/test/rbf_tests.cpp: Dash has no RBF unit tests; the hunk only tests RBF conflict topology and diagram checks
- src/txmempool.cpp: Edits CalculateFeerateDiagramsForRBF, an RBF-only function Dash deliberately left out when backporting bitcoin#29242
DCG-Claude added a commit to thepastaclaw/dash that referenced this pull request Nov 26, 2026
…pare based on chunks

b22901d Avoid explicitly computing diagram; compare based on chunks (Pieter Wuille)

Pull request description:

  This merges the `BuildDiagramFromChunks` and `CompareFeeRateDiagram` introduced in bitcoin#29242 into a single `CompareChunks` function, which operates on sorted chunk data rather than diagrams, instead computing the diagram on the fly.

  This avoids the need for the construction of an intermediary diagram object, and removes the slightly arbitrary "all diagrams must start at (0, 0)" requirement.

  Not a big deal, but I think the result is a bit cleaner and not really more complicated.

ACKs for top commit:
  glozow:
    reACK b22901d
  instagibbs:
    reACK bitcoin@b22901d

Tree-SHA512: ca37bdf61d9a9cb5435f4da73e97ead33bf65828ad9af49b87336b1ece70db8ced1c21f517fc6eb6d616311c91f3da75ecae6b9bd42547133e3a3c5320b7816d

Not applicable to Dash (intentionally omitted):
- src/policy/rbf.cpp: Dash has no RBF (removed in dashpay#2297); ImprovesFeerateDiagram, which this hunk edits, was left out of Dash's bitcoin#29242 backport
- src/test/fuzz/rbf.cpp: Dash has no RBF fuzz target; the hunk only changes the RBF diagram-check fuzzing
- src/test/rbf_tests.cpp: Dash has no RBF unit tests; the hunk only updates the RBF chunk/diagram checks and conflict-topology tests
- src/txmempool.cpp: Renames CalculateFeerateDiagramsForRBF to CalculateChunksForRBF, an RBF-only function Dash left out on purpose when it backported bitcoin#29242
- src/txmempool.h: Edits the declaration of the RBF-only CalculateFeerateDiagramsForRBF, which Dash never added
DCG-Claude added a commit to thepastaclaw/dash that referenced this pull request Dec 4, 2026
…chunks against clusters of size 2

7295986 Unit tests for CalculateFeerateDiagramsForRBF (Greg Sanders)
b767e6b test: unit test for ImprovesFeerateDiagram (Greg Sanders)
7e89b65 Add fuzz test for FeeFrac (Greg Sanders)
4d6528a fuzz: fuzz diagram creation and comparison (Greg Sanders)
e9c5aeb test: Add tests for CompareFeerateDiagram and CheckConflictTopology (Greg Sanders)
588a98d fuzz: Add fuzz target for ImprovesFeerateDiagram (Greg Sanders)
2079b80 Implement ImprovesFeerateDiagram (Greg Sanders)
66d966d Add FeeFrac unit tests (Greg Sanders)
ce8e225 Add FeeFrac utils (Greg Sanders)

Pull request description:

  This is a smaller piece of bitcoin#28984 broken off for easier review.

  Up to date explanation of diagram checks are here: https://delvingbitcoin.org/t/mempool-incentive-compatibility/553

  This infrastructure has two near term applications prior to cluster mempool:
  1) Limited Package RBF(bitcoin#28984): We want to allow package RBF only when we know it improves the mempool. This narrowly scoped functionality allows use with v3-like topologies, and will be expanded at some point post-cluster mempool when diagram checks can be done efficiently against bounded cluster sizes.
  2) Replacement for single tx RBF(in a cluster size of up to two) against conflicts of up to cluster size two. `ImprovesFeerateDiagram` interface will have to change for this use-case, which is a future direction to solve certain pins and improve mempool incentive compatibility: https://delvingbitcoin.org/t/ephemeral-anchors-and-mev/383#diagram-checks-fix-this-3

  And longer-term, this would be the proposed way we would compute incentive compatibility for all conflicts, post-cluster mempool.

ACKs for top commit:
  sipa:
    utACK 7295986
  glozow:
    code review ACK 7295986
  murchandamus:
    utACK 7295986
  ismaelsadeeq:
    Re-ACK bitcoin@7295986
  willcl-ark:
    crACK 7295986
  sdaftuar:
    ACK 7295986

Tree-SHA512: 79593e5a087801c06f06cc8b73aa3e7b96ab938d3b90f5d229c4e4bfca887a77b447605c49aa5eb7ddcead85706c534ac5eb6146ae2396af678f4beaaa5bea8e

Dash adaptations:
- src/util/CMakeLists.txt: adds util/feefrac.cpp to bitcoin_util in place of upstream's Makefile.am libbitcoin_util_a_SOURCES entry (Dash builds with CMake)
- src/kernel/CMakeLists.txt: adds ../util/feefrac.cpp to bitcoinkernel in place of upstream's Makefile.am libbitcoinkernel_la_SOURCES entry
- src/test/CMakeLists.txt: adds feefrac_tests.cpp to test_bitcoin in place of upstream's Makefile.test.include BITCOIN_TESTS entry
- src/test/fuzz/CMakeLists.txt: adds feefrac.cpp and feeratediagram.cpp to the fuzz target in place of upstream's Makefile.test.include entries
- src/test/fuzz/feeratediagram.cpp: drops the unused #include <policy/rbf.h>, which Dash does not have; the target only uses util/feefrac.h

Not applicable to Dash (intentionally omitted):
- src/Makefile.am: Dash removed Autotools (partial bitcoin#30664); the same entries are added to the CMakeLists.txt files instead
- src/Makefile.test.include: Dash removed Autotools; the test and fuzz entries are added to src/test/CMakeLists.txt and src/test/fuzz/CMakeLists.txt instead
- src/policy/rbf.cpp: Dash has no RBF (removed in dashpay#2297), so there is nowhere for ImprovesFeerateDiagram to go
- src/policy/rbf.h: Dash has no RBF (removed in dashpay#2297); the ImprovesFeerateDiagram declaration has no home
- src/test/fuzz/rbf.cpp: Dash has no RBF fuzz target; these additions only exercise RBF diagram checks
- src/test/rbf_tests.cpp: Dash has no RBF unit tests; these additions only test RBF diagram checks and mempool conflict topology
- src/txmempool.cpp: CalculateFeerateDiagramsForRBF/CheckConflictTopology only serve RBF replacement, which Dash does not do
- src/txmempool.h: util/feefrac.h include and declarations exist only for the RBF-only mempool functions left out of txmempool.cpp
DCG-Claude added a commit to thepastaclaw/dash that referenced this pull request Dec 4, 2026
ee1b9b2 CalculateFeerateDiagramsForRBF: update misleading description of old diagram contents (Greg Sanders)
a9d42b9 CompareFeerateDiagram: short-circuit comparison when detected as incomparable (Greg Sanders)
cebcced remove erroneous CompareFeerateDiagram comment about slope (Greg Sanders)
a0376e1 unit test: clarify unstated assumption for calc_feerate_diagram_rbf chunking (Greg Sanders)
890cb01 s/effected/affected/ (Greg Sanders)
d9391ec CalculateFeerateDiagramsForRBF: remove size tie-breaking from chunking conflicts (Greg Sanders)
b684d82 fuzz: Add more invariant checks for package_rbf (Greg Sanders)
2a3ada8 fuzz: finer grained ImprovesFeerateDiagram check on error result (Greg Sanders)
c377ae9 unit test: improve ImprovesFeerateDiagram coverage with one less vb case (Greg Sanders)
d2bf923 unit test: make calc_feerate_diagram_rbf less brittle (Greg Sanders)
defe023 fuzz: add PrioritiseTransaction coverage in diagram checks (Greg Sanders)
216d5ff unit test: add coverage showing priority affects diagram check results (Greg Sanders)
a80d809 unit test: add CheckConflictTopology case for not the only child (Greg Sanders)
69bd18c unit test: check tx4 conflict error message (Greg Sanders)
c0c37f0 unit test: have CompareFeerateDiagram tested with diagrams both ways (Greg Sanders)
b62e2c0 ImprovesFeerateDiagram: Spelling fix and removal of unused diagram vectors (Greg Sanders)
bb42402 doc: fix comment about non-existing CompareFeeFrac (Greg Sanders)

Pull request description:

  Follow-ups to bitcoin#29242

ACKs for top commit:
  glozow:
    ACK ee1b9b2, reviewed the changes and package_rbf fuzzer seems to run fine
  murchandamus:
    crACK ee1b9b2
  ismaelsadeeq:
    Code review ACK ee1b9b2
  willcl-ark:
    ACK ee1b9b2

Tree-SHA512: 8399fe12064fb49b0e4c73258968b57be1d9c2e35701b2d3b0bb67e2e4052e44216358238f92508e4697d0fb6176518d5b885474054d3deda242f669e99262a7

Not applicable to Dash (intentionally omitted):
- src/policy/rbf.cpp: Dash has no RBF (removed in dashpay#2297); ImprovesFeerateDiagram was never added (see Dash's bitcoin#29242 backport)
- src/test/fuzz/rbf.cpp: Dash has no RBF fuzz target; the hunk only exercises RBF diagram checks
- src/test/rbf_tests.cpp: Dash has no RBF unit tests; the hunk only tests RBF conflict topology and diagram checks
- src/txmempool.cpp: Edits CalculateFeerateDiagramsForRBF, an RBF-only function Dash deliberately left out when backporting bitcoin#29242
DCG-Claude added a commit to thepastaclaw/dash that referenced this pull request Dec 4, 2026
…pare based on chunks

b22901d Avoid explicitly computing diagram; compare based on chunks (Pieter Wuille)

Pull request description:

  This merges the `BuildDiagramFromChunks` and `CompareFeeRateDiagram` introduced in bitcoin#29242 into a single `CompareChunks` function, which operates on sorted chunk data rather than diagrams, instead computing the diagram on the fly.

  This avoids the need for the construction of an intermediary diagram object, and removes the slightly arbitrary "all diagrams must start at (0, 0)" requirement.

  Not a big deal, but I think the result is a bit cleaner and not really more complicated.

ACKs for top commit:
  glozow:
    reACK b22901d
  instagibbs:
    reACK bitcoin@b22901d

Tree-SHA512: ca37bdf61d9a9cb5435f4da73e97ead33bf65828ad9af49b87336b1ece70db8ced1c21f517fc6eb6d616311c91f3da75ecae6b9bd42547133e3a3c5320b7816d

Not applicable to Dash (intentionally omitted):
- src/policy/rbf.cpp: Dash has no RBF (removed in dashpay#2297); ImprovesFeerateDiagram, which this hunk edits, was left out of Dash's bitcoin#29242 backport
- src/test/fuzz/rbf.cpp: Dash has no RBF fuzz target; the hunk only changes the RBF diagram-check fuzzing
- src/test/rbf_tests.cpp: Dash has no RBF unit tests; the hunk only updates the RBF chunk/diagram checks and conflict-topology tests
- src/txmempool.cpp: Renames CalculateFeerateDiagramsForRBF to CalculateChunksForRBF, an RBF-only function Dash left out on purpose when it backported bitcoin#29242
- src/txmempool.h: Edits the declaration of the RBF-only CalculateFeerateDiagramsForRBF, which Dash never added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants