From 18403cd8baa38119e79b58553708293598ffdcdf Mon Sep 17 00:00:00 2001 From: SETKEH Date: Wed, 25 Jul 2018 17:57:58 +1000 Subject: [PATCH] Adding a Basic Check to prevent users sending txn's to themselves and mine padding --- cli_send.go | 5 +++++ 1 file changed, 5 insertions(+) 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}