removed duplicate err msgs

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2024-02-26 13:24:09 +01:00
parent 26455f5532
commit c4067b7e38
No known key found for this signature in database
2 changed files with 9 additions and 8 deletions

View File

@ -11,19 +11,19 @@ import (
func (k msgServer) ReissueRDDLResult(goCtx context.Context, msg *types.MsgReissueRDDLResult) (*types.MsgReissueRDDLResultResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
errmsg := " for provided block height %s"
reissuance, found := k.LookupReissuance(ctx, msg.GetBlockHeight())
if !found {
return nil, errorsmod.Wrapf(types.ErrReissuanceNotFound, " for provided block height %s", strconv.FormatInt(msg.GetBlockHeight(), 10))
return nil, errorsmod.Wrapf(types.ErrReissuanceNotFound, errmsg, strconv.FormatInt(msg.GetBlockHeight(), 10))
}
if reissuance.GetBlockHeight() != msg.GetBlockHeight() {
return nil, errorsmod.Wrapf(types.ErrWrongBlockHeight, " for provided block height %s", strconv.FormatInt(msg.GetBlockHeight(), 10))
return nil, errorsmod.Wrapf(types.ErrWrongBlockHeight, errmsg, strconv.FormatInt(msg.GetBlockHeight(), 10))
}
if reissuance.GetProposer() != msg.GetProposer() {
return nil, errorsmod.Wrapf(types.ErrInvalidProposer, " for provided block height %s", strconv.FormatInt(msg.GetBlockHeight(), 10))
return nil, errorsmod.Wrapf(types.ErrInvalidProposer, errmsg, strconv.FormatInt(msg.GetBlockHeight(), 10))
}
if reissuance.GetTxID() != "" {
return nil, errorsmod.Wrapf(types.ErrTXAlreadySet, " for provided block height %s", strconv.FormatInt(msg.GetBlockHeight(), 10))
return nil, errorsmod.Wrapf(types.ErrTXAlreadySet, errmsg, strconv.FormatInt(msg.GetBlockHeight(), 10))
}
reissuance.TxID = msg.GetTxID()

View File

@ -31,6 +31,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
initiator := sample.Secp256k1AccAddress()
challenger := sample.Secp256k1AccAddress()
challengee := sample.Secp256k1AccAddress()
errInvalidPopData := "Invalid pop data"
testCases := []struct {
name string
@ -81,7 +82,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
"Initiator is not set: invalid challenge",
},
{
"Invalid pop data",
errInvalidPopData,
types.MsgReportPopResult{
Creator: challenger.String(),
Challenge: &types.Challenge{
@ -96,7 +97,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
"PoP report data does not match challenge: invalid challenge",
},
{
"Invalid pop data",
errInvalidPopData,
types.MsgReportPopResult{
Creator: challenger.String(),
Challenge: &types.Challenge{
@ -111,7 +112,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
"PoP reporter is not the challenger: invalid PoP reporter",
},
{
"Invalid pop data",
errInvalidPopData,
types.MsgReportPopResult{
Creator: challenger.String(),
Challenge: &types.Challenge{