limit get_txn_info_list count size
* limit get_txn_info_list count size
limit get_txn_info_list count size
* limit get_txn_info_list size
limit get_txn_info_list size
* limit get_txn_info_list count size
limit get_txn_info_list count size
MODIFY
cmd/starcoin/src/chain/get_txn_info_list_cmd.rs
cmd/starcoin/src/chain/get_txn_info_list_cmd.rs
@@ -19,7 +19,7 @@ pub struct GetTransactionInfoListOpt {
#[structopt(name = "reverse", long, short = "r")]
reverse: Option<bool>,
- #[structopt(name = "count", long, short = "c")]
+ #[structopt(name = "count", long, short = "c", default_value = "32")]
count: u64,
}

MODIFY
config/src/rpc_config.rs
config/src/rpc_config.rs
@@ -25,6 +25,7 @@ const DEFAULT_WEB_SOCKET_PORT: u16 = 9870;
// UNSPECIFIED is 0.0.0.0
const DEFAULT_RPC_ADDRESS: IpAddr = IpAddr::V4(Ipv4Addr::UNSPECIFIED);
const DEFAULT_BLOCK_QUERY_MAX_RANGE: u64 = 32;
+const DEFAULT_TXN_INFO_QUEYR_MAX_RANGE: u64 = 32;
#[derive(Debug, Default, Clone, PartialEq, Deserialize, Serialize, StructOpt)]
pub struct HttpConfiguration {
@@ -386,6 +387,10 @@ pub struct RpcConfig {
#[serde(skip)]
#[structopt(skip)]
base: Option<Arc<BaseConfig>>,
+
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[structopt(long = "query-max-txn-info-range")]
+ pub txn_info_query_max_range: Option<u64>,
}
#[derive(Clone, Eq, PartialEq)]
@@ -451,6 +456,11 @@ impl RpcConfig {
.unwrap_or(DEFAULT_BLOCK_QUERY_MAX_RANGE)
}
+ pub fn txn_info_query_max_range(&self) -> u64 {
+ self.txn_info_query_max_range
+ .unwrap_or(DEFAULT_TXN_INFO_QUEYR_MAX_RANGE)
+ }
+
fn base(&self) -> &BaseConfig {
self.base.as_ref().expect("Config should init.")
}
@@ -523,6 +533,9 @@ impl ConfigModule for RpcConfig {
if opt.rpc.block_query_max_range.is_some() {
self.block_query_max_range = opt.rpc.block_query_max_range;
}
+ if opt.rpc.txn_info_query_max_range.is_some() {
+ self.txn_info_query_max_range = opt.rpc.txn_info_query_max_range;
+ }
self.http.merge(&opt.rpc.http)?;
self.tcp.merge(&opt.rpc.tcp)?;
self.ws.merge(&opt.rpc.ws)?;

MODIFY
rpc/server/src/module/chain_rpc.rs
rpc/server/src/module/chain_rpc.rs
@@ -421,9 +421,11 @@ where
max_size: u64,
) -> FutureResult<Vec<TransactionInfoView>> {
let service = self.service.clone();
+ let config = self.config.clone();
let fut = async move {
+ let max_return_num = max_size.min(config.rpc.txn_info_query_max_range());
let txn_infos = service
- .get_txn_infos(start_index, reverse, max_size)
+ .get_txn_infos(start_index, reverse, max_return_num)
.await?;
// remove duplicate block_id
let id_sets = txn_infos

limit get_txn_info_list count size (#2975)

* limit get_txn_info_list count size

limit get_txn_info_list count size

* limit get_txn_info_list size

limit get_txn_info_list size

* limit get_txn_info_list count size

limit get_txn_info_list count size