forked from crypto-org-chain/cronos
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: mempool logic should be kept (crypto-org-chain#1432)
* Problem: mempool logic should be kept * revert integration test
- Loading branch information
Showing
4 changed files
with
77 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package app | ||
|
||
import ( | ||
"fmt" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
// BlockAddressesDecorator block addresses from sending transactions | ||
type BlockAddressesDecorator struct { | ||
blockedMap map[string]struct{} | ||
} | ||
|
||
func NewBlockAddressesDecorator(blacklist map[string]struct{}) BlockAddressesDecorator { | ||
return BlockAddressesDecorator{ | ||
blockedMap: blacklist, | ||
} | ||
} | ||
|
||
func (bad BlockAddressesDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { | ||
if ctx.IsCheckTx() { | ||
for _, msg := range tx.GetMsgs() { | ||
for _, signer := range msg.GetSigners() { | ||
if _, ok := bad.blockedMap[string(signer)]; ok { | ||
return ctx, fmt.Errorf("signer is blocked: %s", signer.String()) | ||
} | ||
} | ||
} | ||
} | ||
return next(ctx, tx, simulate) | ||
} |
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