|
4 | 4 | # file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
5 | 5 | """Test longpolling with getblocktemplate."""
|
6 | 6 |
|
7 |
| -from decimal import Decimal |
8 | 7 | import random
|
9 | 8 | import threading
|
10 | 9 |
|
@@ -47,28 +46,25 @@ def run_test(self):
|
47 | 46 | thr.join(5) # wait 5 seconds or until thread exits
|
48 | 47 | assert thr.is_alive()
|
49 | 48 |
|
50 |
| - miniwallets = [MiniWallet(node) for node in self.nodes] |
| 49 | + self.miniwallet = MiniWallet(self.nodes[0]) |
51 | 50 | self.log.info("Test that longpoll will terminate if another node generates a block")
|
52 |
| - self.generate(miniwallets[1], 1) # generate a block on another node |
| 51 | + self.generate(self.nodes[1], 1) # generate a block on another node |
53 | 52 | # check that thread will exit now that new transaction entered mempool
|
54 | 53 | thr.join(5) # wait 5 seconds or until thread exits
|
55 | 54 | assert not thr.is_alive()
|
56 | 55 |
|
57 | 56 | self.log.info("Test that longpoll will terminate if we generate a block ourselves")
|
58 | 57 | thr = LongpollThread(self.nodes[0])
|
59 | 58 | thr.start()
|
60 |
| - self.generate(miniwallets[0], 1) # generate a block on own node |
| 59 | + self.generate(self.nodes[0], 1) # generate a block on own node |
61 | 60 | thr.join(5) # wait 5 seconds or until thread exits
|
62 | 61 | assert not thr.is_alive()
|
63 | 62 |
|
64 | 63 | self.log.info("Test that introducing a new transaction into the mempool will terminate the longpoll")
|
65 | 64 | thr = LongpollThread(self.nodes[0])
|
66 | 65 | thr.start()
|
67 |
| - # generate a random transaction and submit it |
68 |
| - min_relay_fee = self.nodes[0].getnetworkinfo()["relayfee"] |
69 |
| - fee_rate = min_relay_fee + Decimal('0.00000010') * random.randint(0,20) |
70 |
| - miniwallets[0].send_self_transfer(from_node=random.choice(self.nodes), |
71 |
| - fee_rate=fee_rate) |
| 66 | + # generate a transaction and submit it |
| 67 | + self.miniwallet.send_self_transfer(from_node=random.choice(self.nodes)) |
72 | 68 | # after one minute, every 10 seconds the mempool is probed, so in 80 seconds it should have returned
|
73 | 69 | thr.join(60 + 20)
|
74 | 70 | assert not thr.is_alive()
|
|
0 commit comments