mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 14:22:37 +01:00
identify where it freezes. in btcwallet/walletdb/interface.go:271
This commit is contained in:
parent
8504362c5e
commit
cb32ab1fb9
2 changed files with 18 additions and 8 deletions
|
@ -22,6 +22,7 @@ import (
|
|||
"bytes"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
@ -134,9 +135,15 @@ func openDb(directory string, dbname string) (walletdb.DB, error) {
|
|||
if err := checkCreateDir(directory); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Printf("checkCreateDir(directory) returned\n")
|
||||
log.Printf("freezes here?\n")
|
||||
// Open the database using the boltdb backend.
|
||||
return walletdb.Open("bdb", dbPath)
|
||||
wdb, err := walletdb.Open("bdb", dbPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Printf("walletdb.Open() returned\n")
|
||||
return wdb, nil
|
||||
}
|
||||
|
||||
// promptSeed is used to prompt for the wallet seed which maybe required during
|
||||
|
@ -194,16 +201,17 @@ func openWallet(pubPass []byte, dbDir string) (*wallet.Wallet, walletdb.DB, erro
|
|||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("Failed to open database: %v", err)
|
||||
}
|
||||
|
||||
log.Printf("openDb returned\n")
|
||||
addrMgrNS, err := db.Namespace(waddrmgrNamespaceKey)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
log.Printf("db.Namespace(waddrmgrNamespaceKey) returned\n")
|
||||
txMgrNS, err := db.Namespace(wtxmgrNamespaceKey)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
log.Printf("db.Namespace(wtxmgrNamespaceKey) returned\n")
|
||||
// TODO(roasbeef): pass these in as funcs instead, priv pass already
|
||||
// loaded into memory, use tadge's format to read HD seed.
|
||||
cbs := &waddrmgr.OpenCallbacks{
|
||||
|
@ -212,5 +220,6 @@ func openWallet(pubPass []byte, dbDir string) (*wallet.Wallet, walletdb.DB, erro
|
|||
}
|
||||
w, err := wallet.Open(pubPass, ActiveNetParams, db, addrMgrNS, txMgrNS,
|
||||
cbs)
|
||||
log.Printf("wallet.Open returned\n")
|
||||
return w, db, err
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
@ -269,18 +270,18 @@ func NewLightningWallet(config *Config) (*LightningWallet, error) {
|
|||
fmt.Fprintln(os.Stderr, err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Printf("createWallet returned\n")
|
||||
// open wallet to initialize and create id key
|
||||
wallet, db, err := openWallet(pubPass, netDir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Printf("openWallet returned\n")
|
||||
err = wallet.Manager.Unlock(config.PrivatePass)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Printf("Unlock returned\n")
|
||||
adrs, err := wallet.Manager.NextInternalAddresses(0, 1)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -298,7 +299,7 @@ func NewLightningWallet(config *Config) (*LightningWallet, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fmt.Printf("stored identity key pubkey hash in channeldb\n")
|
||||
log.Printf("stored identity key pubkey hash in channeldb\n")
|
||||
}
|
||||
|
||||
// Wallet has been created and been initialized at this point, open it
|
||||
|
|
Loading…
Add table
Reference in a new issue