commit 45b14146a368e03601f5656171e72a55cfb66c30
parent 0f6b4dbcc04668ba3e0e6f7a833bfa12cb812663
Author: Nick <nick@nickfarrow.com>
Date: Fri, 7 Oct 2022 17:20:43 +1100
Merge pull request #105 from kristapsk/test_xpub-no_db
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(