mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-24 10:11:48 +00:00
add limit param to /unconfirmed_txs
This commit is contained in:
@ -209,7 +209,7 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get unconfirmed transactions including their number.
|
// Get unconfirmed transactions (maximum ?limit entries) including their number.
|
||||||
//
|
//
|
||||||
// ```shell
|
// ```shell
|
||||||
// curl 'localhost:46657/unconfirmed_txs'
|
// curl 'localhost:46657/unconfirmed_txs'
|
||||||
@ -232,9 +232,18 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
|||||||
// "id": "",
|
// "id": "",
|
||||||
// "jsonrpc": "2.0"
|
// "jsonrpc": "2.0"
|
||||||
// }
|
// }
|
||||||
|
//
|
||||||
|
// ### Query Parameters
|
||||||
|
//
|
||||||
|
// | Parameter | Type | Default | Required | Description |
|
||||||
|
// |-----------+------+---------+----------+--------------------------------------|
|
||||||
|
// | limit | int | 30 | false | Maximum number of entries (max: 100) |
|
||||||
// ```
|
// ```
|
||||||
func UnconfirmedTxs() (*ctypes.ResultUnconfirmedTxs, error) {
|
func UnconfirmedTxs(limit int) (*ctypes.ResultUnconfirmedTxs, error) {
|
||||||
txs := mempool.Reap(-1)
|
// reuse per_page validator
|
||||||
|
limit = validatePerPage(limit)
|
||||||
|
|
||||||
|
txs := mempool.Reap(limit)
|
||||||
return &ctypes.ResultUnconfirmedTxs{len(txs), txs}, nil
|
return &ctypes.ResultUnconfirmedTxs{len(txs), txs}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ var Routes = map[string]*rpc.RPCFunc{
|
|||||||
"validators": rpc.NewRPCFunc(Validators, "height"),
|
"validators": rpc.NewRPCFunc(Validators, "height"),
|
||||||
"dump_consensus_state": rpc.NewRPCFunc(DumpConsensusState, ""),
|
"dump_consensus_state": rpc.NewRPCFunc(DumpConsensusState, ""),
|
||||||
"consensus_state": rpc.NewRPCFunc(ConsensusState, ""),
|
"consensus_state": rpc.NewRPCFunc(ConsensusState, ""),
|
||||||
"unconfirmed_txs": rpc.NewRPCFunc(UnconfirmedTxs, ""),
|
"unconfirmed_txs": rpc.NewRPCFunc(UnconfirmedTxs, "limit"),
|
||||||
"num_unconfirmed_txs": rpc.NewRPCFunc(NumUnconfirmedTxs, ""),
|
"num_unconfirmed_txs": rpc.NewRPCFunc(NumUnconfirmedTxs, ""),
|
||||||
|
|
||||||
// broadcast API
|
// broadcast API
|
||||||
|
Reference in New Issue
Block a user