From 62e040e9f2820c780ff5f99403d2eb13e3771ac7 Mon Sep 17 00:00:00 2001 From: Dean <44520474+kona3266@users.noreply.github.com> Date: Wed, 14 Jun 2023 22:00:45 +0800 Subject: [PATCH 1/2] Update cli.go fix nodeaddess empty when send coins. --- cli.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cli.go b/cli.go index b597b4c..ae43776 100644 --- a/cli.go +++ b/cli.go @@ -39,6 +39,7 @@ func (cli *CLI) Run() { fmt.Printf("NODE_ID env. var is not set!") os.Exit(1) } + nodeAddress = fmt.Sprintf("localhost:%s", nodeID) getBalanceCmd := flag.NewFlagSet("getbalance", flag.ExitOnError) createBlockchainCmd := flag.NewFlagSet("createblockchain", flag.ExitOnError) From e210c438a9fd3f3cedea3c54c6ebadad52ccd21c Mon Sep 17 00:00:00 2001 From: Dean <44520474+kona3266@users.noreply.github.com> Date: Wed, 14 Jun 2023 22:08:19 +0800 Subject: [PATCH 2/2] fix mine condition in handletx --- server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.go b/server.go index b13f520..eef6c45 100644 --- a/server.go +++ b/server.go @@ -318,7 +318,7 @@ func handleTx(request []byte, bc *Blockchain) { } } } else { - if len(mempool) >= 2 && len(miningAddress) > 0 { + if len(mempool) >= 1 && len(miningAddress) > 0 { MineTransactions: var txs []*Transaction