Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC: add client side ids to notification listeners. #2085

Open
wants to merge 21 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions app/appmessage/rpc_notify_block_added.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package appmessage
// NotifyBlockAddedRequestMessage is an appmessage corresponding to
// its respective RPC message
type NotifyBlockAddedRequestMessage struct {
ID string
baseMessage
}

Expand All @@ -12,14 +13,15 @@ func (msg *NotifyBlockAddedRequestMessage) Command() MessageCommand {
}

// NewNotifyBlockAddedRequestMessage returns a instance of the message
func NewNotifyBlockAddedRequestMessage() *NotifyBlockAddedRequestMessage {
return &NotifyBlockAddedRequestMessage{}
func NewNotifyBlockAddedRequestMessage(id string) *NotifyBlockAddedRequestMessage {
return &NotifyBlockAddedRequestMessage{ID: id}
}

// NotifyBlockAddedResponseMessage is an appmessage corresponding to
// its respective RPC message
type NotifyBlockAddedResponseMessage struct {
baseMessage
ID string
Error *RPCError
}

Expand All @@ -29,14 +31,15 @@ func (msg *NotifyBlockAddedResponseMessage) Command() MessageCommand {
}

// NewNotifyBlockAddedResponseMessage returns a instance of the message
func NewNotifyBlockAddedResponseMessage() *NotifyBlockAddedResponseMessage {
return &NotifyBlockAddedResponseMessage{}
func NewNotifyBlockAddedResponseMessage(id string) *NotifyBlockAddedResponseMessage {
return &NotifyBlockAddedResponseMessage{ID: id}
}

// BlockAddedNotificationMessage is an appmessage corresponding to
// its respective RPC message
type BlockAddedNotificationMessage struct {
baseMessage
ID string
Block *RPCBlock
}

Expand All @@ -46,8 +49,9 @@ func (msg *BlockAddedNotificationMessage) Command() MessageCommand {
}

// NewBlockAddedNotificationMessage returns a instance of the message
func NewBlockAddedNotificationMessage(block *RPCBlock) *BlockAddedNotificationMessage {
func NewBlockAddedNotificationMessage(block *RPCBlock, id string) *BlockAddedNotificationMessage {
return &BlockAddedNotificationMessage{
ID: id,
Block: block,
}
}
18 changes: 12 additions & 6 deletions app/appmessage/rpc_notify_finality_conflicts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package appmessage
// its respective RPC message
type NotifyFinalityConflictsRequestMessage struct {
baseMessage
ID string
}

// Command returns the protocol command string for the message
Expand All @@ -12,14 +13,15 @@ func (msg *NotifyFinalityConflictsRequestMessage) Command() MessageCommand {
}

// NewNotifyFinalityConflictsRequestMessage returns a instance of the message
func NewNotifyFinalityConflictsRequestMessage() *NotifyFinalityConflictsRequestMessage {
return &NotifyFinalityConflictsRequestMessage{}
func NewNotifyFinalityConflictsRequestMessage(id string) *NotifyFinalityConflictsRequestMessage {
return &NotifyFinalityConflictsRequestMessage{ID: id}
}

// NotifyFinalityConflictsResponseMessage is an appmessage corresponding to
// its respective RPC message
type NotifyFinalityConflictsResponseMessage struct {
baseMessage
ID string
Error *RPCError
}

Expand All @@ -29,14 +31,15 @@ func (msg *NotifyFinalityConflictsResponseMessage) Command() MessageCommand {
}

// NewNotifyFinalityConflictsResponseMessage returns a instance of the message
func NewNotifyFinalityConflictsResponseMessage() *NotifyFinalityConflictsResponseMessage {
return &NotifyFinalityConflictsResponseMessage{}
func NewNotifyFinalityConflictsResponseMessage(id string) *NotifyFinalityConflictsResponseMessage {
return &NotifyFinalityConflictsResponseMessage{ID: id}
}

// FinalityConflictNotificationMessage is an appmessage corresponding to
// its respective RPC message
type FinalityConflictNotificationMessage struct {
baseMessage
ID string
ViolatingBlockHash string
}

Expand All @@ -46,8 +49,9 @@ func (msg *FinalityConflictNotificationMessage) Command() MessageCommand {
}

// NewFinalityConflictNotificationMessage returns a instance of the message
func NewFinalityConflictNotificationMessage(violatingBlockHash string) *FinalityConflictNotificationMessage {
func NewFinalityConflictNotificationMessage(violatingBlockHash string, id string) *FinalityConflictNotificationMessage {
return &FinalityConflictNotificationMessage{
ID: id,
ViolatingBlockHash: violatingBlockHash,
}
}
Expand All @@ -56,6 +60,7 @@ func NewFinalityConflictNotificationMessage(violatingBlockHash string) *Finality
// its respective RPC message
type FinalityConflictResolvedNotificationMessage struct {
baseMessage
ID string
FinalityBlockHash string
}

Expand All @@ -65,8 +70,9 @@ func (msg *FinalityConflictResolvedNotificationMessage) Command() MessageCommand
}

// NewFinalityConflictResolvedNotificationMessage returns a instance of the message
func NewFinalityConflictResolvedNotificationMessage(finalityBlockHash string) *FinalityConflictResolvedNotificationMessage {
func NewFinalityConflictResolvedNotificationMessage(finalityBlockHash string, id string) *FinalityConflictResolvedNotificationMessage {
return &FinalityConflictResolvedNotificationMessage{
ID: id,
FinalityBlockHash: finalityBlockHash,
}
}
15 changes: 9 additions & 6 deletions app/appmessage/rpc_notify_new_block_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package appmessage
// its respective RPC message
type NotifyNewBlockTemplateRequestMessage struct {
baseMessage
ID string
}

// Command returns the protocol command string for the message
Expand All @@ -12,14 +13,15 @@ func (msg *NotifyNewBlockTemplateRequestMessage) Command() MessageCommand {
}

// NewNotifyNewBlockTemplateRequestMessage returns an instance of the message
func NewNotifyNewBlockTemplateRequestMessage() *NotifyNewBlockTemplateRequestMessage {
return &NotifyNewBlockTemplateRequestMessage{}
func NewNotifyNewBlockTemplateRequestMessage(id string) *NotifyNewBlockTemplateRequestMessage {
return &NotifyNewBlockTemplateRequestMessage{ID: id}
}

// NotifyNewBlockTemplateResponseMessage is an appmessage corresponding to
// its respective RPC message
type NotifyNewBlockTemplateResponseMessage struct {
baseMessage
ID string
Error *RPCError
}

Expand All @@ -29,14 +31,15 @@ func (msg *NotifyNewBlockTemplateResponseMessage) Command() MessageCommand {
}

// NewNotifyNewBlockTemplateResponseMessage returns an instance of the message
func NewNotifyNewBlockTemplateResponseMessage() *NotifyNewBlockTemplateResponseMessage {
return &NotifyNewBlockTemplateResponseMessage{}
func NewNotifyNewBlockTemplateResponseMessage(id string) *NotifyNewBlockTemplateResponseMessage {
return &NotifyNewBlockTemplateResponseMessage{ID: id}
}

// NewBlockTemplateNotificationMessage is an appmessage corresponding to
// its respective RPC message
type NewBlockTemplateNotificationMessage struct {
baseMessage
ID string
}

// Command returns the protocol command string for the message
Expand All @@ -45,6 +48,6 @@ func (msg *NewBlockTemplateNotificationMessage) Command() MessageCommand {
}

// NewNewBlockTemplateNotificationMessage returns an instance of the message
func NewNewBlockTemplateNotificationMessage() *NewBlockTemplateNotificationMessage {
return &NewBlockTemplateNotificationMessage{}
func NewNewBlockTemplateNotificationMessage(id string) *NewBlockTemplateNotificationMessage {
return &NewBlockTemplateNotificationMessage{ID: id}
}
25 changes: 15 additions & 10 deletions app/appmessage/rpc_notify_pruning_point_utxo_set_override.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package appmessage
// its respective RPC message
type NotifyPruningPointUTXOSetOverrideRequestMessage struct {
baseMessage
ID string
}

// Command returns the protocol command string for the message
Expand All @@ -12,14 +13,15 @@ func (msg *NotifyPruningPointUTXOSetOverrideRequestMessage) Command() MessageCom
}

// NewNotifyPruningPointUTXOSetOverrideRequestMessage returns a instance of the message
func NewNotifyPruningPointUTXOSetOverrideRequestMessage() *NotifyPruningPointUTXOSetOverrideRequestMessage {
return &NotifyPruningPointUTXOSetOverrideRequestMessage{}
func NewNotifyPruningPointUTXOSetOverrideRequestMessage(id string) *NotifyPruningPointUTXOSetOverrideRequestMessage {
return &NotifyPruningPointUTXOSetOverrideRequestMessage{ID: id}
}

// NotifyPruningPointUTXOSetOverrideResponseMessage is an appmessage corresponding to
// its respective RPC message
type NotifyPruningPointUTXOSetOverrideResponseMessage struct {
baseMessage
ID string
Error *RPCError
}

Expand All @@ -29,14 +31,15 @@ func (msg *NotifyPruningPointUTXOSetOverrideResponseMessage) Command() MessageCo
}

// NewNotifyPruningPointUTXOSetOverrideResponseMessage returns a instance of the message
func NewNotifyPruningPointUTXOSetOverrideResponseMessage() *NotifyPruningPointUTXOSetOverrideResponseMessage {
return &NotifyPruningPointUTXOSetOverrideResponseMessage{}
func NewNotifyPruningPointUTXOSetOverrideResponseMessage(id string) *NotifyPruningPointUTXOSetOverrideResponseMessage {
return &NotifyPruningPointUTXOSetOverrideResponseMessage{ID: id}
}

// PruningPointUTXOSetOverrideNotificationMessage is an appmessage corresponding to
// its respective RPC message
type PruningPointUTXOSetOverrideNotificationMessage struct {
baseMessage
ID string
}

// Command returns the protocol command string for the message
Expand All @@ -45,14 +48,15 @@ func (msg *PruningPointUTXOSetOverrideNotificationMessage) Command() MessageComm
}

// NewPruningPointUTXOSetOverrideNotificationMessage returns a instance of the message
func NewPruningPointUTXOSetOverrideNotificationMessage() *PruningPointUTXOSetOverrideNotificationMessage {
return &PruningPointUTXOSetOverrideNotificationMessage{}
func NewPruningPointUTXOSetOverrideNotificationMessage(id string) *PruningPointUTXOSetOverrideNotificationMessage {
return &PruningPointUTXOSetOverrideNotificationMessage{ID: id}
}

// StopNotifyingPruningPointUTXOSetOverrideRequestMessage is an appmessage corresponding to
// its respective RPC message
type StopNotifyingPruningPointUTXOSetOverrideRequestMessage struct {
baseMessage
ID string
}

// Command returns the protocol command string for the message
Expand All @@ -61,14 +65,15 @@ func (msg *StopNotifyingPruningPointUTXOSetOverrideRequestMessage) Command() Mes
}

// NewStopNotifyingPruningPointUTXOSetOverrideRequestMessage returns a instance of the message
func NewStopNotifyingPruningPointUTXOSetOverrideRequestMessage() *StopNotifyingPruningPointUTXOSetOverrideRequestMessage {
return &StopNotifyingPruningPointUTXOSetOverrideRequestMessage{}
func NewStopNotifyingPruningPointUTXOSetOverrideRequestMessage(id string) *StopNotifyingPruningPointUTXOSetOverrideRequestMessage {
return &StopNotifyingPruningPointUTXOSetOverrideRequestMessage{ID: id}
}

// StopNotifyingPruningPointUTXOSetOverrideResponseMessage is an appmessage corresponding to
// its respective RPC message
type StopNotifyingPruningPointUTXOSetOverrideResponseMessage struct {
baseMessage
ID string
Error *RPCError
}

Expand All @@ -78,6 +83,6 @@ func (msg *StopNotifyingPruningPointUTXOSetOverrideResponseMessage) Command() Me
}

// NewStopNotifyingPruningPointUTXOSetOverrideResponseMessage returns a instance of the message
func NewStopNotifyingPruningPointUTXOSetOverrideResponseMessage() *StopNotifyingPruningPointUTXOSetOverrideResponseMessage {
return &StopNotifyingPruningPointUTXOSetOverrideResponseMessage{}
func NewStopNotifyingPruningPointUTXOSetOverrideResponseMessage(id string) *StopNotifyingPruningPointUTXOSetOverrideResponseMessage {
return &StopNotifyingPruningPointUTXOSetOverrideResponseMessage{ID: id}
}
14 changes: 9 additions & 5 deletions app/appmessage/rpc_notify_utxos_changed.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package appmessage
// its respective RPC message
type NotifyUTXOsChangedRequestMessage struct {
baseMessage
ID string
Addresses []string
}

Expand All @@ -13,8 +14,9 @@ func (msg *NotifyUTXOsChangedRequestMessage) Command() MessageCommand {
}

// NewNotifyUTXOsChangedRequestMessage returns a instance of the message
func NewNotifyUTXOsChangedRequestMessage(addresses []string) *NotifyUTXOsChangedRequestMessage {
func NewNotifyUTXOsChangedRequestMessage(addresses []string, id string) *NotifyUTXOsChangedRequestMessage {
return &NotifyUTXOsChangedRequestMessage{
ID: id,
Addresses: addresses,
}
}
Expand All @@ -23,6 +25,7 @@ func NewNotifyUTXOsChangedRequestMessage(addresses []string) *NotifyUTXOsChanged
// its respective RPC message
type NotifyUTXOsChangedResponseMessage struct {
baseMessage
ID string
Error *RPCError
}

Expand All @@ -32,14 +35,15 @@ func (msg *NotifyUTXOsChangedResponseMessage) Command() MessageCommand {
}

// NewNotifyUTXOsChangedResponseMessage returns a instance of the message
func NewNotifyUTXOsChangedResponseMessage() *NotifyUTXOsChangedResponseMessage {
return &NotifyUTXOsChangedResponseMessage{}
func NewNotifyUTXOsChangedResponseMessage(id string) *NotifyUTXOsChangedResponseMessage {
return &NotifyUTXOsChangedResponseMessage{ID: id}
}

// UTXOsChangedNotificationMessage is an appmessage corresponding to
// its respective RPC message
type UTXOsChangedNotificationMessage struct {
baseMessage
ID string
Added []*UTXOsByAddressesEntry
Removed []*UTXOsByAddressesEntry
}
Expand All @@ -57,6 +61,6 @@ func (msg *UTXOsChangedNotificationMessage) Command() MessageCommand {
}

// NewUTXOsChangedNotificationMessage returns a instance of the message
func NewUTXOsChangedNotificationMessage() *UTXOsChangedNotificationMessage {
return &UTXOsChangedNotificationMessage{}
func NewUTXOsChangedNotificationMessage(id string) *UTXOsChangedNotificationMessage {
return &UTXOsChangedNotificationMessage{ID: id}
}
14 changes: 9 additions & 5 deletions app/appmessage/rpc_notify_virtual_daa_score_changed.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package appmessage
// its respective RPC message
type NotifyVirtualDaaScoreChangedRequestMessage struct {
baseMessage
ID string
}

// Command returns the protocol command string for the message
Expand All @@ -12,14 +13,15 @@ func (msg *NotifyVirtualDaaScoreChangedRequestMessage) Command() MessageCommand
}

// NewNotifyVirtualDaaScoreChangedRequestMessage returns a instance of the message
func NewNotifyVirtualDaaScoreChangedRequestMessage() *NotifyVirtualDaaScoreChangedRequestMessage {
return &NotifyVirtualDaaScoreChangedRequestMessage{}
func NewNotifyVirtualDaaScoreChangedRequestMessage(id string) *NotifyVirtualDaaScoreChangedRequestMessage {
return &NotifyVirtualDaaScoreChangedRequestMessage{ID: id}
}

// NotifyVirtualDaaScoreChangedResponseMessage is an appmessage corresponding to
// its respective RPC message
type NotifyVirtualDaaScoreChangedResponseMessage struct {
baseMessage
ID string
Error *RPCError
}

Expand All @@ -29,14 +31,15 @@ func (msg *NotifyVirtualDaaScoreChangedResponseMessage) Command() MessageCommand
}

// NewNotifyVirtualDaaScoreChangedResponseMessage returns a instance of the message
func NewNotifyVirtualDaaScoreChangedResponseMessage() *NotifyVirtualDaaScoreChangedResponseMessage {
return &NotifyVirtualDaaScoreChangedResponseMessage{}
func NewNotifyVirtualDaaScoreChangedResponseMessage(id string) *NotifyVirtualDaaScoreChangedResponseMessage {
return &NotifyVirtualDaaScoreChangedResponseMessage{ID: id}
}

// VirtualDaaScoreChangedNotificationMessage is an appmessage corresponding to
// its respective RPC message
type VirtualDaaScoreChangedNotificationMessage struct {
baseMessage
ID string
VirtualDaaScore uint64
}

Expand All @@ -47,9 +50,10 @@ func (msg *VirtualDaaScoreChangedNotificationMessage) Command() MessageCommand {

// NewVirtualDaaScoreChangedNotificationMessage returns a instance of the message
func NewVirtualDaaScoreChangedNotificationMessage(
virtualDaaScore uint64) *VirtualDaaScoreChangedNotificationMessage {
virtualDaaScore uint64, id string) *VirtualDaaScoreChangedNotificationMessage {

return &VirtualDaaScoreChangedNotificationMessage{
ID: id,
VirtualDaaScore: virtualDaaScore,
}
}
Loading