Skip to content

Commit

Permalink
fixup client/core: postbond to register and add bond
Browse files Browse the repository at this point in the history
  • Loading branch information
chappjc committed Nov 14, 2022
1 parent 2d2791d commit 30db927
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
6 changes: 3 additions & 3 deletions client/core/bond.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (c *Core) postBond(dc *dexConnection, bond *asset.Bond) (*msgjson.PostBondR
AssetID: assetID,
BondVer: bond.Version,
BondTx: bond.UnsignedTx,
BondScript: bond.BondData,
BondData: bond.BondData,
}

postBondRes := new(msgjson.PostBondResult)
Expand Down Expand Up @@ -668,8 +668,8 @@ func (c *Core) bondConfirmed(dc *dexConnection, assetID uint32, coinID []byte, n
// just try to authenticate...
} // else already found confirmed (no-op)

// If we were not previously authenticated, we can infer that this was
// the bond that created the account server-side, otherwise top-up.
// If we were not previously authenticated, we can infer that this was the
// bond that created the account server-side, otherwise this was a top-up.
if isAuthed {
return nil // already logged in
}
Expand Down
31 changes: 0 additions & 31 deletions client/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -7462,37 +7462,6 @@ func handlePenaltyMsg(c *Core, dc *dexConnection, msg *msgjson.Message) error {
return nil
}

/*
func handleBondConfirmedMsg(c *Core, dc *dexConnection, msg *msgjson.Message) error {
var bondConfirmed *msgjson.BondConfirmedNotification
err := msg.Unmarshal(&bondConfirmed)
if err != nil {
return fmt.Errorf("bond confirmed note unmarshal error: %w", err)
}
if bondConfirmed == nil {
return errors.New("empty message")
}
// Check the signature.
err = dc.acct.checkSig(bondConfirmed.Serialize(), bondConfirmed.Sig)
if err != nil {
return newError(signatureErr, "handleBondConfirmedMsg: DEX signature validation error: %v", err) // warn?
}
acctID := dc.acct.ID()
if !bytes.Equal(bondConfirmed.AccountID, acctID[:]) {
return fmt.Errorf("invalid account ID %v, expected %v", bondConfirmed.AccountID, acctID)
}
c.log.Infof("Received bondconfirmed notification from %v for account %v...", dc.acct.host, acctID)
dc.acct.authMtx.Lock()
dc.acct.tier = bondConfirmed.Tier
dc.acct.authMtx.Unlock()
return c.bondConfirmed(dc, bondConfirmed.AssetID, bondConfirmed.BondCoinID, bondConfirmed.Tier)
}
*/

func handleBondExpiredMsg(c *Core, dc *dexConnection, msg *msgjson.Message) error {
var bondExpired *msgjson.BondExpiredNotification
err := msg.Unmarshal(&bondExpired)
Expand Down

0 comments on commit 30db927

Please sign in to comment.