Skip to content

Expand functional zmq transaction tests - #19507

Merged
laanwj merged 4 commits into
bitcoin:masterfrom
instagibbs:zmq_testing
Aug 31, 2020
Merged

laanwj merged 4 commits into
bitcoin:masterfrom
instagibbs:zmq_testing

Conversation

@instagibbs

@instagibbs instagibbs commented Jul 13, 2020 •

Copy link
Copy Markdown
Member

Tests written to better define what messages are sent when. Also did a bit of refactoring to make sure the exact notification channel ordering doesn't matter.

Confusions below aside, I believe having these more descriptive tests helps describe what behavior we expect from ZMQ notificaitons.

Remaining confusion:

  1. Notification patterns seem to vary wildly with the inclusion of mempool transactions being reorg'ed. See difference between "Add zmq test for transaction pub during reorg" and "Have zmq reorg test cover mempool txns" commits for specifics.
  2. Why does a reorg'ed transaction get announced 3 times? From what I understand it can get announced once for disconnected block, once for mempool entry. What's the third? It occurs a 4th time when included in a block(not added in test)

@DrahtBot DrahtBot added the Tests label Jul 13, 2020
@DrahtBot

DrahtBot commented Jul 14, 2020 •

Copy link
Copy Markdown
Contributor

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

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.

@promag promag 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.

Concept ACK, notifier order still exists but from the client side we don't have to worry about order involving different messages.

With this change we no longer test receiving different messages in the same socket. This could be done in a small test.

# Mining the block with this tx should result in second notification
# after coinbase tx notification
self.nodes[0].generatetoaddress(1, ADDRESS_BCRT1_UNSPENDABLE)
hashtx.receive()

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.

2399a06

Could test coinbase:

-            self.nodes[0].generatetoaddress(1, ADDRESS_BCRT1_UNSPENDABLE)
-            hashtx.receive()
-            txid = hashtx.receive()
-            assert_equal(payment_txid, txid.hex())
+            hash = self.nodes[0].generatetoaddress(1, ADDRESS_BCRT1_UNSPENDABLE)[0]
+            coinbase_txid = self.nodes[0].getblock(hash)['tx'][0]
+            assert_equal(coinbase_txid, hashtx.receive().hex())
+            assert_equal(payment_txid, hashtx.receive().hex())

@laanwj

laanwj commented Jul 22, 2020

Copy link
Copy Markdown
Member

code review ACK 7356292

@promag

promag commented Jul 26, 2020

Copy link
Copy Markdown
Contributor

Code review ACK 7356292.

It occurs a 4th time when included in a block(not added in test yet)

@instagibbs will you update this branch?

@instagibbs

Copy link
Copy Markdown
Member Author

@promag not really no, heh. Removed the "yet" in OP.

@laanwj
laanwj merged commit e796fdd into bitcoin:master Aug 31, 2020
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 3, 2020
…ional test

Summary:
bitcoin/bitcoin@e70512a

---

Depends on D7345

Partial backport of Core [[bitcoin/bitcoin#19507 | PR19507]]

Test Plan:
  test_runner.py interface_zmq

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7346
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 3, 2020
Summary:
bitcoin/bitcoin@2399a06

---

Depends on D7346

Partial backport of Core [[bitcoin/bitcoin#19507 | PR19507]]

Test Plan:
  test_runner.py interface_zmq

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7347
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 3, 2020
Summary:
bitcoin/bitcoin@a0f4f9c

---

note: disconnect_cb variable isn't used in this commit, it is and will
be introduced in the next

Depends on D7347

Partial backport of Core [[bitcoin/bitcoin#19507 | PR19507]]

Test Plan:

  test_runner.py interface_zmq

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7348
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 3, 2020
Summary:
bitcoin/bitcoin@7356292

---

Depends on D7348

Concludes backport of Core [[bitcoin/bitcoin#19507 | PR19507]]

Test Plan:
  test_runner.py interface_zmq

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7349
@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.

4 participants