Implement rewards
This commit is contained in:
parent
402b298d4f
commit
56ccd7c8ca
|
@ -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 {
|
||||
|
|
|
@ -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!")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue