mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Merge bitcoin/bitcoin#26996: test: Flatten miniwallet array and remove random fee in longpoll
fa0abcdafe
test: Flatten miniwallet array and remove random fee in longpoll (MarcoFalke) Pull request description: * Using a single MiniWallet is enough. * A random fee isn't needed either. ACKs for top commit: theStack: re-ACKfa0abcdafe
Tree-SHA512: 77b99885b3f0d325d067838122114be57ec999ebc82912de6a22c33e2ba28a341c5e053c5bbc424b9922c2616562289a57c7156bd3b431d779182c2e472da59c
This commit is contained in:
commit
710fd571ff
@ -4,7 +4,6 @@
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test longpolling with getblocktemplate."""
|
||||
|
||||
from decimal import Decimal
|
||||
import random
|
||||
import threading
|
||||
|
||||
@ -47,9 +46,9 @@ class GetBlockTemplateLPTest(BitcoinTestFramework):
|
||||
thr.join(5) # wait 5 seconds or until thread exits
|
||||
assert thr.is_alive()
|
||||
|
||||
miniwallets = [MiniWallet(node) for node in self.nodes]
|
||||
self.miniwallet = MiniWallet(self.nodes[0])
|
||||
self.log.info("Test that longpoll will terminate if another node generates a block")
|
||||
self.generate(miniwallets[1], 1) # generate a block on another node
|
||||
self.generate(self.nodes[1], 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()
|
||||
@ -57,18 +56,15 @@ class GetBlockTemplateLPTest(BitcoinTestFramework):
|
||||
self.log.info("Test that longpoll will terminate if we generate a block ourselves")
|
||||
thr = LongpollThread(self.nodes[0])
|
||||
thr.start()
|
||||
self.generate(miniwallets[0], 1) # generate a block on own node
|
||||
self.generate(self.nodes[0], 1) # generate a block on own node
|
||||
thr.join(5) # wait 5 seconds or until thread exits
|
||||
assert not thr.is_alive()
|
||||
|
||||
self.log.info("Test that introducing a new transaction into the mempool will terminate the longpoll")
|
||||
thr = LongpollThread(self.nodes[0])
|
||||
thr.start()
|
||||
# generate a random transaction and submit it
|
||||
min_relay_fee = self.nodes[0].getnetworkinfo()["relayfee"]
|
||||
fee_rate = min_relay_fee + Decimal('0.00000010') * random.randint(0,20)
|
||||
miniwallets[0].send_self_transfer(from_node=random.choice(self.nodes),
|
||||
fee_rate=fee_rate)
|
||||
# generate a transaction and submit it
|
||||
self.miniwallet.send_self_transfer(from_node=random.choice(self.nodes))
|
||||
# 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()
|
||||
|
Loading…
Reference in New Issue
Block a user