Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic: runtime error: invalid memory address or nil pointer dereference #26

Open
micolezzz163 opened this issue Mar 19, 2018 · 2 comments

Comments

@micolezzz163
Copy link

blockchain_go send -from 1AmVdDvvQ977oVCpUqz7zAPUEiXKrX5avR -to 1L8SGeGZsLonjfAvh5hKGcocs1dvJMubvn -amount 6 -mine
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1057338]

goroutine 1 [running]:
main.Wallets.GetWallet(...)
/Users/zhengzhixiong/workspace_go/src/blockchain_go/cli_send.go:24
main.(*CLI).send(0xc420053f70, 0x7ffeefbff6d9, 0x22, 0x7ffeefbff700, 0x22, 0x6, 0xc420018018, 0x4, 0x11ca201)
/Users/zhengzhixiong/workspace_go/src/blockchain_go/cli_send.go:24 +0x1cd
main.(*CLI).Run(0xc4200bbf70)
/Users/zhengzhixiong/workspace_go/src/blockchain_go/cli.go:144 +0x711
main.main()
/Users/zhengzhixiong/workspace_go/src/blockchain_go/main.go:5 +0x2b
zhengzhixiongdeMacBook-Pro-4:blockchain_go zhengzhixiong$

@micolezzz163
Copy link
Author

What problem? Please help me to solve it!

@fedeonline
Copy link

fedeonline commented Mar 20, 2018

It seems that you're trying to send money from a nonexistent address.
Try blockchain_go listaddresses to se available addresses in current node's wallet.

You may try to change Wallets.go to check if requested address exists in the wallet and raise error if not found.

// GetWallet returns a Wallet by its address
func (ws Wallets) GetWallet(address string) Wallet {
	wallet := ws.Wallets[address]
	if wallet == nil {
		log.Panic("ERROR: Address not found in your wallet")
	}
	return *wallet
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants