@@ -48,7 +48,7 @@ func init() {
48
48
DepsFunc : func (cDeps dependencies ) { deps = cDeps },
49
49
Configure : configure ,
50
50
Params : params ,
51
- IsEnabled : func (c * dig.Container ) bool {
51
+ IsEnabled : func (_ * dig.Container ) bool {
52
52
return restapi .ParamsRestAPI .Enabled && ParamsDebugAPI .Enabled
53
53
},
54
54
}
@@ -90,11 +90,13 @@ func configure() error {
90
90
91
91
routeGroup := deps .RestRouteManager .AddRoute ("debug/v2" )
92
92
93
+ debugAPIWorkerPool := workerpool .NewGroup ("DebugAPI" ).CreatePool ("DebugAPI" , workerpool .WithWorkerCount (1 ))
94
+
93
95
deps .Protocol .Events .Engine .BlockDAG .BlockAttached .Hook (func (block * blocks.Block ) {
94
96
blocksPerSlot .Set (block .ID ().Slot (), append (lo .Return1 (blocksPerSlot .GetOrCreate (block .ID ().Slot (), func () []* blocks.Block {
95
97
return make ([]* blocks.Block , 0 )
96
98
})), block ))
97
- })
99
+ }, event . WithWorkerPool ( debugAPIWorkerPool ) )
98
100
99
101
deps .Protocol .Events .Engine .SlotGadget .SlotFinalized .Hook (func (index iotago.SlotIndex ) {
100
102
epoch := deps .Protocol .APIForSlot (index ).TimeProvider ().EpochFromSlot (index )
@@ -113,23 +115,24 @@ func configure() error {
113
115
}
114
116
}
115
117
116
- }, event .WithWorkerPool (workerpool . NewGroup ( "DebugAPI" ). CreatePool ( "PruneDebugAPI" , workerpool . WithWorkerCount ( 1 )) ))
118
+ }, event .WithWorkerPool (debugAPIWorkerPool ))
117
119
118
120
deps .Protocol .Events .Engine .Notarization .SlotCommitted .Hook (func (scd * notarization.SlotCommittedDetails ) {
119
121
if err := storeTransactionsPerSlot (scd ); err != nil {
120
122
Component .LogWarnf (">> DebugAPI Error: %s\n " , err )
121
123
}
122
- })
124
+ }, event . WithWorkerPool ( debugAPIWorkerPool ) )
123
125
124
- deps .Protocol .Events .Engine .EvictionState . SlotEvicted .Hook (func (index iotago.SlotIndex ) {
126
+ deps .Protocol .Events .Engine .Evict .Hook (func (index iotago.SlotIndex ) {
125
127
blocksInSlot , exists := blocksPerSlot .Get (index )
126
128
if ! exists {
127
129
return
128
130
}
129
131
130
132
for _ , block := range blocksInSlot {
131
133
if block .ProtocolBlock () == nil {
132
- Component .LogInfof ("block is a root block" , block .ID ())
134
+ Component .LogInfof ("block is a root block %s" , block .ID ())
135
+
133
136
continue
134
137
}
135
138
@@ -146,7 +149,7 @@ func configure() error {
146
149
}
147
150
148
151
blocksPerSlot .Delete (index )
149
- })
152
+ }, event . WithWorkerPool ( debugAPIWorkerPool ) )
150
153
151
154
routeGroup .GET (RouteBlockMetadata , func (c echo.Context ) error {
152
155
blockID , err := httpserver .ParseBlockIDParam (c , api .ParameterBlockID )
0 commit comments