Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions rpc/src/v1/impls/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,13 @@ where
Ok(self.client.block(&BlockId::Hash(block_hash)).map(|block| block.transactions_count()))
}

fn get_min_transaction_fee(&self, action_type: String, block_number: u64) -> Result<Option<u64>> {
if block_number == 0 {
fn get_min_transaction_fee(&self, action_type: String, block_number: Option<u64>) -> Result<Option<u64>> {
if block_number == Some(0) {
return Ok(None)
}
if let Some(common_parameters) = self.client.common_params((block_number - 1).into()) {
// Unlike other RPCs, use the latest parameters if the block number is `null`.
let block_id = block_number.map(|n| (n - 1).into()).unwrap_or(BlockId::Latest);
if let Some(common_parameters) = self.client.common_params(block_id) {
Ok(match action_type.as_str() {
"mintAsset" => Some(common_parameters.min_asset_mint_cost()),
"transferAsset" => Some(common_parameters.min_asset_transfer_cost()),
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/v1/traits/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ build_rpc_trait! {

///Gets the minimum transaction fee of the given name.
# [rpc(name = "chain_getMinTransactionFee")]
fn get_min_transaction_fee(&self, String, u64) -> Result<Option<u64>>;
fn get_min_transaction_fee(&self, String, Option<u64>) -> Result<Option<u64>>;

/// Gets the mining given block number
# [rpc(name = "chain_getMiningReward")]
Expand Down