Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Mar 31, 2020

This PR adds a new test for mempool update of transaction descendants/ancestors information (count, size) when transactions have been re-added from a disconnected block to the mempool.

It could be helpful for working on PRs like #17925, #18191.

@DrahtBot DrahtBot added the Tests label Mar 31, 2020
@JeremyRubin
Copy link
Contributor

Concept ACK.

I don't see any reason not to accept this test as is; but it could be nice to:

  1. Make it a bit more generic (e.g., specify a param N rather than writing out each transaction)
  2. Test some more complicated transaction graphs

@hebasto
Copy link
Member Author

hebasto commented Apr 3, 2020

Updated 7ed5558 -> cfaa79b (pr18485.01 -> pr18485.02, diff).

@JeremyRubin

  1. Make it a bit more generic (e.g., specify a param N rather than writing out each transaction)

Done.

  1. Test some more complicated transaction graphs

Done.

@JeremyRubin
Copy link
Contributor

Looks great :)

@hebasto hebasto force-pushed the 20200331-test-mempool branch from cfaa79b to b9156fd Compare April 4, 2020 08:35
@hebasto
Copy link
Member Author

hebasto commented Apr 4, 2020

Updated cfaa79b -> b9156fd (pr18485.02 -> pr18485.03, diff):

  • fixed some flake8 style warnings.

Copy link

@ariard ariard left a comment

Choose a reason for hiding this comment

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

ACK b9156fd

Cool work! It's mostly suggestions to make test clearer, feel free to ignore them.

"""Test mempool descendants/ancestors information update.

Test mempool update of transaction descendants/ancestors information (count, size)
when transactions have been re-added from a disconnected block to the mempool.
Copy link

Choose a reason for hiding this comment

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

Maybe hints directly to UpdateTransactionsFromBlock

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe hints directly to UpdateTransactionsFromBlock

This could be more appropriate for unit tests rather for functional ones, no?

Copy link

Choose a reason for hiding this comment

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

I'm don't have a strong opinon, but sometimes for newcomers is great to lead them directly to what part of the codebase is tested.

def skip_test_if_missing_module(self):
self.skip_if_no_wallet()

def transaction_graph_test(self, size, n_tx_to_mine=None, start_input_txid='', end_address='', fee=Decimal(0.00100000)):
Copy link

Choose a reason for hiding this comment

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

How people should use start_input_txid and end_address ? Do you envision having different helpers each with a specific topology and being able to connect them to test different mempool entry points ? Like a N-fan-out connected to a linear chain ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you envision having different helpers each with a specific topology and being able to connect them to test different mempool entry points ? Like a N-fan-out connected to a linear chain ?

You read my mind :)

Copy link

Choose a reason for hiding this comment

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

Great, will review next ones too!

@hebasto hebasto force-pushed the 20200331-test-mempool branch from b9156fd to 8098dea Compare April 24, 2020 15:19
@hebasto
Copy link
Member Author

hebasto commented Apr 24, 2020

Updated b9156fd -> 8098dea (pr18485.03 -> pr18485.04, diff):

ACK b9156fd

Cool work! It's mostly suggestions to make test clearer, feel free to ignore them.

@ariard
Copy link

ariard commented Apr 24, 2020

ACK 8098dea

@maflcko maflcko merged commit 978c5a2 into bitcoin:master Apr 29, 2020
@hebasto hebasto deleted the 20200331-test-mempool branch April 29, 2020 16:25
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 29, 2020
8098dea test: Add mempool_updatefromblock.py (Hennadii Stepanov)

Pull request description:

  This PR adds a new test for mempool update of transaction descendants/ancestors information (count, size) when transactions have been re-added from a disconnected block to the mempool.

  It could be helpful for working on PRs like bitcoin#17925, bitcoin#18191.

ACKs for top commit:
  ariard:
    ACK 8098dea

Tree-SHA512: 7e808fa8df8d7d7a7dbdc3f79361049b49c7bce9b58fd5539b28c9636bedac747695537e500d7ed68dc8bdb80167ad3f1c01086f7551691405d2ba2e38ef1d06
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Jan 25, 2021
Summary:
This PR adds a new test for mempool update of transaction descendants/ancestors information (count, size) when transactions have been re-added from a disconnected block to the mempool.

This is a backport of Core [[bitcoin/bitcoin#18485 | PR18485]]

Note: on line 110, 'vsize' had to be replaced by 'size' to make the test work for ABC

Test Plan: `test/functional/test_runner.py mempool_upd*`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D9042
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants