-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2865 from irisnet/yuandu/fix-vesting-loophole
fix: vesting account loophole
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 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
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
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,31 @@ | ||
package ante | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
|
||
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" | ||
) | ||
|
||
// RejectVestingDecorator is responsible for rejecting the vesting msg | ||
type RejectVestingDecorator struct{} | ||
|
||
// NewRejectVestingDecorator returns an instance of ValidateVestingDecorator | ||
func NewRejectVestingDecorator() RejectVestingDecorator { | ||
return RejectVestingDecorator{} | ||
} | ||
|
||
// AnteHandle checks the transaction | ||
func (vvd RejectVestingDecorator) AnteHandle(ctx sdk.Context, | ||
tx sdk.Tx, simulate bool, next sdk.AnteHandler) (sdk.Context, error) { | ||
for _, msg := range tx.GetMsgs() { | ||
switch msg.(type) { | ||
case *vestingtypes.MsgCreateVestingAccount, | ||
*vestingtypes.MsgCreatePermanentLockedAccount, | ||
*vestingtypes.MsgCreatePeriodicVestingAccount: | ||
return ctx, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, | ||
"currently doesn't support creating vesting account") | ||
} | ||
} | ||
return next(ctx, tx, simulate) | ||
} |