From 30db9274ae169b2f8b5c1826b0a5fa47391009e8 Mon Sep 17 00:00:00 2001 From: Jonathan Chappelow Date: Mon, 14 Nov 2022 08:55:31 -0600 Subject: [PATCH] fixup client/core: postbond to register and add bond --- client/core/bond.go | 6 +++--- client/core/core.go | 31 ------------------------------- 2 files changed, 3 insertions(+), 34 deletions(-) diff --git a/client/core/bond.go b/client/core/bond.go index caae687f3b..28827e2952 100644 --- a/client/core/bond.go +++ b/client/core/bond.go @@ -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) @@ -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 } diff --git a/client/core/core.go b/client/core/core.go index 9800d27192..459b10a600 100644 --- a/client/core/core.go +++ b/client/core/core.go @@ -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)