From ba9d288b2468f047e5a8e4637dd8749e247ff547 Mon Sep 17 00:00:00 2001
From: Fabian Jahr <fjahr@protonmail.com>
Date: Sun, 11 Apr 2021 19:52:10 +0200
Subject: test: Fix getblockstats test data generator

The getblockstats RPC functional test is using previously generated test data that is part of the repository. That test data can be regenerated by running the test file with `--gen-test-data` which invokes the `generate_test_data()` function. That function still relied on the old wallet behavior of having a default wallet to work. Because of this the function was broken and this change fixes this. The fact that this was broken did was not noticed previously because the function is not used by the automated test suite by default.
---
 test/functional/rpc_getblockstats.py | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'test')

diff --git a/test/functional/rpc_getblockstats.py b/test/functional/rpc_getblockstats.py
index 1372cf95da..21fa4392f9 100755
--- a/test/functional/rpc_getblockstats.py
+++ b/test/functional/rpc_getblockstats.py
@@ -43,6 +43,10 @@ class GetblockstatsTest(BitcoinTestFramework):
     def generate_test_data(self, filename):
         mocktime = 1525107225
         self.nodes[0].setmocktime(mocktime)
+        self.nodes[0].createwallet(wallet_name='test')
+        privkey = self.nodes[0].get_deterministic_priv_key().key
+        self.nodes[0].importprivkey(privkey)
+
         self.generate(self.nodes[0], COINBASE_MATURITY + 1)
 
         address = self.nodes[0].get_deterministic_priv_key().address
-- 
cgit v1.2.3