Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/did-trade-hub'
Browse files Browse the repository at this point in the history
  • Loading branch information
sjatsh committed Sep 5, 2023
2 parents 2c4fcaa + ece4e3d commit d1152f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion http_server/handle/approval_fulfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,12 @@ func (h *HttpHandle) doApprovalFulfillCheck(req *ReqApprovalFulfill, now time.Ti
return
}

nowUntil := uint64(now.Unix())
timeCell, err := h.DasCore.GetTimeCell()
if err != nil {
apiResp.ApiRespErr(api_code.ApiCodeError500, err.Error())
return
}
nowUntil := uint64(timeCell.Timestamp())
if nowUntil < approval.SealedUntil {
var ownerHex *core.DasAddressHex
ownerHex, err = req.FormatChainTypeAddress(config.Cfg.Server.Net, true)
Expand Down
8 changes: 7 additions & 1 deletion http_server/handle/approval_revoke.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,13 @@ func (h *HttpHandle) doApprovalRevokeCheck(req *ReqApprovalRevoke, apiResp *api_
err = fmt.Errorf("GetAccountApprovalByAccountIdAndPlatform err: %s %s %s", err.Error(), accountId, platformHex.AddressHex)
return
}
now := uint64(time.Now().Unix())

timeCell, err := h.DasCore.GetTimeCell()
if err != nil {
apiResp.ApiRespErr(api_code.ApiCodeError500, err.Error())
return
}
now := uint64(timeCell.Timestamp())
if now < approval.ProtectedUntil {
apiResp.ApiRespErr(api_code.ApiCodeAccountApprovalProtected, "account protected")
return
Expand Down

0 comments on commit d1152f9

Please sign in to comment.