@@ -18,16 +18,13 @@ use std::collections::{HashMap, HashSet};
18
18
19
19
use ccore:: UnverifiedTransaction ;
20
20
use ctypes:: { BlockHash , Header } ;
21
- use primitives:: H256 ;
22
21
23
22
use super :: super :: message:: RequestMessage ;
24
23
25
24
#[ derive( Clone ) ]
26
25
struct Target {
27
26
hash : BlockHash ,
28
- parent_hash : BlockHash ,
29
- transactions_root : H256 ,
30
- transaction_root : H256 ,
27
+ is_empty : bool ,
31
28
}
32
29
33
30
#[ derive( Default ) ]
@@ -62,7 +59,7 @@ impl BodyDownloader {
62
59
if self . downloading . remove ( & hash) {
63
60
if body. is_empty ( ) {
64
61
let target = self . targets . iter ( ) . find ( |t| t. hash == hash) . expect ( "Downloading target must exist" ) ;
65
- if target . transaction_root != target. transactions_root {
62
+ if ! target. is_empty {
66
63
continue
67
64
}
68
65
}
@@ -72,13 +69,11 @@ impl BodyDownloader {
72
69
self . downloading . shrink_to_fit ( ) ;
73
70
}
74
71
75
- pub fn add_target ( & mut self , header : & Header , parent : & Header ) {
72
+ pub fn add_target ( & mut self , header : & Header , is_empty : bool ) {
76
73
cdebug ! ( SYNC , "Add download target: {}" , header. hash( ) ) ;
77
74
self . targets . push ( Target {
78
75
hash : header. hash ( ) ,
79
- parent_hash : parent. hash ( ) ,
80
- transactions_root : * header. transactions_root ( ) ,
81
- transaction_root : * parent. transactions_root ( ) ,
76
+ is_empty,
82
77
} ) ;
83
78
}
84
79
0 commit comments