Skip to content

Commit

Permalink
fix tm rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
yann-sjtu committed Jun 30, 2023
1 parent 45956d2 commit ec1b455
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions libs/tendermint/rpc/core/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,20 @@ func UserUnconfirmedTxs(address string, limit int) (*ctypes.ResultUserUnconfirme
Txs: txs}, nil
}

func TmUserUnconfirmedTxs(ctx *rpctypes.Context, address string, limit int) (*ctypes.ResultUserUnconfirmedTxs, error) {
return UserUnconfirmedTxs(address, limit)
}

func UserNumUnconfirmedTxs(address string) (*ctypes.ResultUserUnconfirmedTxs, error) {
nums := env.Mempool.ReapUserTxsCnt(address)
return &ctypes.ResultUserUnconfirmedTxs{
Count: nums}, nil
}

func TmUserNumUnconfirmedTxs(ctx *rpctypes.Context, address string) (*ctypes.ResultUserUnconfirmedTxs, error) {
return UserNumUnconfirmedTxs(address)
}

func GetUnconfirmedTxByHash(hash [sha256.Size]byte) (types.Tx, error) {
return env.Mempool.GetTxByHash(hash)
}
Expand All @@ -189,6 +197,10 @@ func GetAddressList() (*ctypes.ResultUnconfirmedAddresses, error) {
}, nil
}

func TmGetAddressList(ctx *rpctypes.Context) (*ctypes.ResultUnconfirmedAddresses, error) {
return GetAddressList()
}

func GetPendingNonce(address string) (*ctypes.ResultPendingNonce, bool) {
nonce, ok := env.Mempool.GetPendingNonce(address)
if !ok {
Expand Down
6 changes: 3 additions & 3 deletions libs/tendermint/rpc/core/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ var Routes = map[string]*rpc.RPCFunc{
"consensus_params": rpc.NewRPCFunc(ConsensusParams, "height"),
"unconfirmed_txs": rpc.NewRPCFunc(UnconfirmedTxs, "limit"),
"num_unconfirmed_txs": rpc.NewRPCFunc(NumUnconfirmedTxs, ""),
"user_unconfirmed_txs": rpc.NewRPCFunc(UserUnconfirmedTxs, "address,limit"),
"user_num_unconfirmed_txs": rpc.NewRPCFunc(UserNumUnconfirmedTxs, "address"),
"get_address_list": rpc.NewRPCFunc(GetAddressList, ""),
"user_unconfirmed_txs": rpc.NewRPCFunc(TmUserUnconfirmedTxs, "address,limit"),
"user_num_unconfirmed_txs": rpc.NewRPCFunc(TmUserNumUnconfirmedTxs, "address"),
"get_address_list": rpc.NewRPCFunc(TmGetAddressList, ""),
"block_search": rpc.NewRPCFunc(BlockSearch, "query,page,per_page,order_by"),

// tx broadcast API
Expand Down

0 comments on commit ec1b455

Please sign in to comment.