Fix blocks adding to the blockchain

This commit is contained in:
Ivan Kuznetsov 2017-09-03 09:56:43 +07:00
parent 206f87e265
commit 46a1654c5a
1 changed files with 2 additions and 2 deletions

View File

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