mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 14:35:47 +00:00
removed duplicate err msgs
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
26455f5532
commit
c4067b7e38
@ -11,19 +11,19 @@ import (
|
|||||||
|
|
||||||
func (k msgServer) ReissueRDDLResult(goCtx context.Context, msg *types.MsgReissueRDDLResult) (*types.MsgReissueRDDLResultResponse, error) {
|
func (k msgServer) ReissueRDDLResult(goCtx context.Context, msg *types.MsgReissueRDDLResult) (*types.MsgReissueRDDLResultResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
|
errmsg := " for provided block height %s"
|
||||||
reissuance, found := k.LookupReissuance(ctx, msg.GetBlockHeight())
|
reissuance, found := k.LookupReissuance(ctx, msg.GetBlockHeight())
|
||||||
if !found {
|
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() {
|
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() {
|
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() != "" {
|
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()
|
reissuance.TxID = msg.GetTxID()
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
|
|||||||
initiator := sample.Secp256k1AccAddress()
|
initiator := sample.Secp256k1AccAddress()
|
||||||
challenger := sample.Secp256k1AccAddress()
|
challenger := sample.Secp256k1AccAddress()
|
||||||
challengee := sample.Secp256k1AccAddress()
|
challengee := sample.Secp256k1AccAddress()
|
||||||
|
errInvalidPopData := "Invalid pop data"
|
||||||
|
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
name string
|
name string
|
||||||
@ -81,7 +82,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
|
|||||||
"Initiator is not set: invalid challenge",
|
"Initiator is not set: invalid challenge",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Invalid pop data",
|
errInvalidPopData,
|
||||||
types.MsgReportPopResult{
|
types.MsgReportPopResult{
|
||||||
Creator: challenger.String(),
|
Creator: challenger.String(),
|
||||||
Challenge: &types.Challenge{
|
Challenge: &types.Challenge{
|
||||||
@ -96,7 +97,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
|
|||||||
"PoP report data does not match challenge: invalid challenge",
|
"PoP report data does not match challenge: invalid challenge",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Invalid pop data",
|
errInvalidPopData,
|
||||||
types.MsgReportPopResult{
|
types.MsgReportPopResult{
|
||||||
Creator: challenger.String(),
|
Creator: challenger.String(),
|
||||||
Challenge: &types.Challenge{
|
Challenge: &types.Challenge{
|
||||||
@ -111,7 +112,7 @@ func TestMsgServerReportPoPResult(t *testing.T) {
|
|||||||
"PoP reporter is not the challenger: invalid PoP reporter",
|
"PoP reporter is not the challenger: invalid PoP reporter",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Invalid pop data",
|
errInvalidPopData,
|
||||||
types.MsgReportPopResult{
|
types.MsgReportPopResult{
|
||||||
Creator: challenger.String(),
|
Creator: challenger.String(),
|
||||||
Challenge: &types.Challenge{
|
Challenge: &types.Challenge{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user