~ubuntu-branches/debian/sid/bitcoin/sid

« back to all changes in this revision

Viewing changes to qa/rpc-tests/getblocktemplate_longpoll.py

  • Committer: Package Import Robot
  • Author(s): Scott Howard
  • Date: 2015-07-29 15:45:52 UTC
  • mfrom: (1.1.23)
  • Revision ID: package-import@ubuntu.com-20150729154552-p5t8q38o0ekh1f09
Tags: 0.11.0-1
* New upstream release (Closes: #793622)
  - build on all archs, big endian is now supported
* Updated symbols file
* Added bitcoin-cli.1 manpage from contrib/debian/manpages
* Updated debian/copyright

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# Distributed under the MIT software license, see the accompanying
4
4
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
5
 
6
 
from test_framework import BitcoinTestFramework
7
 
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
8
 
from util import *
 
6
from test_framework.test_framework import BitcoinTestFramework
 
7
from test_framework.util import *
9
8
 
10
9
 
11
10
def check_array_result(object_array, to_match, expected):
51
50
 
52
51
    def run_test(self):
53
52
        print "Warning: this test will take about 70 seconds in the best case. Be patient."
54
 
        self.nodes[0].setgenerate(True, 10)
 
53
        self.nodes[0].generate(10)
55
54
        templat = self.nodes[0].getblocktemplate()
56
55
        longpollid = templat['longpollid']
57
56
        # longpollid should not change between successive invocations if nothing else happens
66
65
        assert(thr.is_alive())
67
66
 
68
67
        # Test 2: test that longpoll will terminate if another node generates a block
69
 
        self.nodes[1].setgenerate(True, 1)  # generate a block on another node
 
68
        self.nodes[1].generate(1)  # generate a block on another node
70
69
        # check that thread will exit now that new transaction entered mempool
71
70
        thr.join(5)  # wait 5 seconds or until thread exits
72
71
        assert(not thr.is_alive())
74
73
        # Test 3: test that longpoll will terminate if we generate a block ourselves
75
74
        thr = LongpollThread(self.nodes[0])
76
75
        thr.start()
77
 
        self.nodes[0].setgenerate(True, 1)  # generate a block on another node
 
76
        self.nodes[0].generate(1)  # generate a block on another node
78
77
        thr.join(5)  # wait 5 seconds or until thread exits
79
78
        assert(not thr.is_alive())
80
79