@@ -1055,8 +1055,8 @@ impl LightClient {
10551055 return Ok ( true ) ;
10561056 }
10571057
1058- // Get the first block's details, and make sure we can compute it from the last checkpoint
1059- // Note that we get the first block in the wallet (Not the last one). This is expected to be tip - 100 blocks.
1058+ // Get the oldest block's details, and make sure we can compute it from the last checkpoint
1059+ // Note that we get the oldest block in the wallet (Not the latest one). This is expected to be tip - 100 blocks.
10601060 // We use this block to prevent any reorg risk.
10611061 let ( end_height, _, end_tree) = match self . wallet . get_wallet_sapling_tree ( NodePosition :: Oldest ) . await {
10621062 Ok ( r) => r,
@@ -1079,10 +1079,12 @@ impl LightClient {
10791079 self . wallet . set_sapling_tree_verified ( ) ;
10801080 } else {
10811081 warn ! ( "Sapling tree verification failed!" ) ;
1082- warn ! (
1082+ let e = format ! (
10831083 "Verification Results:\n Calculated\n {}\n Expected\n {}\n " ,
10841084 start_tree, end_tree
10851085 ) ;
1086+ warn ! ( "{}" , e) ;
1087+ return Err ( e) ;
10861088 }
10871089
10881090 return Ok ( verified) ;
@@ -1100,7 +1102,8 @@ impl LightClient {
11001102
11011103 let h1 = tokio:: spawn ( async move {
11021104 let grpc_conn = GrpcConnector :: new ( uri) ;
1103- grpc_conn. get_block_range ( start_height, end_height, tx) . await
1105+ // Since both start and end block are inclusive, do start_height+1 to end_height
1106+ grpc_conn. get_block_range ( start_height + 1 , end_height, tx) . await
11041107 } ) ;
11051108
11061109 let commit_tree = commit_tree_computed. clone ( ) ;
@@ -1140,10 +1143,16 @@ impl LightClient {
11401143 self . wallet . set_sapling_tree_verified ( ) ;
11411144 } else {
11421145 warn ! ( "Sapling tree verification failed!" ) ;
1143- warn ! (
1144- "Verification Results:\n Calculated\n {}\n Expected\n {}\n " ,
1145- computed_tree, end_tree
1146+ let e = format ! (
1147+ "Verification Results:\n Computed@{}-{}\n {}\n Expected@{}\n {}\n " ,
1148+ start_height + 1 ,
1149+ end_height,
1150+ computed_tree,
1151+ end_height,
1152+ end_tree
11461153 ) ;
1154+ warn ! ( "{}" , e) ;
1155+ return Err ( e) ;
11471156 }
11481157
11491158 return Ok ( verified) ;
0 commit comments