From b0b090009a7037c05b4c74899aa57b11cc5e3349 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 28 May 2014 00:55:22 -0500 Subject: [PATCH] Update README.md for btcnet changes. The sample code in doc.go was updated for the recent btcnet changes, however the sample code in the README.md was not. --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f80ed381..67d9711b 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,8 @@ intentionally causes an error by attempting to process a duplicate block. "github.com/conformal/btcchain" "github.com/conformal/btcdb" _ "github.com/conformal/btcdb/ldb" + "github.com/conformal/btcnet" "github.com/conformal/btcutil" - "github.com/conformal/btcwire" "os" ) @@ -95,20 +95,20 @@ intentionally causes an error by attempting to process a duplicate block. // calls to os.Remove would not be used either, but again, we want // a complete working example here, so we make sure to remove the // database. - dbName := "example.db" - _ = os.Remove(dbName) + dbName := "exampledb" + _ = os.RemoveAll(dbName) db, err := btcdb.CreateDB("leveldb", dbName) if err != nil { fmt.Printf("Failed to create database: %v\n", err) return } - defer os.Remove(dbName) // Ignore error. + defer os.RemoveAll(dbName) // Ignore error. defer db.Close() // Insert the main network genesis block. This is part of the initial // database setup. Like above, this typically would not be needed when // opening an existing database. - genesisBlock := btcutil.NewBlock(&btcwire.GenesisBlock) + genesisBlock := btcutil.NewBlock(btcnet.MainNetParams.GenesisBlock) _, err = db.InsertBlock(genesisBlock) if err != nil { fmt.Printf("Failed to insert genesis block: %v\n", err) @@ -117,7 +117,7 @@ intentionally causes an error by attempting to process a duplicate block. // Create a new BlockChain instance using the underlying database for // the main bitcoin network and ignore notifications. - chain := btcchain.New(db, btcwire.MainNet, nil) + chain := btcchain.New(db, &btcnet.MainNetParams, nil) // Process a block. For this example, we are going to intentionally // cause an error by trying to process the genesis block which already