mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-09-13 21:10:12 +00:00

* [NOD-1404] Remove most of the notification manager to fix a deadlock. * [NOD-1404] Rename a couple of fields. * [NOD-1404] Fix merge errors. * [NOD-1404] Remove most of the notification manager to fix a deadlock (#935) * [NOD-1404] Remove most of the notification manager to fix a deadlock. * [NOD-1404] Rename a couple of fields.
26 lines
856 B
Go
26 lines
856 B
Go
package rpchandlers
|
|
|
|
import (
|
|
"github.com/kaspanet/kaspad/app/appmessage"
|
|
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
|
|
"github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
|
|
)
|
|
|
|
// HandleNotifyChainChanged handles the respectively named RPC command
|
|
func HandleNotifyChainChanged(context *rpccontext.Context, router *router.Router, _ appmessage.Message) (appmessage.Message, error) {
|
|
if context.AcceptanceIndex == nil {
|
|
errorMessage := appmessage.NewNotifyChainChangedResponseMessage()
|
|
errorMessage.Error = appmessage.RPCErrorf("Acceptance index is not available")
|
|
return errorMessage, nil
|
|
}
|
|
|
|
listener, err := context.NotificationManager.Listener(router)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
listener.PropagateChainChangedNotifications()
|
|
|
|
response := appmessage.NewNotifyChainChangedResponseMessage()
|
|
return response, nil
|
|
}
|