mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-06-28 00:42:30 +00:00

* added InitPoP message * added getChallenge query to inspect challenges * adjusted towards a unique block height identification unit: int64, not uint64 * added challenge param finished to identify challenges that weren't completed but will be part of re-issuance. Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
26 lines
673 B
Go
26 lines
673 B
Go
package keeper
|
|
|
|
import (
|
|
"context"
|
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/planetmint/planetmint-go/x/dao/types"
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/status"
|
|
)
|
|
|
|
func (k Keeper) GetChallenge(goCtx context.Context, req *types.QueryGetChallengeRequest) (*types.QueryGetChallengeResponse, error) {
|
|
if req == nil {
|
|
return nil, status.Error(codes.InvalidArgument, "invalid request")
|
|
}
|
|
|
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
|
|
|
challenge, found := k.LookupChallenge(ctx, req.GetHeight())
|
|
if !found {
|
|
return nil, status.Error(codes.NotFound, "challenge not found")
|
|
}
|
|
|
|
return &types.QueryGetChallengeResponse{Challenge: &challenge}, nil
|
|
}
|