This commit is contained in:
D-Stacks 2022-06-16 09:17:59 +02:00
parent 1dc8bbf738
commit 1f25116a91
28 changed files with 85 additions and 85 deletions

View File

@ -21,7 +21,7 @@ func NewNotifyBlockAddedRequestMessage(id string) *NotifyBlockAddedRequestMessag
// its respective RPC message
type NotifyBlockAddedResponseMessage struct {
baseMessage
Id string
Id string
Error *RPCError
}
@ -39,7 +39,7 @@ func NewNotifyBlockAddedResponseMessage(id string) *NotifyBlockAddedResponseMess
// its respective RPC message
type BlockAddedNotificationMessage struct {
baseMessage
Id string
Id string
Block *RPCBlock
}
@ -51,7 +51,7 @@ func (msg *BlockAddedNotificationMessage) Command() MessageCommand {
// NewBlockAddedNotificationMessage returns a instance of the message
func NewBlockAddedNotificationMessage(block *RPCBlock, id string) *BlockAddedNotificationMessage {
return &BlockAddedNotificationMessage{
Id : id,
Id: id,
Block: block,
}
}

View File

@ -14,14 +14,14 @@ func (msg *NotifyFinalityConflictsRequestMessage) Command() MessageCommand {
// NewNotifyFinalityConflictsRequestMessage returns a instance of the message
func NewNotifyFinalityConflictsRequestMessage(id string) *NotifyFinalityConflictsRequestMessage {
return &NotifyFinalityConflictsRequestMessage{Id : id}
return &NotifyFinalityConflictsRequestMessage{Id: id}
}
// NotifyFinalityConflictsResponseMessage is an appmessage corresponding to
// its respective RPC message
type NotifyFinalityConflictsResponseMessage struct {
baseMessage
Id string
Id string
Error *RPCError
}
@ -32,14 +32,14 @@ func (msg *NotifyFinalityConflictsResponseMessage) Command() MessageCommand {
// NewNotifyFinalityConflictsResponseMessage returns a instance of the message
func NewNotifyFinalityConflictsResponseMessage(id string) *NotifyFinalityConflictsResponseMessage {
return &NotifyFinalityConflictsResponseMessage{Id : id}
return &NotifyFinalityConflictsResponseMessage{Id: id}
}
// FinalityConflictNotificationMessage is an appmessage corresponding to
// its respective RPC message
type FinalityConflictNotificationMessage struct {
baseMessage
Id string
Id string
ViolatingBlockHash string
}
@ -59,7 +59,7 @@ func NewFinalityConflictNotificationMessage(violatingBlockHash string, id string
// its respective RPC message
type FinalityConflictResolvedNotificationMessage struct {
baseMessage
Id string
Id string
FinalityBlockHash string
}
@ -71,7 +71,7 @@ func (msg *FinalityConflictResolvedNotificationMessage) Command() MessageCommand
// NewFinalityConflictResolvedNotificationMessage returns a instance of the message
func NewFinalityConflictResolvedNotificationMessage(finalityBlockHash string, id string) *FinalityConflictResolvedNotificationMessage {
return &FinalityConflictResolvedNotificationMessage{
Id : id,
Id: id,
FinalityBlockHash: finalityBlockHash,
}
}

View File

@ -21,7 +21,7 @@ func NewNotifyNewBlockTemplateRequestMessage(id string) *NotifyNewBlockTemplateR
// its respective RPC message
type NotifyNewBlockTemplateResponseMessage struct {
baseMessage
Id string
Id string
Error *RPCError
}

View File

@ -4,7 +4,7 @@ package appmessage
// its respective RPC message
type NotifyUTXOsChangedRequestMessage struct {
baseMessage
Id string
Id string
Addresses []string
}
@ -23,8 +23,8 @@ func NewNotifyUTXOsChangedRequestMessage(addresses []string, id string) *NotifyU
// NotifyUTXOsChangedResponseMessage is an appmessage corresponding to
// its respective RPC message
type NotifyUTXOsChangedResponseMessage struct {
baseMessage
Id string
baseMessage
Id string
Error *RPCError
}
@ -42,7 +42,7 @@ func NewNotifyUTXOsChangedResponseMessage(id string) *NotifyUTXOsChangedResponse
// its respective RPC message
type UTXOsChangedNotificationMessage struct {
baseMessage
Id string
Id string
Added []*UTXOsByAddressesEntry
Removed []*UTXOsByAddressesEntry
}

View File

@ -21,7 +21,7 @@ func NewNotifyVirtualDaaScoreChangedRequestMessage(id string) *NotifyVirtualDaaS
// its respective RPC message
type NotifyVirtualDaaScoreChangedResponseMessage struct {
baseMessage
Id string
Id string
Error *RPCError
}
@ -39,7 +39,7 @@ func NewNotifyVirtualDaaScoreChangedResponseMessage(id string) *NotifyVirtualDaa
// its respective RPC message
type VirtualDaaScoreChangedNotificationMessage struct {
baseMessage
Id string
Id string
VirtualDaaScore uint64
}
@ -53,7 +53,7 @@ func NewVirtualDaaScoreChangedNotificationMessage(
virtualDaaScore uint64, id string) *VirtualDaaScoreChangedNotificationMessage {
return &VirtualDaaScoreChangedNotificationMessage{
Id: id,
Id: id,
VirtualDaaScore: virtualDaaScore,
}
}

View File

@ -14,14 +14,14 @@ func (msg *NotifyVirtualSelectedParentBlueScoreChangedRequestMessage) Command()
// NewNotifyVirtualSelectedParentBlueScoreChangedRequestMessage returns a instance of the message
func NewNotifyVirtualSelectedParentBlueScoreChangedRequestMessage(id string) *NotifyVirtualSelectedParentBlueScoreChangedRequestMessage {
return &NotifyVirtualSelectedParentBlueScoreChangedRequestMessage{Id : id}
return &NotifyVirtualSelectedParentBlueScoreChangedRequestMessage{Id: id}
}
// NotifyVirtualSelectedParentBlueScoreChangedResponseMessage is an appmessage corresponding to
// its respective RPC message
type NotifyVirtualSelectedParentBlueScoreChangedResponseMessage struct {
baseMessage
Id string
Id string
Error *RPCError
}
@ -39,7 +39,7 @@ func NewNotifyVirtualSelectedParentBlueScoreChangedResponseMessage(id string) *N
// its respective RPC message
type VirtualSelectedParentBlueScoreChangedNotificationMessage struct {
baseMessage
Id string
Id string
VirtualSelectedParentBlueScore uint64
}
@ -53,7 +53,7 @@ func NewVirtualSelectedParentBlueScoreChangedNotificationMessage(
virtualSelectedParentBlueScore uint64, id string) *VirtualSelectedParentBlueScoreChangedNotificationMessage {
return &VirtualSelectedParentBlueScoreChangedNotificationMessage{
Id : id,
Id: id,
VirtualSelectedParentBlueScore: virtualSelectedParentBlueScore,
}
}

View File

@ -4,7 +4,7 @@ package appmessage
// its respective RPC message
type NotifyVirtualSelectedParentChainChangedRequestMessage struct {
baseMessage
Id string
Id string
IncludeAcceptedTransactionIDs bool
}
@ -18,7 +18,7 @@ func NewNotifyVirtualSelectedParentChainChangedRequestMessage(
includeAcceptedTransactionIDs bool, id string) *NotifyVirtualSelectedParentChainChangedRequestMessage {
return &NotifyVirtualSelectedParentChainChangedRequestMessage{
Id : id,
Id: id,
IncludeAcceptedTransactionIDs: includeAcceptedTransactionIDs,
}
}
@ -27,7 +27,7 @@ func NewNotifyVirtualSelectedParentChainChangedRequestMessage(
// its respective RPC message
type NotifyVirtualSelectedParentChainChangedResponseMessage struct {
baseMessage
Id string
Id string
Error *RPCError
}
@ -38,14 +38,14 @@ func (msg *NotifyVirtualSelectedParentChainChangedResponseMessage) Command() Mes
// NewNotifyVirtualSelectedParentChainChangedResponseMessage returns a instance of the message
func NewNotifyVirtualSelectedParentChainChangedResponseMessage(id string) *NotifyVirtualSelectedParentChainChangedResponseMessage {
return &NotifyVirtualSelectedParentChainChangedResponseMessage{Id : id}
return &NotifyVirtualSelectedParentChainChangedResponseMessage{Id: id}
}
// VirtualSelectedParentChainChangedNotificationMessage is an appmessage corresponding to
// its respective RPC message
type VirtualSelectedParentChainChangedNotificationMessage struct {
baseMessage
Id string
Id string
RemovedChainBlockHashes []string
AddedChainBlockHashes []string
AcceptedTransactionIDs []*AcceptedTransactionIDs
@ -61,7 +61,7 @@ func NewVirtualSelectedParentChainChangedNotificationMessage(removedChainBlockHa
addedChainBlocks []string, acceptedTransactionIDs []*AcceptedTransactionIDs, id string) *VirtualSelectedParentChainChangedNotificationMessage {
return &VirtualSelectedParentChainChangedNotificationMessage{
Id : id,
Id: id,
RemovedChainBlockHashes: removedChainBlockHashes,
AddedChainBlockHashes: addedChainBlocks,
AcceptedTransactionIDs: acceptedTransactionIDs,

View File

@ -4,7 +4,7 @@ package appmessage
// its respective RPC message
type StopNotifyingUTXOsChangedRequestMessage struct {
baseMessage
Id string
Id string
Addresses []string
}
@ -16,7 +16,7 @@ func (msg *StopNotifyingUTXOsChangedRequestMessage) Command() MessageCommand {
// NewStopNotifyingUTXOsChangedRequestMessage returns a instance of the message
func NewStopNotifyingUTXOsChangedRequestMessage(addresses []string, id string) *StopNotifyingUTXOsChangedRequestMessage {
return &StopNotifyingUTXOsChangedRequestMessage{
Id: id,
Id: id,
Addresses: addresses,
}
}
@ -25,7 +25,7 @@ func NewStopNotifyingUTXOsChangedRequestMessage(addresses []string, id string) *
// its respective RPC message
type StopNotifyingUTXOsChangedResponseMessage struct {
baseMessage
Id string
Id string
Error *RPCError
}

View File

@ -92,7 +92,7 @@ func (m *Manager) notifyBlockAddedToDAG(block *externalapi.DomainBlock) error {
if err != nil {
return err
}
blockAddedNotification := appmessage.NewBlockAddedNotificationMessage(rpcBlock,"")
blockAddedNotification := appmessage.NewBlockAddedNotificationMessage(rpcBlock, "")
err = m.context.NotificationManager.NotifyBlockAdded(blockAddedNotification)
if err != nil {
return err

View File

@ -33,24 +33,24 @@ type UTXOsChangedNotificationAddress struct {
type NotificationListener struct {
params *dagconfig.Params
propagateBlockAddedNotifications bool
propagateBlockAddedNotificationsId string
propagateVirtualSelectedParentChainChangedNotifications bool
propagateVirtualSelectedParentChainChangedNotificationsId string
propagateFinalityConflictNotifications bool
propagateFinalityConflictNotificationsId string
propagateFinalityConflictResolvedNotifications bool
propagateFinalityConflictResolvedNotificationsId string
propagateUTXOsChangedNotifications bool
propagateUTXOsChangedNotificationsId string
propagateVirtualSelectedParentBlueScoreChangedNotifications bool
propagateBlockAddedNotifications bool
propagateBlockAddedNotificationsId string
propagateVirtualSelectedParentChainChangedNotifications bool
propagateVirtualSelectedParentChainChangedNotificationsId string
propagateFinalityConflictNotifications bool
propagateFinalityConflictNotificationsId string
propagateFinalityConflictResolvedNotifications bool
propagateFinalityConflictResolvedNotificationsId string
propagateUTXOsChangedNotifications bool
propagateUTXOsChangedNotificationsId string
propagateVirtualSelectedParentBlueScoreChangedNotifications bool
propagateVirtualSelectedParentBlueScoreChangedNotificationsId string
propagateVirtualDaaScoreChangedNotifications bool
propagateVirtualDaaScoreChangedNotificationsId string
propagatePruningPointUTXOSetOverrideNotifications bool
propagatePruningPointUTXOSetOverrideNotificationsId string
propagateNewBlockTemplateNotifications bool
propagateNewBlockTemplateNotificationsId string
propagateVirtualDaaScoreChangedNotifications bool
propagateVirtualDaaScoreChangedNotificationsId string
propagatePruningPointUTXOSetOverrideNotifications bool
propagatePruningPointUTXOSetOverrideNotificationsId string
propagateNewBlockTemplateNotifications bool
propagateNewBlockTemplateNotificationsId string
propagateUTXOsChangedNotificationAddresses map[utxoindex.ScriptPublicKeyString]*UTXOsChangedNotificationAddress
includeAcceptedTransactionIDsInVirtualSelectedParentChainChangedNotifications bool
@ -176,9 +176,9 @@ func (nm *NotificationManager) NotifyFinalityConflict(notification *appmessage.F
for router, listener := range nm.listeners {
if listener.propagateFinalityConflictNotifications {
notification.Id = listener.propagateFinalityConflictNotificationsId
err := router.OutgoingRoute().Enqueue(notification)
if err != nil {
return err
@ -195,9 +195,9 @@ func (nm *NotificationManager) NotifyFinalityConflictResolved(notification *appm
for router, listener := range nm.listeners {
if listener.propagateFinalityConflictResolvedNotifications {
notification.Id = listener.propagateFinalityConflictResolvedNotificationsId
err := router.OutgoingRoute().Enqueue(notification)
if err != nil {
return err
@ -219,7 +219,7 @@ func (nm *NotificationManager) NotifyUTXOsChanged(utxoChanges *utxoindex.UTXOCha
if err != nil {
return err
}
notification.Id = listener.propagateUTXOsChangedNotificationsId
// Don't send the notification if it's empty
@ -247,9 +247,9 @@ func (nm *NotificationManager) NotifyVirtualSelectedParentBlueScoreChanged(
for router, listener := range nm.listeners {
if listener.propagateVirtualSelectedParentBlueScoreChangedNotifications {
notification.Id = listener.propagateVirtualSelectedParentBlueScoreChangedNotificationsId
err := router.OutgoingRoute().MaybeEnqueue(notification)
if err != nil {
return err
@ -269,9 +269,9 @@ func (nm *NotificationManager) NotifyVirtualDaaScoreChanged(
for router, listener := range nm.listeners {
if listener.propagateVirtualDaaScoreChangedNotifications {
notification.Id = listener.propagateVirtualDaaScoreChangedNotificationsId
err := router.OutgoingRoute().MaybeEnqueue(notification)
if err != nil {
return err
@ -291,9 +291,9 @@ func (nm *NotificationManager) NotifyNewBlockTemplate(
for router, listener := range nm.listeners {
if listener.propagateNewBlockTemplateNotifications {
notification.Id = listener.propagateNewBlockTemplateNotificationsId
err := router.OutgoingRoute().Enqueue(notification)
if err != nil {
return err

View File

@ -27,7 +27,7 @@ func HandleGetVirtualSelectedParentChainFromBlock(context *rpccontext.Context, _
}
chainChangedNotification, err := context.ConvertVirtualSelectedParentChainChangesToChainChangedNotificationMessage(
virtualSelectedParentChain, getVirtualSelectedParentChainFromBlockRequest.IncludeAcceptedTransactionIDs, rpccontext.DefaultNotificationId)
virtualSelectedParentChain, getVirtualSelectedParentChainFromBlockRequest.IncludeAcceptedTransactionIDs, rpccontext.DefaultNotificationId)
if err != nil {
return nil, err
}

View File

@ -8,9 +8,9 @@ import (
// HandleNotifyBlockAdded handles the respectively named RPC command
func HandleNotifyBlockAdded(context *rpccontext.Context, router *router.Router, request appmessage.Message) (appmessage.Message, error) {
notifyBlockAddedRequestMessage := request.(*appmessage.NotifyBlockAddedRequestMessage)
listener, err := context.NotificationManager.Listener(router)
if err != nil {
return nil, err

View File

@ -8,9 +8,9 @@ import (
// HandleNotifyFinalityConflicts handles the respectively named RPC command
func HandleNotifyFinalityConflicts(context *rpccontext.Context, router *router.Router, request appmessage.Message) (appmessage.Message, error) {
notifyFinalityConflictsRequest := request.(*appmessage.NotifyFinalityConflictsRequestMessage)
listener, err := context.NotificationManager.Listener(router)
if err != nil {
return nil, err

View File

@ -8,9 +8,9 @@ import (
// HandleNotifyNewBlockTemplate handles the respectively named RPC command
func HandleNotifyNewBlockTemplate(context *rpccontext.Context, router *router.Router, request appmessage.Message) (appmessage.Message, error) {
notifyNewBlockTemplateRequest := request.(*appmessage.NotifyNewBlockTemplateRequestMessage)
listener, err := context.NotificationManager.Listener(router)
if err != nil {
return nil, err

View File

@ -8,9 +8,9 @@ import (
// HandleNotifyPruningPointUTXOSetOverrideRequest handles the respectively named RPC command
func HandleNotifyPruningPointUTXOSetOverrideRequest(context *rpccontext.Context, router *router.Router, request appmessage.Message) (appmessage.Message, error) {
notifyPruningPointUTXOSetOverrideRequest := request.(*appmessage.NotifyPruningPointUTXOSetOverrideRequestMessage)
listener, err := context.NotificationManager.Listener(router)
if err != nil {
return nil, err

View File

@ -8,7 +8,7 @@ import (
// HandleNotifyUTXOsChanged handles the respectively named RPC command
func HandleNotifyUTXOsChanged(context *rpccontext.Context, router *router.Router, request appmessage.Message) (appmessage.Message, error) {
notifyUTXOsChangedRequest := request.(*appmessage.NotifyUTXOsChangedRequestMessage)
if !context.Config.UTXOIndex {

View File

@ -8,9 +8,9 @@ import (
// HandleNotifyVirtualDaaScoreChanged handles the respectively named RPC command
func HandleNotifyVirtualDaaScoreChanged(context *rpccontext.Context, router *router.Router, request appmessage.Message) (appmessage.Message, error) {
notifyVirtualDaaScoreChangedRequest := request.(*appmessage.NotifyVirtualDaaScoreChangedRequestMessage)
listener, err := context.NotificationManager.Listener(router)
if err != nil {
return nil, err

View File

@ -8,9 +8,9 @@ import (
// HandleNotifyVirtualSelectedParentBlueScoreChanged handles the respectively named RPC command
func HandleNotifyVirtualSelectedParentBlueScoreChanged(context *rpccontext.Context, router *router.Router, request appmessage.Message) (appmessage.Message, error) {
notifyVirtualSelectedParentBlueScoreChangedRequest := request.(*appmessage.NotifyVirtualSelectedParentBlueScoreChangedRequestMessage)
listener, err := context.NotificationManager.Listener(router)
if err != nil {
return nil, err

View File

@ -8,9 +8,9 @@ import (
// HandleStopNotifyingPruningPointUTXOSetOverrideRequest handles the respectively named RPC command
func HandleStopNotifyingPruningPointUTXOSetOverrideRequest(context *rpccontext.Context, router *router.Router, request appmessage.Message) (appmessage.Message, error) {
stopNotifyingPruningPointUTXOSetOverrideRequest := request.(*appmessage.StopNotifyingPruningPointUTXOSetOverrideRequestMessage)
listener, err := context.NotificationManager.Listener(router)
if err != nil {
return nil, err

View File

@ -8,7 +8,7 @@ import (
// HandleStopNotifyingUTXOsChanged handles the respectively named RPC command
func HandleStopNotifyingUTXOsChanged(context *rpccontext.Context, router *router.Router, request appmessage.Message) (appmessage.Message, error) {
stopNotifyingUTXOsChangedRequest := request.(*appmessage.StopNotifyingUTXOsChangedRequestMessage)
if !context.Config.UTXOIndex {

View File

@ -2,9 +2,9 @@ package rpcclient
import (
"github.com/kaspanet/kaspad/app/appmessage"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
routerpkg "github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
"github.com/pkg/errors"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
)
// RegisterForBlockAddedNotifications sends an RPC request respective to the function's name and returns the RPC server's response.

View File

@ -2,9 +2,9 @@ package rpcclient
import (
"github.com/kaspanet/kaspad/app/appmessage"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
routerpkg "github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
"github.com/pkg/errors"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
)
// RegisterForVirtualSelectedParentChainChangedNotifications sends an RPC request respective to the function's name and returns the RPC server's response.
@ -13,7 +13,7 @@ func (c *RPCClient) RegisterForVirtualSelectedParentChainChangedNotifications(in
onChainChanged func(notification *appmessage.VirtualSelectedParentChainChangedNotificationMessage)) error {
err := c.rpcRouter.outgoingRoute().Enqueue(
appmessage.NewNotifyVirtualSelectedParentChainChangedRequestMessage(includeAcceptedTransactionIDs, rpccontext.DefaultNotificationId))
appmessage.NewNotifyVirtualSelectedParentChainChangedRequestMessage(includeAcceptedTransactionIDs, rpccontext.DefaultNotificationId))
if err != nil {
return err
}

View File

@ -2,9 +2,9 @@ package rpcclient
import (
"github.com/kaspanet/kaspad/app/appmessage"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
routerpkg "github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
"github.com/pkg/errors"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
)
// RegisterForFinalityConflictsNotifications sends an RPC request respective to the function's name and returns the RPC server's response.

View File

@ -2,9 +2,9 @@ package rpcclient
import (
"github.com/kaspanet/kaspad/app/appmessage"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
routerpkg "github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
"github.com/pkg/errors"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
)
// RegisterForNewBlockTemplateNotifications sends an RPC request respective to the function's name and returns the RPC server's response.

View File

@ -2,9 +2,9 @@ package rpcclient
import (
"github.com/kaspanet/kaspad/app/appmessage"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
routerpkg "github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
"github.com/pkg/errors"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
)
// RegisterPruningPointUTXOSetNotifications sends an RPC request respective to the function's name and returns the RPC server's response.

View File

@ -2,9 +2,9 @@ package rpcclient
import (
"github.com/kaspanet/kaspad/app/appmessage"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
routerpkg "github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
"github.com/pkg/errors"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
)
// RegisterForUTXOsChangedNotifications sends an RPC request respective to the function's name and returns the RPC server's response.

View File

@ -2,9 +2,9 @@ package rpcclient
import (
"github.com/kaspanet/kaspad/app/appmessage"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
routerpkg "github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
"github.com/pkg/errors"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
)
// RegisterForVirtualDaaScoreChangedNotifications sends an RPC request respective to the function's

View File

@ -2,9 +2,9 @@ package rpcclient
import (
"github.com/kaspanet/kaspad/app/appmessage"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
routerpkg "github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
"github.com/pkg/errors"
"github.com/kaspanet/kaspad/app/rpc/rpccontext"
)
// RegisterForVirtualSelectedParentBlueScoreChangedNotifications sends an RPC request respective to the function's