Add an information print when there's no blockchain
This commit is contained in:
parent
5b46248ff2
commit
54b6c07b6c
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/boltdb/bolt"
|
"github.com/boltdb/bolt"
|
||||||
|
@ -96,6 +97,7 @@ func NewBlockchain() *Blockchain {
|
||||||
b := tx.Bucket([]byte(blocksBucket))
|
b := tx.Bucket([]byte(blocksBucket))
|
||||||
|
|
||||||
if b == nil {
|
if b == nil {
|
||||||
|
fmt.Println("No existing blockchain found. Creating a new one...")
|
||||||
genesis := NewGenesisBlock()
|
genesis := NewGenesisBlock()
|
||||||
|
|
||||||
b, err := tx.CreateBucket([]byte(blocksBucket))
|
b, err := tx.CreateBucket([]byte(blocksBucket))
|
||||||
|
|
Loading…
Reference in New Issue