@@ -121,21 +121,25 @@ pub fn connect_block<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, block: &Block)
121
121
do_connect_block ( node, block, false ) ;
122
122
}
123
123
124
- fn do_connect_block < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , block : & Block , skip_manager : bool ) {
125
- let txdata: Vec < _ > = block. txdata . iter ( ) . enumerate ( ) . collect ( ) ;
124
+ fn do_connect_block < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , block : & Block , skip_intermediaries : bool ) {
126
125
let height = node. best_block_info ( ) . 1 + 1 ;
127
- node . chain_monitor . chain_monitor . block_connected ( & block . header , & txdata , height ) ;
128
- if !skip_manager {
126
+ if !skip_intermediaries {
127
+ let txdata : Vec < _ > = block . txdata . iter ( ) . enumerate ( ) . collect ( ) ;
129
128
match * node. connect_style . borrow ( ) {
130
129
ConnectStyle :: BestBlockFirst |ConnectStyle :: BestBlockFirstSkippingBlocks => {
130
+ node. chain_monitor . chain_monitor . update_best_block ( & block. header , height) ;
131
+ node. chain_monitor . chain_monitor . transactions_confirmed ( & block. header , & txdata, height) ;
131
132
node. node . update_best_block ( & block. header , height) ;
132
133
node. node . transactions_confirmed ( & block. header , height, & txdata) ;
133
134
} ,
134
135
ConnectStyle :: TransactionsFirst |ConnectStyle :: TransactionsFirstSkippingBlocks => {
136
+ node. chain_monitor . chain_monitor . transactions_confirmed ( & block. header , & txdata, height) ;
137
+ node. chain_monitor . chain_monitor . update_best_block ( & block. header , height) ;
135
138
node. node . transactions_confirmed ( & block. header , height, & txdata) ;
136
139
node. node . update_best_block ( & block. header , height) ;
137
140
} ,
138
141
ConnectStyle :: FullBlockViaListen => {
142
+ node. chain_monitor . chain_monitor . block_connected ( & block. header , & txdata, height) ;
139
143
Listen :: block_connected ( node. node , & block, height) ;
140
144
}
141
145
}
@@ -150,17 +154,19 @@ pub fn disconnect_blocks<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, count: u32)
150
154
assert ! ( orig_header. 1 > 0 ) ; // Cannot disconnect genesis
151
155
let prev_header = node. blocks . borrow ( ) . last ( ) . unwrap ( ) . clone ( ) ;
152
156
153
- node. chain_monitor . chain_monitor . block_disconnected ( & orig_header. 0 , orig_header. 1 ) ;
154
157
match * node. connect_style . borrow ( ) {
155
158
ConnectStyle :: FullBlockViaListen => {
159
+ node. chain_monitor . chain_monitor . block_disconnected ( & orig_header. 0 , orig_header. 1 ) ;
156
160
Listen :: block_disconnected ( node. node , & orig_header. 0 , orig_header. 1 ) ;
157
161
} ,
158
162
ConnectStyle :: BestBlockFirstSkippingBlocks |ConnectStyle :: TransactionsFirstSkippingBlocks => {
159
163
if i == count - 1 {
164
+ node. chain_monitor . chain_monitor . update_best_block ( & prev_header. 0 , prev_header. 1 ) ;
160
165
node. node . update_best_block ( & prev_header. 0 , prev_header. 1 ) ;
161
166
}
162
167
} ,
163
168
_ => {
169
+ node. chain_monitor . chain_monitor . update_best_block ( & prev_header. 0 , prev_header. 1 ) ;
164
170
node. node . update_best_block ( & prev_header. 0 , prev_header. 1 ) ;
165
171
} ,
166
172
}
0 commit comments