File tree Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -177,11 +177,17 @@ where
177177 }
178178
179179 fn get_block_by_number ( & self , block_number : u64 ) -> Result < Option < Block > > {
180- Ok ( self . client . block ( BlockId :: Number ( block_number) ) . map ( |block| block. decode ( ) . into ( ) ) )
180+ Ok ( self
181+ . client
182+ . block ( BlockId :: Number ( block_number) )
183+ . map ( |block| Block :: from_core ( block. decode ( ) , self . client . common_params ( ) . network_id ) ) )
181184 }
182185
183186 fn get_block_by_hash ( & self , block_hash : H256 ) -> Result < Option < Block > > {
184- Ok ( self . client . block ( BlockId :: Hash ( block_hash) ) . map ( |block| block. decode ( ) . into ( ) ) )
187+ Ok ( self
188+ . client
189+ . block ( BlockId :: Hash ( block_hash) )
190+ . map ( |block| Block :: from_core ( block. decode ( ) , self . client . common_params ( ) . network_id ) ) )
185191 }
186192
187193 fn get_pending_parcels ( & self ) -> Result < Vec < Parcel > > {
Original file line number Diff line number Diff line change 1515// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
1717use ccore:: Block as CoreBlock ;
18- use ckey:: Address ;
18+ use ckey:: { NetworkId , PlatformAddress } ;
1919use ctypes:: BlockNumber ;
2020use primitives:: { H256 , U256 } ;
2121
@@ -27,7 +27,7 @@ pub struct Block {
2727 parent_hash : H256 ,
2828 timestamp : u64 ,
2929 number : u64 ,
30- author : Address ,
30+ author : PlatformAddress ,
3131
3232 extra_data : Vec < u8 > ,
3333
@@ -42,15 +42,16 @@ pub struct Block {
4242 parcels : Vec < Parcel > ,
4343}
4444
45- impl From < CoreBlock > for Block {
46- fn from ( block : CoreBlock ) -> Self {
45+ impl Block {
46+ pub fn from_core ( block : CoreBlock , network_id : NetworkId ) -> Self {
4747 let block_number = block. header . number ( ) ;
4848 let block_hash = block. header . hash ( ) ;
49+ const VERSION : u8 = 0 ;
4950 Block {
5051 parent_hash : block. header . parent_hash ( ) . clone ( ) ,
5152 timestamp : block. header . timestamp ( ) ,
5253 number : block. header . number ( ) ,
53- author : block. header . author ( ) . clone ( ) ,
54+ author : PlatformAddress :: create ( VERSION , network_id , block. header . author ( ) . clone ( ) ) ,
5455
5556 extra_data : block. header . extra_data ( ) . clone ( ) ,
5657
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ A base32 string that starts with "ccc" or "tcc". See [the specification](https:/
2525
2626## Block
2727
28- - author: ` H160 `
28+ - author: ` PlatformAddress `
2929 - extraData: ` any[] `
3030 - hash: ` H256 `
3131 - invoicesRoot: ` H256 `
@@ -333,7 +333,7 @@ Response Example
333333{
334334 "jsonrpc":"2.0",
335335 "result":{
336- "author":"0x84137e7a75043bed32e4458a45da7549a8169b4d ",
336+ "author":"cccqzzpxln6w5zrhmfju3zc53w6w4y6s95mf5lfasfn ",
337337 "extraData":[
338338
339339 ],
You can’t perform that action at this time.
0 commit comments