aboutsummaryrefslogtreecommitdiff
path: root/qa/rpc-tests/getblocktemplate.py
diff options
context:
space:
mode:
authorDaniel Kraft <[email protected]>2014-10-20 14:14:04 +0200
committerDaniel Kraft <[email protected]>2014-10-24 08:53:04 +0200
commitdcb98466b4f8193fc28656d17b2317f21665fa3a (patch)
treeaf414ee4e69a16a680ec364ab51c2ac5b7f549c0 /qa/rpc-tests/getblocktemplate.py
parentMerge pull request #5128 (diff)
downloaddiscoin-dcb98466b4f8193fc28656d17b2317f21665fa3a.tar.xz
discoin-dcb98466b4f8193fc28656d17b2317f21665fa3a.zip
Extend getchaintips RPC test.
Add the capability to simulate network splits to the RPC test framework and use it to do more extensive testing of 'getchaintips'.
Diffstat (limited to 'qa/rpc-tests/getblocktemplate.py')
-rwxr-xr-xqa/rpc-tests/getblocktemplate.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/qa/rpc-tests/getblocktemplate.py b/qa/rpc-tests/getblocktemplate.py
index 8d97719ec..5ae5d0960 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())