Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactors for subpackage evaluation #28758

Merged
merged 4 commits into from Nov 3, 2023

Conversation

glozow
Copy link
Member

@glozow glozow commented Oct 31, 2023

This is part of #27463. It splits off the more trivial changes from #26711 for ease of review, as requested in #26711 (comment).

  • Split package sanitization in policy/packages.h into helper functions
  • Rename CheckPackage to IsPackageWellFormed
  • Improve the CreateValidTransaction unit test utility to:
    • Configure the target feerate and return the fee paid
    • Signal BIP125 on transactions to enable RBF tests
    • Allow the specification of multiple inputs and outputs
  • Move CleanupTemporaryCoins into its own function to be reused later without duplication

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 31, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK dergoegge, instagibbs

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #26711 (validate package transactions with their in-package ancestor sets by glozow)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

src/policy/packages.h Outdated Show resolved Hide resolved
src/policy/packages.h Outdated Show resolved Hide resolved
src/policy/packages.h Outdated Show resolved Hide resolved
src/test/txpackage_tests.cpp Outdated Show resolved Hide resolved
glozow and others added 4 commits November 1, 2023 17:21
This allows IsSorted() and IsConsistent() to be used by themselves.
IsSorted() with a precomputed set is used so that we don't create this
set multiple times.
-BEGIN VERIFY SCRIPT-
sed -i 's/CheckPackage(/IsWellFormedPackage(/g' $(git grep -l CheckPackage)
-END VERIFY SCRIPT-
…, signal BIP125

Support the creation of a transaction with multiple specified inputs or
outputs. Also accept a target feerate and return the fee paid.

Also, signal BIP125 by default - a subsequent commit needs to RBF
something.

Co-authored-by: Andrew Chow <achow101@gmail.com>
Avoid duplicate code. This will be used at the end of every
AcceptSubPackage and after PreChecks loop in AcceptPackage.
Copy link
Member Author

@glozow glozow left a comment

Choose a reason for hiding this comment

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

I started going down the path of making Package a class and these member functions, but it touched hundreds of loc and made it really awkward to try to use it within AncestorPackage when we're checking if subsets are sorted

src/policy/packages.h Outdated Show resolved Hide resolved
src/policy/packages.h Outdated Show resolved Hide resolved
src/test/txpackage_tests.cpp Outdated Show resolved Hide resolved
@glozow glozow mentioned this pull request Nov 2, 2023
53 tasks
// This function checks consistency based on inputs, and we can't do that if there are
// no inputs. Duplicate empty transactions are also not consistent with one another.
// This doesn't create false negatives, as unconfirmed transactions are not allowed to
// have no inputs.
Copy link
Member

Choose a reason for hiding this comment

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

“as unconfirmed transactions are not allowed to have no inputs at consensus validation (see CheckTransaction)"

src/policy/packages.h Show resolved Hide resolved
Copy link
Member

@dergoegge dergoegge left a comment

Choose a reason for hiding this comment

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

Code review ACK b5a60ab

nit: the commit message in da9aceb still has the old names

Copy link
Member

@instagibbs instagibbs left a comment

Choose a reason for hiding this comment

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

ACK b5a60ab

@fanquake fanquake merged commit 5d9f450 into bitcoin:master Nov 3, 2023
16 checks passed
@glozow glozow deleted the 2023-10-26711-refactors branch November 3, 2023 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants