From 46a1654c5a019df9641ec7cddf135caaf32a085e Mon Sep 17 00:00:00 2001 From: Ivan Kuznetsov Date: Sun, 3 Sep 2017 09:56:43 +0700 Subject: [PATCH] Fix blocks adding to the blockchain --- blockchain.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blockchain.go b/blockchain.go index 2290318..b7115b7 100644 --- a/blockchain.go +++ b/blockchain.go @@ -24,7 +24,7 @@ type BlockchainIterator struct { } // AddBlock saves provided data as a block in the blockchain -func (bc *Blockchain) AddBlock(data string) { +func (bc *Blockchain) AddBlock(transactions []*Transaction) { var lastHash []byte err := bc.db.View(func(tx *bolt.Tx) error { @@ -38,7 +38,7 @@ func (bc *Blockchain) AddBlock(data string) { log.Panic(err) } - newBlock := NewBlock(data, lastHash) + newBlock := NewBlock(transactions, lastHash) err = bc.db.Update(func(tx *bolt.Tx) error { b := tx.Bucket([]byte(blocksBucket))