Skip to content

test: Fix intermittent issue in mempool_reorg - #28321

Merged
fanquake merged 1 commit into
bitcoin:masterfrom
maflcko:2308-test-less-red-
Aug 24, 2023
Merged

fanquake merged 1 commit into
bitcoin:masterfrom
maflcko:2308-test-less-red-

Conversation

@maflcko

@maflcko maflcko commented Aug 22, 2023

Copy link
Copy Markdown
Member

Currently the test case may fail intermittently, see #28313

Fix this by changing a number and reducing the failure rate a bit.

@DrahtBot

DrahtBot commented Aug 22, 2023 •

Copy link
Copy Markdown
Contributor

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

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK glozow

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

@DrahtBot DrahtBot added the Tests label Aug 22, 2023
@maflcko
maflcko requested a review from glozow August 22, 2023 09:10
@maflcko maflcko added this to the 26.0 milestone Aug 22, 2023
assert_equal(peer1.last_message["tx"].tx.getwtxid(),tx_disconnected["tx"].getwtxid())

self.nodes[1].setmocktime(int(time.time()) + 30)
self.nodes[1].setmocktime(int(time.time()) + 300)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems like due to poisson announcement timer, with a small probability, the announcement hasn't been scheduled yet. A more sure way to fix this is to revert to system time and just wait for the invs:

Suggested change
self.nodes[1].setmocktime(int(time.time()) + 300)
# Reset to system time
self.nodes[1].setmocktime(0)
peer1.wait_for_broadcast([tx_before_reorg["tx"].getwtxid(), tx_child["tx"].getwtxid(), tx_disconnected["tx"].getwtxid()])

(And then delete L97-101)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

wait_for_broadcast has a (default) timeout of 60 seconds, which I can use here, if you don't like the 300.

Other than that, I think it is fine to use mocktime here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh true. I suppose in the very rare scenario that it's a really long time, fastforward + immediately fail is better than waiting 60 seconds and failing. Would prefer 60 over 300 but nbd.

@glozow

glozow commented Aug 22, 2023

Copy link
Copy Markdown
Contributor

Concept ACK, thanks Marco

@glozow glozow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK fa5cc3c

assert_equal(peer1.last_message["tx"].tx.getwtxid(),tx_disconnected["tx"].getwtxid())

self.nodes[1].setmocktime(int(time.time()) + 30)
self.nodes[1].setmocktime(int(time.time()) + 300)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh true. I suppose in the very rare scenario that it's a really long time, fastforward + immediately fail is better than waiting 60 seconds and failing. Would prefer 60 over 300 but nbd.

@fanquake
fanquake merged commit e0ad847 into bitcoin:master Aug 24, 2023
@maflcko
maflcko deleted the 2308-test-less-red- branch August 24, 2023 09:19
Frank-GER pushed a commit to syscoin/syscoin that referenced this pull request Sep 8, 2023
fa5cc3c test: Fix intermittent issue in mempool_reorg (MarcoFalke)

Pull request description:

  Currently the test case may fail intermittently, see bitcoin#28313

  Fix this by changing a number and reducing the failure rate a bit.

ACKs for top commit:
  glozow:
    ACK fa5cc3c

Tree-SHA512: ff552111b434ca712c7dbdc5ba32a986a6fa4512cba5a756234eae69428063bf6ecfdc8f350ee84226ed4d3e4262b4639dbe49162a722e8da85f0d61e5690c51
@bitcoin bitcoin locked and limited conversation to collaborators Aug 23, 2024
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.

4 participants