Skip to content

Commit

Permalink
add address codec
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Sep 26, 2024
1 parent 5331cb0 commit e705991
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ func New(
}
}

addressCodec := authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix())

var mpool mempool.Mempool
if maxTxs := cast.ToInt(appOpts.Get(server.FlagMempoolMaxTxs)); maxTxs >= 0 {
// NOTE we use custom transaction decoder that supports the sdk.Tx interface instead of sdk.StdTx
Expand All @@ -399,7 +401,7 @@ func New(
} else {
mpool = mempool.NoOpMempool{}
}
blockProposalHandler := NewProposalHandler(txDecoder, identity)
blockProposalHandler := NewProposalHandler(txDecoder, identity, addressCodec)
baseAppOptions = append(baseAppOptions, func(app *baseapp.BaseApp) {
app.SetMempool(mpool)

Expand Down Expand Up @@ -486,7 +488,7 @@ func New(
runtime.NewKVStoreService(keys[authtypes.StoreKey]),
ethermint.ProtoAccount,
maccPerms,
authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()),
addressCodec,
sdk.GetConfig().GetBech32AccountAddrPrefix(),
authAddr,
)
Expand Down
9 changes: 5 additions & 4 deletions app/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ type ProposalHandler struct {
addressCodec address.Codec
}

func NewProposalHandler(txDecoder sdk.TxDecoder, identity age.Identity) *ProposalHandler {
func NewProposalHandler(txDecoder sdk.TxDecoder, identity age.Identity, addressCodec address.Codec) *ProposalHandler {
return &ProposalHandler{
TxDecoder: txDecoder,
Identity: identity,
blocklist: make(map[string]struct{}),
TxDecoder: txDecoder,
Identity: identity,
blocklist: make(map[string]struct{}),
addressCodec: addressCodec,
}
}

Expand Down

0 comments on commit e705991

Please sign in to comment.