@@ -2,7 +2,7 @@ use bigint::H256;
22use chain:: chain:: ChainProvider ;
33use ckb_pow:: Clicker ;
44use core:: header:: { BlockNumber , Header } ;
5- use core:: transaction:: { CellOutput , Transaction } ;
5+ use core:: transaction:: { OutPoint , Transaction } ;
66use jsonrpc_core:: { Error , IoHandler , Result } ;
77use jsonrpc_http_server:: ServerBuilder ;
88use jsonrpc_server_utils:: cors:: AccessControlAllowOrigin ;
@@ -11,7 +11,7 @@ use miner::{build_block_template, BlockTemplate};
1111use network:: NetworkService ;
1212use pool:: TransactionPool ;
1313use std:: sync:: Arc ;
14- use { BlockWithHash , Config , TransactionWithHash } ;
14+ use { BlockWithHash , CellOutputWithOutPoint , Config , TransactionWithHash } ;
1515
1616//TODO: build_rpc_trait! do not surppot trait bounds
1717build_rpc_trait ! {
@@ -46,7 +46,7 @@ build_rpc_trait! {
4646
4747 // curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_cells_by_redeem_script_hash","params": ["0x1b1c832d02fdb4339f9868c8a8636c3d9dd10bd53ac7ce99595825bd6beeffb3", 1, 10]}' -H 'content-type:application/json' 'http://localhost:3030'
4848 #[ rpc( name = "get_cells_by_redeem_script_hash" ) ]
49- fn get_cells_by_redeem_script_hash( & self , H256 , u64 , u64 ) -> Result <Vec <CellOutput >>;
49+ fn get_cells_by_redeem_script_hash( & self , H256 , u64 , u64 ) -> Result <Vec <CellOutputWithOutPoint >>;
5050
5151 #[ rpc( name = "local_node_id" ) ]
5252 fn local_node_id( & self ) -> Result <Option <String >>;
@@ -108,7 +108,7 @@ impl<C: ChainProvider + 'static> IntegrationTestRpc for RpcImpl<C> {
108108 redeem_script_hash : H256 ,
109109 from : u64 ,
110110 to : u64 ,
111- ) -> Result < Vec < CellOutput > > {
111+ ) -> Result < Vec < CellOutputWithOutPoint > > {
112112 let mut result = Vec :: new ( ) ;
113113 for block_number in from..=to {
114114 if let Some ( block_hash) = self . chain . block_hash ( block_number) {
@@ -123,7 +123,11 @@ impl<C: ChainProvider + 'static> IntegrationTestRpc for RpcImpl<C> {
123123 . ok_or_else ( Error :: internal_error) ?;
124124 for ( i, output) in transaction. outputs ( ) . iter ( ) . enumerate ( ) {
125125 if output. lock == redeem_script_hash && ( !transaction_meta. is_spent ( i) ) {
126- result. push ( output. clone ( ) ) ;
126+ result. push ( CellOutputWithOutPoint {
127+ outpoint : OutPoint :: new ( transaction. hash ( ) , i as u32 ) ,
128+ capacity : output. capacity ,
129+ lock : output. lock ,
130+ } ) ;
127131 }
128132 }
129133 }
0 commit comments