File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -1153,6 +1153,10 @@ func (bc *BlockChain) Stop() {
1153
1153
}
1154
1154
}
1155
1155
}
1156
+ // Allow tracers to clean-up and release resources.
1157
+ if bc .logger != nil && bc .logger .OnClose != nil {
1158
+ bc .logger .OnClose ()
1159
+ }
1156
1160
// Close the trie database, release all the held resources as the last step.
1157
1161
if err := bc .triedb .Close (); err != nil {
1158
1162
log .Error ("Failed to close trie database" , "err" , err )
Original file line number Diff line number Diff line change @@ -107,6 +107,9 @@ type (
107
107
// BlockchainInitHook is called when the blockchain is initialized.
108
108
BlockchainInitHook = func (chainConfig * params.ChainConfig )
109
109
110
+ // CloseHook is called when the blockchain closes.
111
+ CloseHook = func ()
112
+
110
113
// BlockStartHook is called before executing `block`.
111
114
// `td` is the total difficulty prior to `block`.
112
115
BlockStartHook = func (event BlockEvent )
@@ -153,6 +156,7 @@ type Hooks struct {
153
156
OnGasChange GasChangeHook
154
157
// Chain events
155
158
OnBlockchainInit BlockchainInitHook
159
+ OnClose CloseHook
156
160
OnBlockStart BlockStartHook
157
161
OnBlockEnd BlockEndHook
158
162
OnSkippedBlock SkippedBlockHook
You can’t perform that action at this time.
0 commit comments