Skip to content

Commit

Permalink
client/core: avoid potential wallet reconfigure deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
chappjc committed Jan 14, 2021
1 parent bca1325 commit 4bed3e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ node_modules/
client/cmd/dexc/dexc
client/cmd/dexcctl/dexcctl
wiki
bin/
7 changes: 3 additions & 4 deletions client/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,7 @@ func (c *Core) loadWallet(dbWallet *db.Wallet) (*xcWallet, error) {
walletCfg := &asset.WalletConfig{
Settings: dbWallet.Settings,
TipChange: func(err error) {
c.tipChange(assetID, err)
go c.tipChange(assetID, err)
},
}
logger := c.log.SubLogger(unbip(assetID))
Expand Down Expand Up @@ -1625,11 +1625,10 @@ func (c *Core) ReconfigureWallet(appPW []byte, assetID uint32, cfg map[string]st
}
c.connMtx.RUnlock()

if oldWallet.connected() {
oldWallet.Disconnect()
}
c.wallets[assetID] = wallet

go oldWallet.Disconnect()

c.notify(newBalanceNote(assetID, balances)) // redundant with wallet config note?
details := fmt.Sprintf("Configuration for %s wallet has been updated. Deposit address = %s", unbip(assetID), wallet.address)
c.notify(newWalletConfigNote("Wallet Configuration Updated", details, db.Success, wallet.state()))
Expand Down

0 comments on commit 4bed3e2

Please sign in to comment.