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