File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -69,9 +69,11 @@ impl ForwardApi for Service {
69
69
let list = r. into_inner ( ) ;
70
70
let round = RoundNumber :: from ( list. round ) ;
71
71
let bytes = Bytes :: from ( list. encode_to_vec ( ) ) ;
72
+ let mut is_new = false ;
72
73
let ( prev, bnum) = self
73
74
. cache
74
75
. get_or_insert_with ( & round, || -> Result < _ , Infallible > {
76
+ is_new = true ;
75
77
Ok ( (
76
78
bytes. clone ( ) ,
77
79
self . next_block . fetch_add ( 1 , Ordering :: Relaxed ) ,
@@ -82,13 +84,15 @@ impl ForwardApi for Service {
82
84
error ! ( %round, "inclusion list mismatch" ) ;
83
85
exit ( 1 )
84
86
}
85
- let block = Block {
86
- number : bnum,
87
- round : list. round ,
88
- payload : bytes,
89
- } ;
90
- if let Err ( err) = self . output . send ( block) {
91
- return Err ( Status :: internal ( err. to_string ( ) ) ) ;
87
+ if is_new {
88
+ let block = Block {
89
+ number : bnum,
90
+ round : list. round ,
91
+ payload : bytes,
92
+ } ;
93
+ if let Err ( err) = self . output . send ( block) {
94
+ return Err ( Status :: internal ( err. to_string ( ) ) ) ;
95
+ }
92
96
}
93
97
Ok ( Response :: new ( ( ) ) )
94
98
}
You can’t perform that action at this time.
0 commit comments