kaspad/app/rpc/rpchandlers/notify_block_added.go
stasatdaglabs 3d8c131fa8
[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.
2020-09-23 13:11:31 +03:00

20 lines
631 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"
)
// HandleNotifyBlockAdded handles the respectively named RPC command
func HandleNotifyBlockAdded(context *rpccontext.Context, router *router.Router, _ appmessage.Message) (appmessage.Message, error) {
listener, err := context.NotificationManager.Listener(router)
if err != nil {
return nil, err
}
listener.PropagateBlockAddedNotifications()
response := appmessage.NewNotifyBlockAddedResponseMessage()
return response, nil
}