-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move validate inbound for observers logic to separate method
- Loading branch information
Showing
2 changed files
with
30 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package keeper | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/zeta-chain/zetacore/x/crosschain/types" | ||
) | ||
|
||
func (k Keeper) ValidateInboundObservers(ctx sdk.Context, msg *types.MsgVoteInbound) (*types.CrossChainTx, error) { | ||
tss, tssFound := k.zetaObserverKeeper.GetTSS(ctx) | ||
if !tssFound { | ||
return nil, types.ErrCannotFindTSSKeys | ||
} | ||
// create a new CCTX from the inbound message.The status of the new CCTX is set to PendingInbound. | ||
cctx, err := types.NewCCTX(ctx, *msg, tss.TssPubkey) | ||
if err != nil { | ||
return nil, err | ||
} | ||
// Initiate outbound, the process function manages the state commit and cctx status change. | ||
// If the process fails, the changes to the evm state are rolled back. | ||
_, err = k.InitiateOutbound(ctx, &cctx) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &cctx, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters