mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-21 06:16:45 +00:00

* protobuf for new block template notification structs * appmessage and wire for new block template notification structs * Set up the entire handler/call-chain for managing the new-block-template event
20 lines
655 B
Go
20 lines
655 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"
|
|
)
|
|
|
|
// HandleNotifyNewBlockTemplate handles the respectively named RPC command
|
|
func HandleNotifyNewBlockTemplate(context *rpccontext.Context, router *router.Router, _ appmessage.Message) (appmessage.Message, error) {
|
|
listener, err := context.NotificationManager.Listener(router)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
listener.PropagateNewBlockTemplateNotifications()
|
|
|
|
response := appmessage.NewNotifyNewBlockTemplateResponseMessage()
|
|
return response, nil
|
|
}
|