Skip to content
This repository has been archived by the owner on Mar 2, 2023. It is now read-only.

Commit

Permalink
Merge c804c8f into 9a51414
Browse files Browse the repository at this point in the history
  • Loading branch information
alokmenghrajani committed Oct 14, 2018
2 parents 9a51414 + c804c8f commit a153fbe
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions backend/btcd_backend.go
Expand Up @@ -66,6 +66,16 @@ func NewBtcdBackend(maxBlockHeight int64, hostPort, user, pass string, network u
return nil, errors.Wrap(err, "could not create a Btcd RPC client")
}

// Check that we are talking to the right chain
genesis, err := client.GetBlockHash(0)
if err != nil {
return nil, errors.Wrap(err, "GetBlockHash(0) failed")
}
if genesis.String() != utils.GenesisBlock(network) {
return nil, errors.New(fmt.Sprintf("Unexpected genesis block %s != %s", genesis.String(), utils.GenesisBlock(network)))
}
fmt.Printf("%+v\n", genesis)

actualMaxHeight, err := client.GetBlockCount()
maxAllowedHeight := actualMaxHeight - minConfirmations
if err != nil {
Expand Down

0 comments on commit a153fbe

Please sign in to comment.