diff --git a/cli_send.go b/cli_send.go index 75a5930..67b0091 100644 --- a/cli_send.go +++ b/cli_send.go @@ -22,8 +22,12 @@ func (cli *CLI) send(from, to string, amount int, nodeID string, mineNow bool) { log.Panic(err) } wallet := wallets.GetWallet(from) + if wallet == nil { + fmt.Println("The Address doesn't belongs to you!") + return + } - tx := NewUTXOTransaction(&wallet, to, amount, &UTXOSet) + tx := NewUTXOTransaction(wallet, to, amount, &UTXOSet) if mineNow { cbTx := NewCoinbaseTX(from, "") diff --git a/wallets.go b/wallets.go index 9f376f5..a7d354f 100644 --- a/wallets.go +++ b/wallets.go @@ -49,8 +49,8 @@ func (ws *Wallets) GetAddresses() []string { } // GetWallet returns a Wallet by its address -func (ws Wallets) GetWallet(address string) Wallet { - return *ws.Wallets[address] +func (ws Wallets) GetWallet(address string) *Wallet { + return ws.Wallets[address] } // LoadFromFile loads wallets from the file