Skip to content

Commit

Permalink
fix: add ErrInvalidApproval errorcode for sp's approval invalid (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
jingjunLi authored Apr 17, 2023
1 parent 6c6764d commit 54103d4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions x/storage/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -1209,14 +1209,11 @@ func (k Keeper) VerifySPAndSignature(ctx sdk.Context, spAcc sdk.AccAddress, sigD
return sptypes.ErrStorageProviderNotInService
}

approvalAccAddress, err := sdk.AccAddressFromHexUnsafe(sp.ApprovalAddress)
if err != nil {
return err
}
approvalAccAddress := sdk.MustAccAddressFromHex(sp.ApprovalAddress)

err = types.VerifySignature(approvalAccAddress, sdk.Keccak256(sigData), signature)
err := types.VerifySignature(approvalAccAddress, sdk.Keccak256(sigData), signature)
if err != nil {
return err
return errors.Wrapf(types.ErrInvalidApproval, "verify signature error: %s", err)
}
return nil
}
Expand Down

0 comments on commit 54103d4

Please sign in to comment.