Skip to content

Commit a8f50f8

Browse files
Seulgi Kimsgkim126
authored andcommitted
Rename chain_containTransaction to chain_containsTransaction
But it keeps the previous name for backward compatibility.
1 parent ce65f70 commit a8f50f8

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

rpc/src/v1/impls/chain.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,14 @@ where
7676
Ok(self.client.transaction(&id).map(From::from))
7777
}
7878

79-
fn contain_transaction(&self, transaction_hash: H256) -> Result<bool> {
79+
fn contains_transaction(&self, transaction_hash: H256) -> Result<bool> {
8080
Ok(self.client.transaction_block(&transaction_hash.into()).is_some())
8181
}
8282

83+
fn contain_transaction(&self, transaction_hash: H256) -> Result<bool> {
84+
self.contains_transaction(transaction_hash)
85+
}
86+
8387
fn get_transaction_by_tracker(&self, tracker: H256) -> Result<Option<Transaction>> {
8488
Ok(self.client.transaction_by_tracker(&tracker).map(From::from))
8589
}

rpc/src/v1/traits/chain.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ build_rpc_trait! {
3030
fn get_transaction(&self, H256) -> Result<Option<Transaction>>;
3131

3232
/// Query whether the chain has the transaction with given transaction hash.
33+
# [rpc(name = "chain_containsTransaction")]
34+
fn contains_transaction(&self, H256) -> Result<bool>;
35+
3336
# [rpc(name = "chain_containTransaction")]
3437
fn contain_transaction(&self, H256) -> Result<bool>;
3538

spec/JSON-RPC.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ When `Transaction` is included in any response, there will be an additional fiel
286286
* [chain_getBlockByHash](#chain_getblockbyhash)
287287
* [chain_getBlockTransactionCountByHash](#chain_getblocktransactioncountbyhash)
288288
* [chain_getTransaction](#chain_gettransaction)
289-
* [chain_containTransaction](#chain_containtransaction)
289+
* [chain_containsTransaction](#chain_containstransaction)
290290
* [chain_getTransactionByTracker](#chain_gettransactionbytracker)
291291
* [chain_getAssetSchemeByTracker](#chain_getassetschemebytracker)
292292
* [chain_getAssetSchemeByType](#chain_getassetschemebytype)
@@ -724,8 +724,8 @@ Errors: `Invalid Params`
724724

725725
[Back to **List of methods**](#list-of-methods)
726726

727-
## chain_containTransaction
728-
Returns true if the transaction with the given hass is in the chain.
727+
## chain_containsTransaction
728+
Returns true if the transaction with the given hash is in the chain.
729729

730730
### Params
731731
1. transaction hash - `H256`
@@ -739,7 +739,7 @@ Errors: `Invalid Params`
739739
```
740740
curl \
741741
-H 'Content-Type: application/json' \
742-
-d '{"jsonrpc": "2.0", "method": "chain_containTransaction", "params": ["0xad708d48755ac36685280a45ec213941e21c41644c781bf2f487fd6c7e4b2ebb"], "id": null}' \
742+
-d '{"jsonrpc": "2.0", "method": "chain_containsTransaction", "params": ["0xad708d48755ac36685280a45ec213941e21c41644c781bf2f487fd6c7e4b2ebb"], "id": null}' \
743743
localhost:8080
744744
```
745745

0 commit comments

Comments
 (0)