Skip to content

Commit

Permalink
user badgerdb on mobile devices
Browse files Browse the repository at this point in the history
  • Loading branch information
dreacot committed Oct 24, 2024
1 parent 7ddc8df commit 186c9d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion libwallet/assets_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ const LogFilename = "cryptopower.log"
// assetIdentifier use for listen balance of all wallet changed
const assetIdentifier = "assets_manager"

const BOLT_DB = "bdb" // Bolt db driver

Check failure on line 41 in libwallet/assets_manager.go

View workflow job for this annotation

GitHub Actions / Build

File is not `goimports`-ed (goimports)
const BADGER_DB = "badgerdb" // Badger db driver

Check failure on line 42 in libwallet/assets_manager.go

View workflow job for this annotation

GitHub Actions / Build

var-naming: don't use ALL_CAPS in Go names; use CamelCase (revive)

Check warning on line 42 in libwallet/assets_manager.go

View workflow job for this annotation

GitHub Actions / Build

var-naming: don't use ALL_CAPS in Go names; use CamelCase (revive)

// Assets is a struct that holds all the assets supported by the wallet.
type Assets struct {
DCR struct {
Expand Down Expand Up @@ -139,7 +142,10 @@ func NewAssetsManager(rootDir, logDir string, netType utils.NetworkType, dexTest
}

// validate the network type before proceeding to initialize the othe fields.
dbDriver := "bdb" // TODO: Should be a constant.
dbDriver := BOLT_DB
if appos.Current().IsMobile() {
dbDriver = BADGER_DB
}
mgr, err := initializeAssetsFields(rootDir, dbDriver, logDir, netType, dexTestAddr)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func main() {
} else {
_ = logger.SetLogLevels(cfg.DebugLevel)
}

Check failure on line 71 in main.go

View workflow job for this annotation

GitHub Actions / Build

File is not `goimports`-ed (goimports)
assetsManager, err := libwallet.NewAssetsManager(cfg.HomeDir, logDir, netType, cfg.DEXTestAddr)
if err != nil {
return nil, err
Expand Down

0 comments on commit 186c9d0

Please sign in to comment.