@@ -31,7 +31,10 @@ async fn at_genesis() {
31
31
let binding = Arc :: clone ( & chain_config) ;
32
32
let expected_genesis_id = binding. genesis_block ( ) . get_id ( ) ;
33
33
34
- _ = tx. send ( expected_genesis_id) ;
34
+ _ = tx. send ( json ! ( {
35
+ "block_height" : 0 ,
36
+ "block_id" : expected_genesis_id. to_hash( ) . encode_hex:: <String >( ) ,
37
+ } ) ) ;
35
38
36
39
let storage = TransactionalApiServerInMemoryStorage :: new ( & chain_config) ;
37
40
@@ -54,17 +57,12 @@ async fn at_genesis() {
54
57
55
58
assert_eq ! ( response. status( ) , 200 ) ;
56
59
57
- let expected_genesis_id = rx. await . unwrap ( ) ;
58
-
59
60
let body = response. text ( ) . await . unwrap ( ) ;
60
61
let body: serde_json:: Value = serde_json:: from_str ( & body) . unwrap ( ) ;
61
62
62
- assert_eq ! ( body [ "block_height" ] . as_u64 ( ) . unwrap( ) , 0 ) ;
63
+ let expected_tip = rx . await . unwrap ( ) ;
63
64
64
- assert_eq ! (
65
- body[ "block_id" ] . as_str( ) . unwrap( ) ,
66
- expected_genesis_id. to_hash( ) . encode_hex:: <String >( )
67
- ) ;
65
+ assert_eq ! ( body, expected_tip) ;
68
66
69
67
task. abort ( ) ;
70
68
}
@@ -101,7 +99,10 @@ async fn height_n(#[case] seed: Seed) {
101
99
// Need the "- 1" to account for the genesis block not in the vec
102
100
let expected_block_id = chainstate_block_ids[ n_blocks - 1 ] ;
103
101
104
- _ = tx. send ( ( n_blocks, expected_block_id) ) ;
102
+ _ = tx. send ( json ! ( {
103
+ "block_height" : n_blocks,
104
+ "block_id" : expected_block_id,
105
+ } ) ) ;
105
106
106
107
chainstate_block_ids
107
108
. iter ( )
@@ -141,18 +142,12 @@ async fn height_n(#[case] seed: Seed) {
141
142
142
143
assert_eq ! ( response. status( ) , 200 ) ;
143
144
144
- let ( height, expected_block_id) = rx. await . unwrap ( ) ;
145
-
146
145
let body = response. text ( ) . await . unwrap ( ) ;
147
146
let body: serde_json:: Value = serde_json:: from_str ( & body) . unwrap ( ) ;
148
- let _body = body. as_object ( ) . unwrap ( ) ;
149
147
150
- assert_eq ! ( body [ "block_height" ] . as_u64 ( ) . unwrap( ) , height as u64 ) ;
148
+ let expected_tip = rx . await . unwrap ( ) ;
151
149
152
- assert_eq ! (
153
- body[ "block_id" ] . as_str( ) . unwrap( ) ,
154
- expected_block_id. to_hash( ) . encode_hex:: <String >( )
155
- ) ;
150
+ assert_eq ! ( body, expected_tip) ;
156
151
157
152
task. abort ( ) ;
158
153
}
0 commit comments