@@ -182,8 +182,9 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg
182182
183183 // call the hooks with the BeginBlock messages
184184 for _ , streamingListener := range app .abciListeners {
185- if err := streamingListener .ListenBeginBlock (app .deliverState .ctx , req , res ); err != nil {
186- app .logger .Error ("BeginBlock listening hook failed" , "height" , req .Header .Height , "err" , err )
185+ goCtx := sdk .WrapSDKContext (app .deliverState .ctx )
186+ if err := streamingListener .ListenBeginBlock (goCtx , req , res ); err != nil {
187+ panic (fmt .Errorf ("BeginBlock listening hook failed, height: %d, err: %w" , req .Header .Height , err ))
187188 }
188189 }
189190
@@ -209,8 +210,9 @@ func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBloc
209210
210211 // call the streaming service hooks with the EndBlock messages
211212 for _ , streamingListener := range app .abciListeners {
212- if err := streamingListener .ListenEndBlock (app .deliverState .ctx , req , res ); err != nil {
213- app .logger .Error ("EndBlock listening hook failed" , "height" , req .Height , "err" , err )
213+ goCtx := sdk .WrapSDKContext (app .deliverState .ctx )
214+ if err := streamingListener .ListenEndBlock (goCtx , req , res ); err != nil {
215+ panic (fmt .Errorf ("EndBlock listening hook failed, height: %d, err: %w" , req .Height , err ))
214216 }
215217 }
216218
@@ -263,8 +265,9 @@ func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliv
263265
264266 defer func () {
265267 for _ , streamingListener := range app .abciListeners {
266- if err := streamingListener .ListenDeliverTx (app .deliverState .ctx , req , res ); err != nil {
267- app .logger .Error ("DeliverTx listening hook failed" , "err" , err )
268+ goCtx := sdk .WrapSDKContext (app .deliverState .ctx )
269+ if err := streamingListener .ListenDeliverTx (goCtx , req , res ); err != nil {
270+ panic (fmt .Errorf ("DeliverTx listening hook failed: %w" , err ))
268271 }
269272 }
270273 }()
@@ -301,7 +304,7 @@ func (app *BaseApp) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliv
301304// defined in config, Commit will execute a deferred function call to check
302305// against that height and gracefully halt if it matches the latest committed
303306// height.
304- func (app * BaseApp ) Commit () ( res abci.ResponseCommit ) {
307+ func (app * BaseApp ) Commit () abci.ResponseCommit {
305308 defer telemetry .MeasureSince (time .Now (), "abci" , "commit" )
306309
307310 header := app .deliverState .ctx .BlockHeader ()
@@ -312,6 +315,20 @@ func (app *BaseApp) Commit() (res abci.ResponseCommit) {
312315 // MultiStore (app.cms) so when Commit() is called is persists those values.
313316 app .deliverState .ms .Write ()
314317 commitID := app .cms .Commit ()
318+
319+ res := abci.ResponseCommit {
320+ Data : commitID .Hash ,
321+ RetainHeight : retainHeight ,
322+ }
323+
324+ // call the hooks with the Commit message
325+ for _ , streamingListener := range app .abciListeners {
326+ goCtx := sdk .WrapSDKContext (app .deliverState .ctx )
327+ if err := streamingListener .ListenCommit (goCtx , res ); err != nil {
328+ panic (fmt .Errorf ("Commit listening hook failed, height: %d, err: %w" , header .Height , err ))
329+ }
330+ }
331+
315332 app .logger .Info ("commit synced" , "commit" , fmt .Sprintf ("%X" , commitID ))
316333
317334 // Reset the Check state to the latest committed.
@@ -345,10 +362,7 @@ func (app *BaseApp) Commit() (res abci.ResponseCommit) {
345362 go app .snapshot (header .Height )
346363 }
347364
348- return abci.ResponseCommit {
349- Data : commitID .Hash ,
350- RetainHeight : retainHeight ,
351- }
365+ return res
352366}
353367
354368// halt attempts to gracefully shutdown the node via SIGINT and SIGTERM falling
0 commit comments