Skip to content

Commit

Permalink
buck review changes
Browse files Browse the repository at this point in the history
Signed-off-by: Philemon Ukane <ukanephilemon@gmail.com>
  • Loading branch information
ukane-philemon committed Sep 10, 2024
1 parent 5e1dc4d commit 87d1047
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions client/core/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ func (c *Core) ToggleAccountStatus(pw []byte, addr string, disable bool) error {
if dc.hasActiveOrders() {
return fmt.Errorf("cannot disable account with active orders")
}

if dc.hasUnspentBond() {
c.log.Warnf("Disabling dex server with unspent bonds. Bonds will be refunded when expired.")
}
}

err = c.db.ToggleAccountStatus(addr, disable)
Expand Down
4 changes: 2 additions & 2 deletions client/core/bond.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ func (c *Core) rotateBonds(ctx context.Context) {
// locked. However, we must refund bonds regardless.

bondCfg := c.dexBondConfig(dc, now)
if len(bondCfg.bondAssets) == 0 {
if len(bondCfg.bondAssets) == 0 && !dc.acct.isDisabled() {
if !dc.IsDown() && dc.config() != nil {
dc.log.Meter("no-bond-assets", time.Minute*10).Warnf("Zero bond assets reported for apparently connected DCRDEX server")
}
Expand All @@ -723,7 +723,7 @@ func (c *Core) rotateBonds(ctx context.Context) {
}

if dc.acct.isDisabled() {
continue // we can only attempt bond refund(if any) for disabled accounts
continue // For disabled account, we should only bother about unspent bonds that might have been refunded by refundExpiredBonds above.
}

c.repostPendingBonds(dc, bondCfg, acctBondState, unlocked)
Expand Down
2 changes: 1 addition & 1 deletion client/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -5141,7 +5141,7 @@ func (c *Core) initializeDEXConnections(crypter encrypt.Crypter) {
}

if dc.acct.isDisabled() {
continue // we can only unlock the dex account to init the account ID.
continue // For disabled account, we only want dc.acct.unlock above to initialize the account ID.
}

// Unlock the bond wallet if a target tier is set.
Expand Down

0 comments on commit 87d1047

Please sign in to comment.