Changeset View
Changeset View
Standalone View
Standalone View
qa/rpc-tests/getblocktemplate_longpoll.py
Show All 26 Lines | |||||
class GetBlockTemplateLPTest(BitcoinTestFramework): | class GetBlockTemplateLPTest(BitcoinTestFramework): | ||||
''' | ''' | ||||
Test longpolling with getblocktemplate. | Test longpolling with getblocktemplate. | ||||
''' | ''' | ||||
def __init__(self): | def __init__(self): | ||||
super().__init__() | super().__init__() | ||||
self.num_nodes = 4 | self.num_nodes = 2 | ||||
self.setup_clean_chain = False | self.setup_clean_chain = False | ||||
def run_test(self): | def run_test(self): | ||||
self.log.info( | self.log.info( | ||||
"Warning: this test will take about 70 seconds in the best case. Be patient.") | "Warning: this test will take about 70 seconds in the best case. Be patient.") | ||||
self.nodes[0].generate(10) | self.nodes[0].generate(10) | ||||
templat = self.nodes[0].getblocktemplate() | templat = self.nodes[0].getblocktemplate() | ||||
longpollid = templat['longpollid'] | longpollid = templat['longpollid'] | ||||
Show All 35 Lines | def run_test(self): | ||||
# generate a random transaction and submit it | # generate a random transaction and submit it | ||||
(txid, txhex, fee) = random_transaction(self.nodes, | (txid, txhex, fee) = random_transaction(self.nodes, | ||||
Decimal("1.1"), Decimal("0.0"), Decimal("0.001"), 20) | Decimal("1.1"), Decimal("0.0"), Decimal("0.001"), 20) | ||||
# after one minute, every 10 seconds the mempool is probed, so in 80 | # after one minute, every 10 seconds the mempool is probed, so in 80 | ||||
# seconds it should have returned | # seconds it should have returned | ||||
thr.join(60 + 20) | thr.join(60 + 20) | ||||
assert(not thr.is_alive()) | assert(not thr.is_alive()) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
GetBlockTemplateLPTest().main() | GetBlockTemplateLPTest().main() |