Skip to content

Commit

Permalink
correct userId usage
Browse files Browse the repository at this point in the history
  • Loading branch information
itswisdomagain committed Aug 21, 2019
1 parent 0beb5b8 commit 98ae593
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions controllers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func (controller *MainController) APIAddress(c web.C, r *http.Request) ([]string
return nil, codes.Unavailable, "system error", errors.New("unable to process wallet commands")
}

userFeeAddr, err := controller.FeeAddressForUserID(int(user.Id))
userFeeAddr, err := controller.FeeAddressForUserID(userId)
if err != nil {
log.Warnf("unexpected error deriving pool addr: %s", err.Error())
return nil, codes.Unavailable, "system error", errors.New("unable to process wallet commands")
Expand All @@ -372,7 +372,7 @@ func (controller *MainController) APIAddress(c web.C, r *http.Request) ([]string
createMultiSig.RedeemScript, poolPubKeyAddr, userPubKeyAddr,
userFeeAddr.EncodeAddress(), importedHeight)

log.Infof("successfully create multisigaddress for user %d", c.Env["APIUserID"])
log.Infof("successfully create multisigaddress for user %d", int(user.Id))

err = controller.StakepooldUpdateUsers(dbMap)
if err != nil {
Expand Down Expand Up @@ -425,10 +425,10 @@ func (controller *MainController) APIPurchaseTicket(c web.C, r *http.Request) (*

// load saved user info from db to get the user id
user = models.GetUserByEmail(dbMap, userPubKeyAddr)
userId := user.Id
userId := int(user.Id)

// Get the ticket address for this user
pooladdress, err := controller.TicketAddressForUserID(int(userId))
pooladdress, err := controller.TicketAddressForUserID(userId)
if err != nil {
log.Errorf("unable to derive ticket address: %v", err)
return nil, codes.Unavailable, "system error", errors.New("unable to process wallet commands")
Expand Down Expand Up @@ -487,7 +487,7 @@ func (controller *MainController) APIPurchaseTicket(c web.C, r *http.Request) (*
createMultiSig.RedeemScript, poolPubKeyAddr, userPubKeyAddr,
userFeeAddr.EncodeAddress(), importedHeight)

log.Infof("successfully create multisigaddress for user %d", c.Env["APIUserID"])
log.Infof("successfully create multisigaddress for user %d", userId)

err = controller.StakepooldUpdateUsers(dbMap)
if err != nil {
Expand Down

0 comments on commit 98ae593

Please sign in to comment.