diff --git a/blockchain.go b/blockchain.go index e2579fe..543ddc2 100644 --- a/blockchain.go +++ b/blockchain.go @@ -270,6 +270,10 @@ func (bc *Blockchain) SignTransaction(tx *Transaction, privKey ecdsa.PrivateKey) // VerifyTransaction verifies transaction input signatures func (bc *Blockchain) VerifyTransaction(tx *Transaction) bool { + if tx.IsCoinbase() { + return true + } + prevTXs := make(map[string]Transaction) for _, vin := range tx.Vin { diff --git a/cli_send.go b/cli_send.go index fb8117c..fea84d8 100644 --- a/cli_send.go +++ b/cli_send.go @@ -17,6 +17,9 @@ func (cli *CLI) send(from, to string, amount int) { defer bc.db.Close() tx := NewUTXOTransaction(from, to, amount, bc) - bc.MineBlock([]*Transaction{tx}) + cbTx := NewCoinbaseTX(from, "") + txs := []*Transaction{cbTx, tx} + + bc.MineBlock(txs) fmt.Println("Success!") }