commit eaaf1193e2a51c9c8c879def80c2cde32d99c678
parent 0d4da49f20d8004bfb615b53da3d285e08725156
Author: Kristaps Kaupe <kristaps@blogiem.lv>
Date: Wed, 5 Oct 2022 21:06:56 +0300
Don't require database for xpub tests
Diffstat:
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/node/xpub.py b/node/xpub.py
@@ -15,22 +15,23 @@ class xpub:
self.config = node_config
self.api = "https://mempool.space/api"
- next_n = self.get_next_address_index(self.config["xpub"])
- # Warning will be printed for production runs, but not when running tests.
- if next_n == 0 and "pytest" not in sys.modules:
- logging.info(
- "Deriving addresses for first time from xpub: {}".format(
- self.config["xpub"]
+ if "pytest" not in sys.modules:
+ next_n = self.get_next_address_index(self.config["xpub"])
+ # Warning will be printed for production runs, but not when running tests.
+ if next_n == 0:
+ logging.info(
+ "Deriving addresses for first time from xpub: {}".format(
+ self.config["xpub"]
+ )
)
- )
- logging.warn(
- "YOU MUST CHECK THIS MATCHES THE FIRST ADDRESS IN YOUR WALLET:"
- )
- logging.warn(self.get_address_at_index(next_n))
- time.sleep(10)
+ logging.warn(
+ "YOU MUST CHECK THIS MATCHES THE FIRST ADDRESS IN YOUR WALLET:"
+ )
+ logging.warn(self.get_address_at_index(next_n))
+ time.sleep(10)
- logging.info("Fetching blockchain info from {}".format(self.api))
- logging.info("Next address shown to users is #{}".format(next_n))
+ logging.info("Fetching blockchain info from {}".format(self.api))
+ logging.info("Next address shown to users is #{}".format(next_n))
def create_qr(self, uuid, address, value):
qr_str = "bitcoin:{}?amount={}&label={}".format(