Adding a Basic Check to prevent users sending txn's to themselves and mine padding

This commit is contained in:
SETKEH 2018-07-25 17:57:58 +10:00
parent fee9bfd3af
commit 18403cd8ba
1 changed files with 5 additions and 0 deletions

View File

@ -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}