Update tests to use btcnet genesis params.

This commit is contained in:
Dave Collins 2014-05-28 00:56:57 -05:00
parent b0b090009a
commit 87bef61b30
3 changed files with 5 additions and 4 deletions

View file

@ -6,6 +6,7 @@ package btcchain_test
import (
"github.com/conformal/btcchain"
"github.com/conformal/btcnet"
"github.com/conformal/btcutil"
"github.com/conformal/btcwire"
"testing"
@ -65,7 +66,7 @@ func TestHaveBlock(t *testing.T) {
want bool
}{
// Genesis block should be present (in the main chain).
{hash: btcwire.GenesisHash.String(), want: true},
{hash: btcnet.MainNetParams.GenesisHash.String(), want: true},
// Block 3a should be present (on a side chain).
{hash: "00000000474284d20067a4d33f6a02284e6ef70764a3a26d6a5b9df52ef663dd", want: true},

View file

@ -12,7 +12,6 @@ import (
_ "github.com/conformal/btcdb/memdb"
"github.com/conformal/btcnet"
"github.com/conformal/btcutil"
"github.com/conformal/btcwire"
"os"
"path/filepath"
)
@ -103,7 +102,7 @@ func chainSetup(dbName string) (*btcchain.BlockChain, func(), error) {
// Insert the main network genesis block. This is part of the initial
// database setup.
genesisBlock := btcutil.NewBlock(&btcwire.GenesisBlock)
genesisBlock := btcutil.NewBlock(btcnet.MainNetParams.GenesisBlock)
_, err := db.InsertBlock(genesisBlock)
if err != nil {
teardown()

View file

@ -33,7 +33,8 @@ func TestCheckConnectBlock(t *testing.T) {
// The genesis block should fail to connect since it's already
// inserted.
err = chain.CheckConnectBlock(btcutil.NewBlock(&btcwire.GenesisBlock))
genesisBlock := btcnet.MainNetParams.GenesisBlock
err = chain.CheckConnectBlock(btcutil.NewBlock(genesisBlock))
if err == nil {
t.Errorf("CheckConnectBlock: Did not received expected error")
}