From 0e08347b535644206ac99a7a54c995a3ce429d51 Mon Sep 17 00:00:00 2001 From: Arunabha Date: Tue, 24 Mar 2026 03:42:41 +0530 Subject: [PATCH] fix: fund wallet before peer connect --- main.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index dd51fd5..c3dc943 100644 --- a/main.py +++ b/main.py @@ -330,6 +330,11 @@ async def on_peer_connected(writer): await network.start(port=port, host=host) + # Fund this node's wallet so it can transact in the demo + if fund > 0: + chain.state.credit_mining_reward(pk, reward=fund) + logger.info("💰 Funded %s... with %d coins", pk[:12], fund) + # Connect to a seed peer if requested if connect_to: try: @@ -338,11 +343,6 @@ async def on_peer_connected(writer): except ValueError: logger.error("Invalid --connect format. Use host:port") - # Fund this node's wallet so it can transact in the demo - if fund > 0: - chain.state.credit_mining_reward(pk, reward=fund) - logger.info("💰 Funded %s... with %d coins", pk[:12], fund) - try: await cli_loop(sk, pk, chain, mempool, network) finally: