Skip to content

Commit

Permalink
fix reg auth. a couple js bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
buck54321 committed Apr 23, 2024
1 parent 457459c commit 523d749
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
31 changes: 16 additions & 15 deletions client/core/bond.go
Expand Up @@ -1024,18 +1024,7 @@ func (c *Core) RedeemPrepaidBond(appPW []byte, code []byte, host string, certI a
dc.acct.bonds = append(dc.acct.bonds, dbBond)
dc.acct.authMtx.Unlock()

defer func() {
if success {
c.notify(newBondAuthUpdate(dc.acct.host, c.exchangeAuth(dc)))
}
}()

if acctExists {
err = c.db.AddBond(dc.acct.host, dbBond)
if err != nil {
return 0, fmt.Errorf("failed to store pre-paid bond for dex %s: %w", host, err)
}
} else {
if !acctExists {
dc.acct.keyMtx.RLock()
ai := &db.AccountInfo{
Host: dc.acct.host,
Expand All @@ -1045,15 +1034,27 @@ func (c *Core) RedeemPrepaidBond(appPW []byte, code []byte, host string, certI a
Bonds: []*db.Bond{dbBond},
}
dc.acct.keyMtx.RUnlock()
err = c.dbCreateOrUpdateAccount(dc, ai)
if err != nil {

if err = c.dbCreateOrUpdateAccount(dc, ai); err != nil {
return 0, fmt.Errorf("failed to store pre-paid account for dex %s: %w", host, err)
}
c.addDexConnection(dc)
}

success = true // Don't disconnect anymore.

if err = c.db.AddBond(dc.acct.host, dbBond); err != nil {
return 0, fmt.Errorf("failed to store pre-paid bond for dex %s: %w", host, err)
}

if err = c.bondConfirmed(dc, account.PrepaidBondID, code, postBondRes); err != nil {
return 0, fmt.Errorf("bond redeemed, but failed to auth: %v", err)
}

c.updateBondReserves()

success = true
c.notify(newBondAuthUpdate(dc.acct.host, c.exchangeAuth(dc)))

return uint64(postBondRes.Strength), nil
}

Expand Down
2 changes: 1 addition & 1 deletion client/webserver/site/src/html/bodybuilder.tmpl
Expand Up @@ -13,7 +13,7 @@
</head>
<body >
<div class="popup-notes d-hide" id="popupNotes">
<span data-tmpl="note fs15">
<span data-tmpl="note" class="fs15">
<div class="note-indicator d-inline-block" data-tmpl="indicator"></div>
<span data-tmpl="text"></span>
</span>
Expand Down
2 changes: 1 addition & 1 deletion client/webserver/site/src/js/markets.ts
Expand Up @@ -775,7 +775,7 @@ export default class MarketsPage extends BasePage {
}

Doc.setVis(this.mmRunning, page.mmRunning)
Doc.setVis(!this.mmRunning, page.orderForm, page.orderTypeBttns)
if (this.mmRunning) Doc.hide(page.orderForm, page.orderTypeBttns)
}

/* setLoaderMsgVisibility displays a message in case a dex asset is not
Expand Down

0 comments on commit 523d749

Please sign in to comment.