Bring README.md and doc.go examples up to date.

Since sqlite is now deprecated, update the examples to use levelb.  Also,
add false to the ProcessBlock calls for the fastAdd parameter.
This commit is contained in:
Dave Collins 2014-01-17 00:48:32 -06:00
parent 84f6089bc9
commit 03394d6309
2 changed files with 5 additions and 5 deletions

View file

@ -82,7 +82,7 @@ intentionally causes an error by attempting to process a duplicate block.
"fmt"
"github.com/conformal/btcchain"
"github.com/conformal/btcdb"
_ "github.com/conformal/btcdb/sqlite3"
_ "github.com/conformal/btcdb/ldb"
"github.com/conformal/btcutil"
"github.com/conformal/btcwire"
"os"
@ -97,7 +97,7 @@ intentionally causes an error by attempting to process a duplicate block.
// database.
dbName := "example.db"
_ = os.Remove(dbName)
db, err := btcdb.CreateDB("sqlite", dbName)
db, err := btcdb.CreateDB("leveldb", dbName)
if err != nil {
fmt.Printf("Failed to create database: %v\n", err)
return
@ -122,7 +122,7 @@ intentionally causes an error by attempting to process a duplicate block.
// Process a block. For this example, we are going to intentionally
// cause an error by trying to process the genesis block which already
// exists.
err = chain.ProcessBlock(genesisBlock)
err = chain.ProcessBlock(genesisBlock, false)
if err != nil {
fmt.Printf("Failed to process block: %v\n", err)
return

4
doc.go
View file

@ -72,7 +72,7 @@ intentionally causes an error by attempting to process a duplicate block.
"fmt"
"github.com/conformal/btcchain"
"github.com/conformal/btcdb"
_ "github.com/conformal/btcdb/sqlite3"
_ "github.com/conformal/btcdb/ldb"
"github.com/conformal/btcutil"
"github.com/conformal/btcwire"
"os"
@ -87,7 +87,7 @@ intentionally causes an error by attempting to process a duplicate block.
// database.
dbName := "example.db"
_ = os.Remove(dbName)
db, err := btcdb.CreateDB("sqlite", dbName)
db, err := btcdb.CreateDB("leveldb", dbName)
if err != nil {
fmt.Printf("Failed to create database: %v\n", err)
return