btcwallet icon indicating copy to clipboard operation
btcwallet copied to clipboard

Error opening wallet: unknown database type

Open kminevskiy opened this issue 5 years ago • 1 comments

Hi,

I created a new wallet using btcwallet --create command. After that I started the wallet service along with RPC node. Everything got synced. However, when I try to open that wallet.db, I'm getting an unknown database type error. Here's the code:

Assuming walletDbPath points to the actual ./btcwallet/testnet/ and there's a wallet.db file:

loader := wallet.NewLoader(&chaincfg.TestNet3Params, "walletDbPath", 0)
wallet, err := loader.OpenExistingWallet([]byte("password"), false)
if err != nil {
  log.Fatalf("error opening wallet: %v", err)
}

Am I opening wrong file or is there something else I need to consider?

kminevskiy avatar Apr 22 '19 22:04 kminevskiy

The Loader uses "bdb" db driver, so you'll need to import it using the Blank Identifier ( _ )

import(
  _ "github.com/btcsuite/btcwallet/walletdb/bdb"
)

qustavo avatar May 16 '22 10:05 qustavo