diff --git a/cli_send.go b/cli_send.go index 75a59301..b3776ec1 100644 --- a/cli_send.go +++ b/cli_send.go @@ -12,6 +12,11 @@ func (cli *CLI) send(from, to string, amount int, nodeID string, mineNow bool) { if !ValidateAddress(to) { log.Panic("ERROR: Recipient address is not valid") } + if to == from { + log.Panic("ERROR: You cannot send coins to yourself") + } else if from == to { + log.Panic("ERROR: You cannot send coins to yourself") + } bc := NewBlockchain(nodeID) UTXOSet := UTXOSet{bc}