Commit graph

22 commits

Author SHA1 Message Date
Matt Corallo 9a0b2f4c5b [qa] Make compact blocks test construction using fetch methods 2017-01-04 15:56:08 -05:00
Suhas Daftuar 813ede91e1 [qa] Update compactblocks test for multi-peer reconstruction 2016-12-15 11:47:04 -05:00
Wladimir J. van der Laan 0c577f2638
Merge #8872: Remove block-request logic from INV message processing
037159c Remove block-request logic from INV message processing (Matt Corallo)
3451203 [qa] Respond to getheaders and do not assume a getdata on inv (Matt Corallo)
d768f15 [qa] Make comptool push blocks instead of relying on inv-fetch (mrbandrews)
2016-11-21 15:41:32 +01:00
Russell Yanofsky dfa44d1b07 [qa] Wait for specific block announcement in p2p-compactblocks
Change check_announcement_of_new_block() to wait specifically for the
announcement of the newly created block, instead of waiting for any
announcement at all. A difficult to reproduce failure in
check_announcement_of_new_block() that happened in a travis build
(https://travis-ci.org/bitcoin/bitcoin/jobs/175198367) might have happened
because an older announcement was mistaken for the expected one. The error
looked like:

  Assertion failed: Failed

  File ".../bitcoin/qa/rpc-tests/test_framework/test_framework.py", line 145, in main
    self.run_test()
  File ".../bitcoin/build/../qa/rpc-tests/p2p-compactblocks.py", line 787, in run_test
    self.test_sendcmpct(self.nodes[1], self.segwit_node, 2, old_node=self.old_node)
  File ".../bitcoin/build/../qa/rpc-tests/p2p-compactblocks.py", line 201, in test_sendcmpct
    check_announcement_of_new_block(node, test_node, lambda p: p.last_cmpctblock is None and p.last_inv is not None)
  File ".../bitcoin/build/../qa/rpc-tests/p2p-compactblocks.py", line 194, in check_announcement_of_new_block
    assert(predicate(peer))

This commit also changes the assertion failed message above to include more
detailed information for debug.
2016-11-14 13:59:20 -05:00
Wladimir J. van der Laan 7977a1157a
Merge #9058: Fixes for p2p-compactblocks.py test timeouts on travis (#8842)
dac53b5 Modify getblocktxn handler not to drop requests for old blocks (Russell Yanofsky)
55bfddc [qa] Fix stale data bug in test_compactblocks_not_at_tip (Russell Yanofsky)
47e9659 [qa] Fix bug in compactblocks v2 merge (Russell Yanofsky)
2016-11-11 11:02:44 +01:00
Matt Corallo 3451203b5c [qa] Respond to getheaders and do not assume a getdata on inv 2016-11-07 17:38:22 -05:00
Russell Yanofsky dac53b58b5 Modify getblocktxn handler not to drop requests for old blocks
The current getblocktxn implementation drops and ignores requests for old
blocks, which causes occasional sync_block timeouts during the
p2p-compactblocks.py test as reported in
https://github.com/bitcoin/bitcoin/issues/8842.

The p2p-compactblocks.py test setup creates many new blocks in a short
period of time, which can lead to getblocktxn requests for blocks below the
hardcoded depth limit of 10 blocks. This commit changes the getblocktxn
handler not to ignore these requests, so the peer nodes in the test setup
will reliably be able to sync.

The protocol change is documented in BIP-152 update "Allow block responses
to getblocktxn requests" at https://github.com/bitcoin/bips/pull/469.

The protocol change is not expected to affect nodes running outside the test
environment, because there shouldn't normally be lots of new blocks being
rapidly added that need to be synced.
2016-11-07 14:35:11 -05:00
Suhas Daftuar c93beac43f [qa] Test that invalid compactblocks don't result in ban 2016-11-03 12:26:37 -04:00
Russell Yanofsky 55bfddcabb [qa] Fix stale data bug in test_compactblocks_not_at_tip
Clear test_node.last_block before requesting blocks in the
compactblocks_not_at_tip test so comparisons won't fail if a blocks were received
before the test started.

The bug doesn't currently cause any problems due to the order tests run, but
this will change in the next commit.
2016-11-02 15:35:11 -04:00
Russell Yanofsky 47e9659ecf [qa] Fix bug in compactblocks v2 merge
Bug caused the wait_for_block_announcement to be called on the wrong node,
leading to nondeterminism and occasional test failures. Bug was introduced in
merge commit:

d075479 Merge #8882: [qa] Fix race conditions in p2p-compactblocks.py and sendheaders.py

Underlying commits which conflicted were:

27acfc1 [qa] Update p2p-compactblocks.py for compactblocks v2
6976db2 [qa] Another attempt to fix race condition in p2p-compactblocks.py

The first commit changed the test_compactblock_construction function signature
and second commit added code which wasn't updated during the merge to use the
new arguments.

Suhas Daftuar <sdaftuar@chaincode.com> noticed the bug and suggested the fix.
2016-11-02 15:35:11 -04:00
Pieter Wuille 3ac6de0a04 Align constant names for maximum compact block / blocktxn depth 2016-10-17 16:46:30 +02:00
Matt Corallo fe998e962d More agressively filter compact block requests
Unit test adaptations by Pieter Wuille.
2016-10-17 16:44:57 +02:00
Matt Corallo a4ad37d4ef [qa] Build v4 blocks in p2p-compactblocktests
This fixes an issue in backporting to 0.13 as 0.13 enforces SF
activation by block version lockin instead of through a hard-coded
block height.
2016-10-15 17:51:05 -04:00
Matt Corallo 032e883b93 [qa] Send segwit-encoded blocktxn messages in p2p-compactblocks 2016-10-14 12:54:15 -04:00
Wladimir J. van der Laan e2a17e43e3
Merge #8904: [qa] Fix compact block shortids for a test case
4cdece4 [qa] Fix compact block shortids for a test case (Dagur Valberg Johannsson)
2016-10-13 18:48:13 +02:00
MarcoFalke d075479969
Merge #8882: [qa] Fix race conditions in p2p-compactblocks.py and sendheaders.py
b55d941 [qa] Fix race condition in sendheaders.py (Suhas Daftuar)
6976db2 [qa] Another attempt to fix race condition in p2p-compactblocks.py (Suhas Daftuar)
2016-10-11 10:50:22 +02:00
Dagur Valberg Johannsson 4cdece4041 [qa] Fix compact block shortids for a test case 2016-10-10 13:37:16 -04:00
Suhas Daftuar 6976db2f46 [qa] Another attempt to fix race condition in p2p-compactblocks.py
sync_with_ping() only guarantees that the node has processed messages
it's received from the peer, not that block announcements from the node have
made it back to the peer.  Replace sync_with_ping() with an explicit check that
the node's tip has been announced.
2016-10-04 15:17:19 -04:00
Suhas Daftuar 27acfc1d2e [qa] Update p2p-compactblocks.py for compactblocks v2 2016-10-04 19:10:49 +02:00
Suhas Daftuar b5fd666984 [qa] Fix race condition in p2p-compactblocks test
Also fix a bug in the sync_with_ping() helper function
2016-09-30 20:54:30 -04:00
Suhas Daftuar 157254a4bf Fix broken sendcmpct test in p2p-compactblocks.py
Python lambda use was incorrect.

sendcmpct messages need to be synchronized with RPC calls to generate().

Headers need to be synced (eg with getheaders) for cmpctblock announcements
to start.

Last test omitted sending a sendcmpct message.
2016-09-15 12:32:53 -04:00
Suhas Daftuar 45c7ddd109 Add p2p test for BIP 152 (compact blocks) 2016-07-29 09:41:58 -04:00