diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2014-10-24 15:13:03 -0400 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2014-10-24 15:13:41 -0400 |
commit | e401a2c557ddd1f7cf66df2e62f3324e3b7bcd40 (patch) | |
tree | 9e8b536cc4cfbe1f1a636d3db52b0eb21882c2b6 /qa/rpc-tests/getblocktemplate.py | |
parent | 505a9e1dae8eac680640e7b0dea3c0014351e519 (diff) | |
parent | 2290ed01bc1b4176a0c6b976707bf7dd6bc49f43 (diff) | |
download | bitcoin-e401a2c557ddd1f7cf66df2e62f3324e3b7bcd40.tar.xz |
Merge pull request #5132
2290ed0 Work around #5113. (Daniel Kraft)
dcb9846 Extend getchaintips RPC test. (Daniel Kraft)
Signed-off-by: Gavin Andresen <gavinandresen@gmail.com>
Diffstat (limited to 'qa/rpc-tests/getblocktemplate.py')
-rwxr-xr-x | qa/rpc-tests/getblocktemplate.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/qa/rpc-tests/getblocktemplate.py b/qa/rpc-tests/getblocktemplate.py index 8d97719ec3..5ae5d09601 100755 --- a/qa/rpc-tests/getblocktemplate.py +++ b/qa/rpc-tests/getblocktemplate.py @@ -51,40 +51,40 @@ class GetBlockTemplateTest(BitcoinTestFramework): Test longpolling with getblocktemplate. ''' - def run_test(self, nodes): + def run_test(self): print "Warning: this test will take about 70 seconds in the best case. Be patient." - nodes[0].setgenerate(True, 10) - templat = nodes[0].getblocktemplate() + self.nodes[0].setgenerate(True, 10) + templat = self.nodes[0].getblocktemplate() longpollid = templat['longpollid'] # longpollid should not change between successive invocations if nothing else happens - templat2 = nodes[0].getblocktemplate() + templat2 = self.nodes[0].getblocktemplate() assert(templat2['longpollid'] == longpollid) # Test 1: test that the longpolling wait if we do nothing - thr = LongpollThread(nodes[0]) + thr = LongpollThread(self.nodes[0]) thr.start() # check that thread still lives thr.join(5) # wait 5 seconds or until thread exits assert(thr.is_alive()) # Test 2: test that longpoll will terminate if another node generates a block - nodes[1].setgenerate(True, 1) # generate a block on another node + self.nodes[1].setgenerate(True, 1) # generate a block on another node # check that thread will exit now that new transaction entered mempool thr.join(5) # wait 5 seconds or until thread exits assert(not thr.is_alive()) # Test 3: test that longpoll will terminate if we generate a block ourselves - thr = LongpollThread(nodes[0]) + thr = LongpollThread(self.nodes[0]) thr.start() - nodes[0].setgenerate(True, 1) # generate a block on another node + self.nodes[0].setgenerate(True, 1) # generate a block on another node thr.join(5) # wait 5 seconds or until thread exits assert(not thr.is_alive()) # Test 4: test that introducing a new transaction into the mempool will terminate the longpoll - thr = LongpollThread(nodes[0]) + thr = LongpollThread(self.nodes[0]) thr.start() # generate a random transaction and submit it - (txid, txhex, fee) = random_transaction(nodes, Decimal("1.1"), Decimal("0.0"), Decimal("0.001"), 20) + (txid, txhex, fee) = random_transaction(self.nodes, Decimal("1.1"), Decimal("0.0"), Decimal("0.001"), 20) # after one minute, every 10 seconds the mempool is probed, so in 80 seconds it should have returned thr.join(60 + 20) assert(not thr.is_alive()) |