14 Commits

Author SHA1 Message Date
Pieter Wuille
2cad5db6f7 Align constant names for maximum compact block / blocktxn depth
Github-Pull: #8637
Rebased-From: 3ac6de0a045cc9b2047ceb19af970e7ffbf905fa
2016-11-20 15:08:16 +01:00
Matt Corallo
76ba1c9739 More agressively filter compact block requests
Unit test adaptations by Pieter Wuille.

Github-Pull: #8637
Rebased-From: fe998e962dc015978f104b782afb7daec3c4d4df
2016-11-20 15:07:53 +01:00
Russell Yanofsky
286e548d87 [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.

Github-Pull: #9058
Rebased-From: 55bfddcabbf9e8a3743f77167ba4a43aaba9f948
2016-11-19 23:55:07 +01:00
Russell Yanofsky
2ba5d78427 [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.

Github-Pull: #9058
Rebased-From: 47e9659ecfbe07077a4564591095bd5510e0f917
2016-11-19 23:53:01 +01:00
Russell Yanofsky
eca9b46537 [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.

Github-Pull: #9159
Rebased-From: dfa44d1b07a6d1022005dba63dd6372739eee8a0
2016-11-19 23:34:58 +01:00
Suhas Daftuar
82905069bf [qa] Test that invalid compactblocks don't result in ban 2016-10-31 10:05:29 -04:00
Matt Corallo
9bb2a02f0d [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.

Github-Pull: #8916
Rebased-From: a4ad37d4ef4bcd81bc9d867b277efdebc86bc2e8
2016-10-17 13:15:30 +02:00
Matt Corallo
df5069bb0e [qa] Send segwit-encoded blocktxn messages in p2p-compactblocks
Github-Pull: #8916
Rebased-From: 032e883b937a6b70d5c367fc2ee57d7eea8cb473
2016-10-17 13:15:11 +02:00
Dagur Valberg Johannsson
cc6f55191a [qa] Fix compact block shortids for a test case
Github-Pull: #8904
Rebased-From: 4cdece40419bcc97345357f9268e03b0aff400b5
2016-10-13 20:35:33 +02:00
Suhas Daftuar
e47299a8f2 [qa] Update p2p-compactblocks.py for compactblocks v2
Github-Pull: #8393
Rebased-From: 27acfc1d2ee53cc52b54befd2d4bfa24a77a2eef
2016-10-13 20:09:31 +02:00
Suhas Daftuar
b73f0653f3 [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.

Github-Pull: #8882
Rebased-From: 6976db2f4687d575e1b4bee5aaf1d93a794f23c3
2016-10-05 11:19:17 +02:00
Suhas Daftuar
624a007f47 [qa] Fix race condition in p2p-compactblocks test
Also fix a bug in the sync_with_ping() helper function

Github-Pull: #8854
Rebased-From: b5fd666984fdb7125cb809c773b36034f32128cc
2016-10-03 10:57:40 +02:00
Suhas Daftuar
cef633ce63 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.

Github-Pull: #8739
Rebased-From: 157254a4bfdfc4ca3ad5bf2d84e82f290bd0c7f2)
2016-09-26 16:49:14 +02:00
Suhas Daftuar
fb8706ebd7 Add p2p test for BIP 152 (compact blocks)
Github-Pull: #8418
Rebased-From: 45c7ddd109465e03551f5b39c2e650c243b4a078
2016-09-26 16:47:11 +02:00