aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_maxuploadtarget.py
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2022-03-11 16:09:54 +0100
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2022-03-11 16:14:48 +0100
commitaab552fa3073f27bcedee1d5890e7e8d9e67ffb4 (patch)
tree64b398960f9abd6c792fa7506353dc92638925ab /test/functional/feature_maxuploadtarget.py
parent23e8c702bc95459861183cd9eb927272494a79ca (diff)
downloadbitcoin-aab552fa3073f27bcedee1d5890e7e8d9e67ffb4.tar.xz
test: use MiniWallet for feature_maxuploadtarget.py
This test can now be run even with the Bitcoin Core wallet disabled.
Diffstat (limited to 'test/functional/feature_maxuploadtarget.py')
-rwxr-xr-xtest/functional/feature_maxuploadtarget.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/test/functional/feature_maxuploadtarget.py b/test/functional/feature_maxuploadtarget.py
index 24f79dda67..0b9d651226 100755
--- a/test/functional/feature_maxuploadtarget.py
+++ b/test/functional/feature_maxuploadtarget.py
@@ -13,10 +13,19 @@ if uploadtarget has been reached.
from collections import defaultdict
import time
-from test_framework.messages import CInv, MSG_BLOCK, msg_getdata
+from test_framework.messages import (
+ CInv,
+ MSG_BLOCK,
+ msg_getdata,
+)
from test_framework.p2p import P2PInterface
from test_framework.test_framework import BitcoinTestFramework
-from test_framework.util import assert_equal, mine_large_block
+from test_framework.util import (
+ assert_equal,
+ mine_large_block,
+)
+from test_framework.wallet import MiniWallet
+
class TestP2PConn(P2PInterface):
def __init__(self):
@@ -41,12 +50,6 @@ class MaxUploadTest(BitcoinTestFramework):
]]
self.supports_cli = False
- # Cache for utxos, as the listunspent may take a long time later in the test
- self.utxo_cache = []
-
- def skip_test_if_missing_module(self):
- self.skip_if_no_wallet()
-
def run_test(self):
# Before we connect anything, we first set the time on the node
# to be in the past, otherwise things break because the CNode
@@ -55,7 +58,8 @@ class MaxUploadTest(BitcoinTestFramework):
self.nodes[0].setmocktime(old_time)
# Generate some old blocks
- self.generate(self.nodes[0], 130)
+ self.wallet = MiniWallet(self.nodes[0])
+ self.generate(self.wallet, 130)
# p2p_conns[0] will only request old blocks
# p2p_conns[1] will only request new blocks
@@ -66,7 +70,7 @@ class MaxUploadTest(BitcoinTestFramework):
p2p_conns.append(self.nodes[0].add_p2p_connection(TestP2PConn()))
# Now mine a big block
- mine_large_block(self, self.nodes[0], self.utxo_cache)
+ mine_large_block(self, self.wallet, self.nodes[0])
# Store the hash; we'll request this later
big_old_block = self.nodes[0].getbestblockhash()
@@ -77,7 +81,7 @@ class MaxUploadTest(BitcoinTestFramework):
self.nodes[0].setmocktime(int(time.time()) - 2*60*60*24)
# Mine one more block, so that the prior block looks old
- mine_large_block(self, self.nodes[0], self.utxo_cache)
+ mine_large_block(self, self.wallet, self.nodes[0])
# We'll be requesting this new block too
big_new_block = self.nodes[0].getbestblockhash()