mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-11-24 06:25:55 +00:00
Merge 93d9a753628cf6a9c776e16112096640622bca97 into 9ee409afaa6955b67e8c464af94c46aea9b77179
This commit is contained in:
commit
3cbcc08a96
@ -3,6 +3,7 @@ package appmessage
|
||||
// NotifyBlockAddedRequestMessage is an appmessage corresponding to
|
||||
// its respective RPC message
|
||||
type NotifyBlockAddedRequestMessage struct {
|
||||
ID string
|
||||
baseMessage
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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,
|
||||
}
|
||||
}
|
||||
@ -56,6 +60,7 @@ func NewFinalityConflictNotificationMessage(violatingBlockHash string) *Finality
|
||||
// its respective RPC message
|
||||
type FinalityConflictResolvedNotificationMessage struct {
|
||||
baseMessage
|
||||
ID string
|
||||
FinalityBlockHash string
|
||||
}
|
||||
|
||||
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -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}
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ package appmessage
|
||||
// its respective RPC message
|
||||
type NotifyUTXOsChangedRequestMessage struct {
|
||||
baseMessage
|
||||
ID string
|
||||
Addresses []string
|
||||
}
|
||||
|
||||
@ -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,
|
||||
}
|
||||
}
|
||||
@ -23,6 +25,7 @@ func NewNotifyUTXOsChangedRequestMessage(addresses []string) *NotifyUTXOsChanged
|
||||
// its respective RPC message
|
||||
type NotifyUTXOsChangedResponseMessage struct {
|
||||
baseMessage
|
||||
ID string
|
||||
Error *RPCError
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
@ -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}
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ package appmessage
|
||||
// its respective RPC message
|
||||
type NotifyVirtualSelectedParentBlueScoreChangedRequestMessage struct {
|
||||
baseMessage
|
||||
ID string
|
||||
}
|
||||
|
||||
// Command returns the protocol command string for the message
|
||||
@ -12,14 +13,15 @@ func (msg *NotifyVirtualSelectedParentBlueScoreChangedRequestMessage) Command()
|
||||
}
|
||||
|
||||
// NewNotifyVirtualSelectedParentBlueScoreChangedRequestMessage returns a instance of the message
|
||||
func NewNotifyVirtualSelectedParentBlueScoreChangedRequestMessage() *NotifyVirtualSelectedParentBlueScoreChangedRequestMessage {
|
||||
return &NotifyVirtualSelectedParentBlueScoreChangedRequestMessage{}
|
||||
func NewNotifyVirtualSelectedParentBlueScoreChangedRequestMessage(id string) *NotifyVirtualSelectedParentBlueScoreChangedRequestMessage {
|
||||
return &NotifyVirtualSelectedParentBlueScoreChangedRequestMessage{ID: id}
|
||||
}
|
||||
|
||||
// NotifyVirtualSelectedParentBlueScoreChangedResponseMessage is an appmessage corresponding to
|
||||
// its respective RPC message
|
||||
type NotifyVirtualSelectedParentBlueScoreChangedResponseMessage struct {
|
||||
baseMessage
|
||||
ID string
|
||||
Error *RPCError
|
||||
}
|
||||
|
||||
@ -29,14 +31,15 @@ func (msg *NotifyVirtualSelectedParentBlueScoreChangedResponseMessage) Command()
|
||||
}
|
||||
|
||||
// NewNotifyVirtualSelectedParentBlueScoreChangedResponseMessage returns a instance of the message
|
||||
func NewNotifyVirtualSelectedParentBlueScoreChangedResponseMessage() *NotifyVirtualSelectedParentBlueScoreChangedResponseMessage {
|
||||
return &NotifyVirtualSelectedParentBlueScoreChangedResponseMessage{}
|
||||
func NewNotifyVirtualSelectedParentBlueScoreChangedResponseMessage(id string) *NotifyVirtualSelectedParentBlueScoreChangedResponseMessage {
|
||||
return &NotifyVirtualSelectedParentBlueScoreChangedResponseMessage{ID: id}
|
||||
}
|
||||
|
||||
// VirtualSelectedParentBlueScoreChangedNotificationMessage is an appmessage corresponding to
|
||||
// its respective RPC message
|
||||
type VirtualSelectedParentBlueScoreChangedNotificationMessage struct {
|
||||
baseMessage
|
||||
ID string
|
||||
VirtualSelectedParentBlueScore uint64
|
||||
}
|
||||
|
||||
@ -47,9 +50,10 @@ func (msg *VirtualSelectedParentBlueScoreChangedNotificationMessage) Command() M
|
||||
|
||||
// NewVirtualSelectedParentBlueScoreChangedNotificationMessage returns a instance of the message
|
||||
func NewVirtualSelectedParentBlueScoreChangedNotificationMessage(
|
||||
virtualSelectedParentBlueScore uint64) *VirtualSelectedParentBlueScoreChangedNotificationMessage {
|
||||
virtualSelectedParentBlueScore uint64, id string) *VirtualSelectedParentBlueScoreChangedNotificationMessage {
|
||||
|
||||
return &VirtualSelectedParentBlueScoreChangedNotificationMessage{
|
||||
ID: id,
|
||||
VirtualSelectedParentBlueScore: virtualSelectedParentBlueScore,
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ package appmessage
|
||||
// its respective RPC message
|
||||
type NotifyVirtualSelectedParentChainChangedRequestMessage struct {
|
||||
baseMessage
|
||||
ID string
|
||||
IncludeAcceptedTransactionIDs bool
|
||||
}
|
||||
|
||||
@ -14,9 +15,10 @@ func (msg *NotifyVirtualSelectedParentChainChangedRequestMessage) Command() Mess
|
||||
|
||||
// NewNotifyVirtualSelectedParentChainChangedRequestMessage returns an instance of the message
|
||||
func NewNotifyVirtualSelectedParentChainChangedRequestMessage(
|
||||
includeAcceptedTransactionIDs bool) *NotifyVirtualSelectedParentChainChangedRequestMessage {
|
||||
includeAcceptedTransactionIDs bool, id string) *NotifyVirtualSelectedParentChainChangedRequestMessage {
|
||||
|
||||
return &NotifyVirtualSelectedParentChainChangedRequestMessage{
|
||||
ID: id,
|
||||
IncludeAcceptedTransactionIDs: includeAcceptedTransactionIDs,
|
||||
}
|
||||
}
|
||||
@ -25,6 +27,7 @@ func NewNotifyVirtualSelectedParentChainChangedRequestMessage(
|
||||
// its respective RPC message
|
||||
type NotifyVirtualSelectedParentChainChangedResponseMessage struct {
|
||||
baseMessage
|
||||
ID string
|
||||
Error *RPCError
|
||||
}
|
||||
|
||||
@ -34,14 +37,15 @@ func (msg *NotifyVirtualSelectedParentChainChangedResponseMessage) Command() Mes
|
||||
}
|
||||
|
||||
// NewNotifyVirtualSelectedParentChainChangedResponseMessage returns a instance of the message
|
||||
func NewNotifyVirtualSelectedParentChainChangedResponseMessage() *NotifyVirtualSelectedParentChainChangedResponseMessage {
|
||||
return &NotifyVirtualSelectedParentChainChangedResponseMessage{}
|
||||
func NewNotifyVirtualSelectedParentChainChangedResponseMessage(id string) *NotifyVirtualSelectedParentChainChangedResponseMessage {
|
||||
return &NotifyVirtualSelectedParentChainChangedResponseMessage{ID: id}
|
||||
}
|
||||
|
||||
// VirtualSelectedParentChainChangedNotificationMessage is an appmessage corresponding to
|
||||
// its respective RPC message
|
||||
type VirtualSelectedParentChainChangedNotificationMessage struct {
|
||||
baseMessage
|
||||
ID string
|
||||
RemovedChainBlockHashes []string
|
||||
AddedChainBlockHashes []string
|
||||
AcceptedTransactionIDs []*AcceptedTransactionIDs
|
||||
@ -54,9 +58,10 @@ func (msg *VirtualSelectedParentChainChangedNotificationMessage) Command() Messa
|
||||
|
||||
// NewVirtualSelectedParentChainChangedNotificationMessage returns a instance of the message
|
||||
func NewVirtualSelectedParentChainChangedNotificationMessage(removedChainBlockHashes,
|
||||
addedChainBlocks []string, acceptedTransactionIDs []*AcceptedTransactionIDs) *VirtualSelectedParentChainChangedNotificationMessage {
|
||||
addedChainBlocks []string, acceptedTransactionIDs []*AcceptedTransactionIDs, id string) *VirtualSelectedParentChainChangedNotificationMessage {
|
||||
|
||||
return &VirtualSelectedParentChainChangedNotificationMessage{
|
||||
ID: id,
|
||||
RemovedChainBlockHashes: removedChainBlockHashes,
|
||||
AddedChainBlockHashes: addedChainBlocks,
|
||||
AcceptedTransactionIDs: acceptedTransactionIDs,
|
||||
|
||||
@ -4,6 +4,7 @@ package appmessage
|
||||
// its respective RPC message
|
||||
type StopNotifyingUTXOsChangedRequestMessage struct {
|
||||
baseMessage
|
||||
ID string
|
||||
Addresses []string
|
||||
}
|
||||
|
||||
@ -13,8 +14,9 @@ func (msg *StopNotifyingUTXOsChangedRequestMessage) Command() MessageCommand {
|
||||
}
|
||||
|
||||
// NewStopNotifyingUTXOsChangedRequestMessage returns a instance of the message
|
||||
func NewStopNotifyingUTXOsChangedRequestMessage(addresses []string) *StopNotifyingUTXOsChangedRequestMessage {
|
||||
func NewStopNotifyingUTXOsChangedRequestMessage(addresses []string, id string) *StopNotifyingUTXOsChangedRequestMessage {
|
||||
return &StopNotifyingUTXOsChangedRequestMessage{
|
||||
ID: id,
|
||||
Addresses: addresses,
|
||||
}
|
||||
}
|
||||
@ -23,6 +25,7 @@ func NewStopNotifyingUTXOsChangedRequestMessage(addresses []string) *StopNotifyi
|
||||
// its respective RPC message
|
||||
type StopNotifyingUTXOsChangedResponseMessage struct {
|
||||
baseMessage
|
||||
ID string
|
||||
Error *RPCError
|
||||
}
|
||||
|
||||
@ -32,6 +35,6 @@ func (msg *StopNotifyingUTXOsChangedResponseMessage) Command() MessageCommand {
|
||||
}
|
||||
|
||||
// NewStopNotifyingUTXOsChangedResponseMessage returns a instance of the message
|
||||
func NewStopNotifyingUTXOsChangedResponseMessage() *StopNotifyingUTXOsChangedResponseMessage {
|
||||
return &StopNotifyingUTXOsChangedResponseMessage{}
|
||||
func NewStopNotifyingUTXOsChangedResponseMessage(id string) *StopNotifyingUTXOsChangedResponseMessage {
|
||||
return &StopNotifyingUTXOsChangedResponseMessage{ID: id}
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -141,7 +141,7 @@ func (m *Manager) notifyVirtualChange(virtualChangeSet *externalapi.VirtualChang
|
||||
// NotifyNewBlockTemplate notifies the manager that a new
|
||||
// block template is available for miners
|
||||
func (m *Manager) NotifyNewBlockTemplate() error {
|
||||
notification := appmessage.NewNewBlockTemplateNotificationMessage()
|
||||
notification := appmessage.NewNewBlockTemplateNotificationMessage("")
|
||||
return m.context.NotificationManager.NotifyNewBlockTemplate(notification)
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ func (m *Manager) NotifyFinalityConflict(violatingBlockHash string) error {
|
||||
onEnd := logger.LogAndMeasureExecutionTime(log, "RPCManager.NotifyFinalityConflict")
|
||||
defer onEnd()
|
||||
|
||||
notification := appmessage.NewFinalityConflictNotificationMessage(violatingBlockHash)
|
||||
notification := appmessage.NewFinalityConflictNotificationMessage(violatingBlockHash, rpccontext.DefaultNotificationID)
|
||||
return m.context.NotificationManager.NotifyFinalityConflict(notification)
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ func (m *Manager) NotifyFinalityConflictResolved(finalityBlockHash string) error
|
||||
onEnd := logger.LogAndMeasureExecutionTime(log, "RPCManager.NotifyFinalityConflictResolved")
|
||||
defer onEnd()
|
||||
|
||||
notification := appmessage.NewFinalityConflictResolvedNotificationMessage(finalityBlockHash)
|
||||
notification := appmessage.NewFinalityConflictResolvedNotificationMessage(finalityBlockHash, rpccontext.DefaultNotificationID)
|
||||
return m.context.NotificationManager.NotifyFinalityConflictResolved(notification)
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ func (m *Manager) notifyVirtualSelectedParentBlueScoreChanged(virtualSelectedPar
|
||||
onEnd := logger.LogAndMeasureExecutionTime(log, "RPCManager.NotifyVirtualSelectedParentBlueScoreChanged")
|
||||
defer onEnd()
|
||||
|
||||
notification := appmessage.NewVirtualSelectedParentBlueScoreChangedNotificationMessage(virtualSelectedParentBlueScore)
|
||||
notification := appmessage.NewVirtualSelectedParentBlueScoreChangedNotificationMessage(virtualSelectedParentBlueScore, rpccontext.DefaultNotificationID)
|
||||
return m.context.NotificationManager.NotifyVirtualSelectedParentBlueScoreChanged(notification)
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ func (m *Manager) notifyVirtualDaaScoreChanged(virtualDAAScore uint64) error {
|
||||
onEnd := logger.LogAndMeasureExecutionTime(log, "RPCManager.NotifyVirtualDaaScoreChanged")
|
||||
defer onEnd()
|
||||
|
||||
notification := appmessage.NewVirtualDaaScoreChangedNotificationMessage(virtualDAAScore)
|
||||
notification := appmessage.NewVirtualDaaScoreChangedNotificationMessage(virtualDAAScore, rpccontext.DefaultNotificationID)
|
||||
return m.context.NotificationManager.NotifyVirtualDaaScoreChanged(notification)
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ func (m *Manager) notifyVirtualSelectedParentChainChanged(virtualChangeSet *exte
|
||||
}
|
||||
|
||||
notification, err := m.context.ConvertVirtualSelectedParentChainChangesToChainChangedNotificationMessage(
|
||||
virtualChangeSet.VirtualSelectedParentChainChanges, includeAcceptedTransactionIDs)
|
||||
virtualChangeSet.VirtualSelectedParentChainChanges, includeAcceptedTransactionIDs, rpccontext.DefaultNotificationID) //DefaultNotificationId added in func
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
// ConvertVirtualSelectedParentChainChangesToChainChangedNotificationMessage converts
|
||||
// VirtualSelectedParentChainChanges to VirtualSelectedParentChainChangedNotificationMessage
|
||||
func (ctx *Context) ConvertVirtualSelectedParentChainChangesToChainChangedNotificationMessage(
|
||||
selectedParentChainChanges *externalapi.SelectedChainPath, includeAcceptedTransactionIDs bool) (
|
||||
selectedParentChainChanges *externalapi.SelectedChainPath, includeAcceptedTransactionIDs bool, id string) (
|
||||
*appmessage.VirtualSelectedParentChainChangedNotificationMessage, error) {
|
||||
|
||||
removedChainBlockHashes := make([]string, len(selectedParentChainChanges.Removed))
|
||||
@ -32,7 +32,7 @@ func (ctx *Context) ConvertVirtualSelectedParentChainChangesToChainChangedNotifi
|
||||
}
|
||||
|
||||
return appmessage.NewVirtualSelectedParentChainChangedNotificationMessage(
|
||||
removedChainBlockHashes, addedChainBlocks, acceptedTransactionIDs), nil
|
||||
removedChainBlockHashes, addedChainBlocks, acceptedTransactionIDs, id), nil
|
||||
}
|
||||
|
||||
func (ctx *Context) getAndConvertAcceptedTransactionIDs(selectedParentChainChanges *externalapi.SelectedChainPath) (
|
||||
|
||||
@ -14,6 +14,9 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// DefaultNotificationID corrosponds to defualt grpc string value, and hence id value when not supplied, or as placeholder
|
||||
const DefaultNotificationID string = ""
|
||||
|
||||
// NotificationManager manages notifications for the RPC
|
||||
type NotificationManager struct {
|
||||
sync.RWMutex
|
||||
@ -42,6 +45,16 @@ type NotificationListener struct {
|
||||
propagatePruningPointUTXOSetOverrideNotifications bool
|
||||
propagateNewBlockTemplateNotifications bool
|
||||
|
||||
propagateBlockAddedNotificationsID string
|
||||
propagateVirtualSelectedParentChainChangedNotificationsID string
|
||||
propagateFinalityConflictNotificationsID string
|
||||
propagateFinalityConflictResolvedNotificationsID string
|
||||
propagateUTXOsChangedNotificationsID string
|
||||
propagateVirtualSelectedParentBlueScoreChangedNotificationsID string
|
||||
propagateVirtualDaaScoreChangedNotificationsID string
|
||||
propagatePruningPointUTXOSetOverrideNotificationsID string
|
||||
propagateNewBlockTemplateNotificationsID string
|
||||
|
||||
propagateUTXOsChangedNotificationAddresses map[utxoindex.ScriptPublicKeyString]*UTXOsChangedNotificationAddress
|
||||
includeAcceptedTransactionIDsInVirtualSelectedParentChainChangedNotifications bool
|
||||
}
|
||||
@ -103,6 +116,9 @@ func (nm *NotificationManager) NotifyBlockAdded(notification *appmessage.BlockAd
|
||||
|
||||
for router, listener := range nm.listeners {
|
||||
if listener.propagateBlockAddedNotifications {
|
||||
|
||||
notification.ID = listener.propagateBlockAddedNotificationsID
|
||||
|
||||
err := router.OutgoingRoute().MaybeEnqueue(notification)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -120,6 +136,7 @@ func (nm *NotificationManager) NotifyVirtualSelectedParentChainChanged(
|
||||
defer nm.RUnlock()
|
||||
|
||||
notificationWithoutAcceptedTransactionIDs := &appmessage.VirtualSelectedParentChainChangedNotificationMessage{
|
||||
ID: DefaultNotificationID,
|
||||
RemovedChainBlockHashes: notification.RemovedChainBlockHashes,
|
||||
AddedChainBlockHashes: notification.AddedChainBlockHashes,
|
||||
}
|
||||
@ -129,8 +146,10 @@ func (nm *NotificationManager) NotifyVirtualSelectedParentChainChanged(
|
||||
var err error
|
||||
|
||||
if listener.includeAcceptedTransactionIDsInVirtualSelectedParentChainChangedNotifications {
|
||||
notification.ID = listener.propagateVirtualSelectedParentChainChangedNotificationsID
|
||||
err = router.OutgoingRoute().MaybeEnqueue(notification)
|
||||
} else {
|
||||
notificationWithoutAcceptedTransactionIDs.ID = listener.propagateVirtualSelectedParentChainChangedNotificationsID
|
||||
err = router.OutgoingRoute().MaybeEnqueue(notificationWithoutAcceptedTransactionIDs)
|
||||
}
|
||||
|
||||
@ -161,6 +180,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
|
||||
@ -177,6 +199,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
|
||||
@ -194,7 +219,7 @@ func (nm *NotificationManager) NotifyUTXOsChanged(utxoChanges *utxoindex.UTXOCha
|
||||
for router, listener := range nm.listeners {
|
||||
if listener.propagateUTXOsChangedNotifications {
|
||||
// Filter utxoChanges and create a notification
|
||||
notification, err := listener.convertUTXOChangesToUTXOsChangedNotification(utxoChanges)
|
||||
notification, err := listener.convertUTXOChangesToUTXOsChangedNotification(utxoChanges, listener.propagateUTXOsChangedNotificationsID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -224,6 +249,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
|
||||
@ -243,6 +271,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
|
||||
@ -262,6 +293,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
|
||||
@ -279,7 +313,7 @@ func (nm *NotificationManager) NotifyPruningPointUTXOSetOverride() error {
|
||||
|
||||
for router, listener := range nm.listeners {
|
||||
if listener.propagatePruningPointUTXOSetOverrideNotifications {
|
||||
err := router.OutgoingRoute().Enqueue(appmessage.NewPruningPointUTXOSetOverrideNotificationMessage())
|
||||
err := router.OutgoingRoute().Enqueue(appmessage.NewPruningPointUTXOSetOverrideNotificationMessage(listener.propagatePruningPointUTXOSetOverrideNotificationsID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -298,6 +332,7 @@ func newNotificationListener(params *dagconfig.Params) *NotificationListener {
|
||||
propagateFinalityConflictResolvedNotifications: false,
|
||||
propagateUTXOsChangedNotifications: false,
|
||||
propagateVirtualSelectedParentBlueScoreChangedNotifications: false,
|
||||
propagateVirtualDaaScoreChangedNotifications: false,
|
||||
propagateNewBlockTemplateNotifications: false,
|
||||
propagatePruningPointUTXOSetOverrideNotifications: false,
|
||||
}
|
||||
@ -311,26 +346,30 @@ func (nl *NotificationListener) IncludeAcceptedTransactionIDsInVirtualSelectedPa
|
||||
|
||||
// PropagateBlockAddedNotifications instructs the listener to send block added notifications
|
||||
// to the remote listener
|
||||
func (nl *NotificationListener) PropagateBlockAddedNotifications() {
|
||||
func (nl *NotificationListener) PropagateBlockAddedNotifications(id string) {
|
||||
nl.propagateBlockAddedNotificationsID = id
|
||||
nl.propagateBlockAddedNotifications = true
|
||||
}
|
||||
|
||||
// PropagateVirtualSelectedParentChainChangedNotifications instructs the listener to send chain changed notifications
|
||||
// to the remote listener
|
||||
func (nl *NotificationListener) PropagateVirtualSelectedParentChainChangedNotifications(includeAcceptedTransactionIDs bool) {
|
||||
func (nl *NotificationListener) PropagateVirtualSelectedParentChainChangedNotifications(includeAcceptedTransactionIDs bool, id string) {
|
||||
nl.propagateVirtualSelectedParentChainChangedNotificationsID = id
|
||||
nl.propagateVirtualSelectedParentChainChangedNotifications = true
|
||||
nl.includeAcceptedTransactionIDsInVirtualSelectedParentChainChangedNotifications = includeAcceptedTransactionIDs
|
||||
}
|
||||
|
||||
// PropagateFinalityConflictNotifications instructs the listener to send finality conflict notifications
|
||||
// to the remote listener
|
||||
func (nl *NotificationListener) PropagateFinalityConflictNotifications() {
|
||||
func (nl *NotificationListener) PropagateFinalityConflictNotifications(id string) {
|
||||
nl.propagateFinalityConflictNotificationsID = id
|
||||
nl.propagateFinalityConflictNotifications = true
|
||||
}
|
||||
|
||||
// PropagateFinalityConflictResolvedNotifications instructs the listener to send finality conflict resolved notifications
|
||||
// to the remote listener
|
||||
func (nl *NotificationListener) PropagateFinalityConflictResolvedNotifications() {
|
||||
func (nl *NotificationListener) PropagateFinalityConflictResolvedNotifications(id string) {
|
||||
nl.propagateFinalityConflictResolvedNotificationsID = id
|
||||
nl.propagateFinalityConflictResolvedNotifications = true
|
||||
}
|
||||
|
||||
@ -338,8 +377,9 @@ func (nl *NotificationListener) PropagateFinalityConflictResolvedNotifications()
|
||||
// to the remote listener for the given addresses. Subsequent calls instruct the listener to
|
||||
// send UTXOs changed notifications for those addresses along with the old ones. Duplicate addresses
|
||||
// are ignored.
|
||||
func (nl *NotificationListener) PropagateUTXOsChangedNotifications(addresses []*UTXOsChangedNotificationAddress) {
|
||||
func (nl *NotificationListener) PropagateUTXOsChangedNotifications(addresses []*UTXOsChangedNotificationAddress, id string) {
|
||||
if !nl.propagateUTXOsChangedNotifications {
|
||||
nl.propagateUTXOsChangedNotificationsID = id
|
||||
nl.propagateUTXOsChangedNotifications = true
|
||||
nl.propagateUTXOsChangedNotificationAddresses =
|
||||
make(map[utxoindex.ScriptPublicKeyString]*UTXOsChangedNotificationAddress, len(addresses))
|
||||
@ -364,14 +404,15 @@ func (nl *NotificationListener) StopPropagatingUTXOsChangedNotifications(address
|
||||
}
|
||||
|
||||
func (nl *NotificationListener) convertUTXOChangesToUTXOsChangedNotification(
|
||||
utxoChanges *utxoindex.UTXOChanges) (*appmessage.UTXOsChangedNotificationMessage, error) {
|
||||
utxoChanges *utxoindex.UTXOChanges, id string) (*appmessage.UTXOsChangedNotificationMessage, error) {
|
||||
|
||||
// As an optimization, we iterate over the smaller set (O(n)) among the two below
|
||||
// and check existence over the larger set (O(1))
|
||||
utxoChangesSize := len(utxoChanges.Added) + len(utxoChanges.Removed)
|
||||
addressesSize := len(nl.propagateUTXOsChangedNotificationAddresses)
|
||||
|
||||
notification := &appmessage.UTXOsChangedNotificationMessage{}
|
||||
notification := &appmessage.UTXOsChangedNotificationMessage{ID: id}
|
||||
|
||||
if utxoChangesSize < addressesSize {
|
||||
for scriptPublicKeyString, addedPairs := range utxoChanges.Added {
|
||||
if listenerAddress, ok := nl.propagateUTXOsChangedNotificationAddresses[scriptPublicKeyString]; ok {
|
||||
@ -441,30 +482,35 @@ func (nl *NotificationListener) scriptPubKeyStringToAddressString(scriptPublicKe
|
||||
|
||||
// PropagateVirtualSelectedParentBlueScoreChangedNotifications instructs the listener to send
|
||||
// virtual selected parent blue score notifications to the remote listener
|
||||
func (nl *NotificationListener) PropagateVirtualSelectedParentBlueScoreChangedNotifications() {
|
||||
func (nl *NotificationListener) PropagateVirtualSelectedParentBlueScoreChangedNotifications(id string) {
|
||||
nl.propagateVirtualSelectedParentBlueScoreChangedNotificationsID = id
|
||||
nl.propagateVirtualSelectedParentBlueScoreChangedNotifications = true
|
||||
}
|
||||
|
||||
// PropagateVirtualDaaScoreChangedNotifications instructs the listener to send
|
||||
// virtual DAA score notifications to the remote listener
|
||||
func (nl *NotificationListener) PropagateVirtualDaaScoreChangedNotifications() {
|
||||
func (nl *NotificationListener) PropagateVirtualDaaScoreChangedNotifications(id string) {
|
||||
nl.propagateVirtualDaaScoreChangedNotificationsID = id
|
||||
nl.propagateVirtualDaaScoreChangedNotifications = true
|
||||
}
|
||||
|
||||
// PropagateNewBlockTemplateNotifications instructs the listener to send
|
||||
// new block template notifications to the remote listener
|
||||
func (nl *NotificationListener) PropagateNewBlockTemplateNotifications() {
|
||||
func (nl *NotificationListener) PropagateNewBlockTemplateNotifications(id string) {
|
||||
nl.propagateNewBlockTemplateNotificationsID = id
|
||||
nl.propagateNewBlockTemplateNotifications = true
|
||||
}
|
||||
|
||||
// PropagatePruningPointUTXOSetOverrideNotifications instructs the listener to send pruning point UTXO set override notifications
|
||||
// to the remote listener.
|
||||
func (nl *NotificationListener) PropagatePruningPointUTXOSetOverrideNotifications() {
|
||||
func (nl *NotificationListener) PropagatePruningPointUTXOSetOverrideNotifications(id string) {
|
||||
nl.propagatePruningPointUTXOSetOverrideNotificationsID = id
|
||||
nl.propagatePruningPointUTXOSetOverrideNotifications = true
|
||||
}
|
||||
|
||||
// StopPropagatingPruningPointUTXOSetOverrideNotifications instructs the listener to stop sending pruning
|
||||
// point UTXO set override notifications to the remote listener.
|
||||
func (nl *NotificationListener) StopPropagatingPruningPointUTXOSetOverrideNotifications() {
|
||||
func (nl *NotificationListener) StopPropagatingPruningPointUTXOSetOverrideNotifications(id string) {
|
||||
nl.propagatePruningPointUTXOSetOverrideNotificationsID = id
|
||||
nl.propagatePruningPointUTXOSetOverrideNotifications = false
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ func HandleGetVirtualSelectedParentChainFromBlock(context *rpccontext.Context, _
|
||||
}
|
||||
|
||||
chainChangedNotification, err := context.ConvertVirtualSelectedParentChainChangesToChainChangedNotificationMessage(
|
||||
virtualSelectedParentChain, getVirtualSelectedParentChainFromBlockRequest.IncludeAcceptedTransactionIDs)
|
||||
virtualSelectedParentChain, getVirtualSelectedParentChainFromBlockRequest.IncludeAcceptedTransactionIDs, rpccontext.DefaultNotificationID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@ -7,13 +7,16 @@ import (
|
||||
)
|
||||
|
||||
// HandleNotifyBlockAdded handles the respectively named RPC command
|
||||
func HandleNotifyBlockAdded(context *rpccontext.Context, router *router.Router, _ appmessage.Message) (appmessage.Message, error) {
|
||||
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
|
||||
}
|
||||
listener.PropagateBlockAddedNotifications()
|
||||
listener.PropagateBlockAddedNotifications(notifyBlockAddedRequestMessage.ID)
|
||||
|
||||
response := appmessage.NewNotifyBlockAddedResponseMessage()
|
||||
response := appmessage.NewNotifyBlockAddedResponseMessage(notifyBlockAddedRequestMessage.ID)
|
||||
return response, nil
|
||||
}
|
||||
|
||||
@ -7,14 +7,17 @@ import (
|
||||
)
|
||||
|
||||
// HandleNotifyFinalityConflicts handles the respectively named RPC command
|
||||
func HandleNotifyFinalityConflicts(context *rpccontext.Context, router *router.Router, _ appmessage.Message) (appmessage.Message, error) {
|
||||
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
|
||||
}
|
||||
listener.PropagateFinalityConflictNotifications()
|
||||
listener.PropagateFinalityConflictResolvedNotifications()
|
||||
listener.PropagateFinalityConflictNotifications(notifyFinalityConflictsRequest.ID)
|
||||
listener.PropagateFinalityConflictResolvedNotifications(notifyFinalityConflictsRequest.ID)
|
||||
|
||||
response := appmessage.NewNotifyFinalityConflictsResponseMessage()
|
||||
response := appmessage.NewNotifyFinalityConflictsResponseMessage(notifyFinalityConflictsRequest.ID)
|
||||
return response, nil
|
||||
}
|
||||
|
||||
@ -7,13 +7,16 @@ import (
|
||||
)
|
||||
|
||||
// HandleNotifyNewBlockTemplate handles the respectively named RPC command
|
||||
func HandleNotifyNewBlockTemplate(context *rpccontext.Context, router *router.Router, _ appmessage.Message) (appmessage.Message, error) {
|
||||
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
|
||||
}
|
||||
listener.PropagateNewBlockTemplateNotifications()
|
||||
listener.PropagateNewBlockTemplateNotifications(notifyNewBlockTemplateRequest.ID)
|
||||
|
||||
response := appmessage.NewNotifyNewBlockTemplateResponseMessage()
|
||||
response := appmessage.NewNotifyNewBlockTemplateResponseMessage(notifyNewBlockTemplateRequest.ID)
|
||||
return response, nil
|
||||
}
|
||||
|
||||
@ -7,13 +7,16 @@ import (
|
||||
)
|
||||
|
||||
// HandleNotifyPruningPointUTXOSetOverrideRequest handles the respectively named RPC command
|
||||
func HandleNotifyPruningPointUTXOSetOverrideRequest(context *rpccontext.Context, router *router.Router, _ appmessage.Message) (appmessage.Message, error) {
|
||||
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
|
||||
}
|
||||
listener.PropagatePruningPointUTXOSetOverrideNotifications()
|
||||
listener.PropagatePruningPointUTXOSetOverrideNotifications(notifyPruningPointUTXOSetOverrideRequest.ID)
|
||||
|
||||
response := appmessage.NewNotifyPruningPointUTXOSetOverrideResponseMessage()
|
||||
response := appmessage.NewNotifyPruningPointUTXOSetOverrideResponseMessage(notifyPruningPointUTXOSetOverrideRequest.ID)
|
||||
return response, nil
|
||||
}
|
||||
|
||||
@ -8,16 +8,18 @@ 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 {
|
||||
errorMessage := appmessage.NewNotifyUTXOsChangedResponseMessage()
|
||||
errorMessage := appmessage.NewNotifyUTXOsChangedResponseMessage(notifyUTXOsChangedRequest.ID)
|
||||
errorMessage.Error = appmessage.RPCErrorf("Method unavailable when kaspad is run without --utxoindex")
|
||||
return errorMessage, nil
|
||||
}
|
||||
|
||||
notifyUTXOsChangedRequest := request.(*appmessage.NotifyUTXOsChangedRequestMessage)
|
||||
addresses, err := context.ConvertAddressStringsToUTXOsChangedNotificationAddresses(notifyUTXOsChangedRequest.Addresses)
|
||||
if err != nil {
|
||||
errorMessage := appmessage.NewNotifyUTXOsChangedResponseMessage()
|
||||
errorMessage := appmessage.NewNotifyUTXOsChangedResponseMessage(notifyUTXOsChangedRequest.ID)
|
||||
errorMessage.Error = appmessage.RPCErrorf("Parsing error: %s", err)
|
||||
return errorMessage, nil
|
||||
}
|
||||
@ -26,8 +28,8 @@ func HandleNotifyUTXOsChanged(context *rpccontext.Context, router *router.Router
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
listener.PropagateUTXOsChangedNotifications(addresses)
|
||||
listener.PropagateUTXOsChangedNotifications(addresses, notifyUTXOsChangedRequest.ID)
|
||||
|
||||
response := appmessage.NewNotifyUTXOsChangedResponseMessage()
|
||||
response := appmessage.NewNotifyUTXOsChangedResponseMessage(notifyUTXOsChangedRequest.ID)
|
||||
return response, nil
|
||||
}
|
||||
|
||||
@ -7,13 +7,16 @@ import (
|
||||
)
|
||||
|
||||
// HandleNotifyVirtualDaaScoreChanged handles the respectively named RPC command
|
||||
func HandleNotifyVirtualDaaScoreChanged(context *rpccontext.Context, router *router.Router, _ appmessage.Message) (appmessage.Message, error) {
|
||||
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
|
||||
}
|
||||
listener.PropagateVirtualDaaScoreChangedNotifications()
|
||||
listener.PropagateVirtualDaaScoreChangedNotifications(notifyVirtualDaaScoreChangedRequest.ID)
|
||||
|
||||
response := appmessage.NewNotifyVirtualDaaScoreChangedResponseMessage()
|
||||
response := appmessage.NewNotifyVirtualDaaScoreChangedResponseMessage(notifyVirtualDaaScoreChangedRequest.ID)
|
||||
return response, nil
|
||||
}
|
||||
|
||||
@ -7,13 +7,16 @@ import (
|
||||
)
|
||||
|
||||
// HandleNotifyVirtualSelectedParentBlueScoreChanged handles the respectively named RPC command
|
||||
func HandleNotifyVirtualSelectedParentBlueScoreChanged(context *rpccontext.Context, router *router.Router, _ appmessage.Message) (appmessage.Message, error) {
|
||||
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
|
||||
}
|
||||
listener.PropagateVirtualSelectedParentBlueScoreChangedNotifications()
|
||||
listener.PropagateVirtualSelectedParentBlueScoreChangedNotifications(notifyVirtualSelectedParentBlueScoreChangedRequest.ID)
|
||||
|
||||
response := appmessage.NewNotifyVirtualSelectedParentBlueScoreChangedResponseMessage()
|
||||
response := appmessage.NewNotifyVirtualSelectedParentBlueScoreChangedResponseMessage(notifyVirtualSelectedParentBlueScoreChangedRequest.ID)
|
||||
return response, nil
|
||||
}
|
||||
|
||||
@ -17,8 +17,9 @@ func HandleNotifyVirtualSelectedParentChainChanged(context *rpccontext.Context,
|
||||
return nil, err
|
||||
}
|
||||
listener.PropagateVirtualSelectedParentChainChangedNotifications(
|
||||
notifyVirtualSelectedParentChainChangedRequest.IncludeAcceptedTransactionIDs)
|
||||
notifyVirtualSelectedParentChainChangedRequest.IncludeAcceptedTransactionIDs,
|
||||
notifyVirtualSelectedParentChainChangedRequest.ID)
|
||||
|
||||
response := appmessage.NewNotifyVirtualSelectedParentChainChangedResponseMessage()
|
||||
response := appmessage.NewNotifyVirtualSelectedParentChainChangedResponseMessage(notifyVirtualSelectedParentChainChangedRequest.ID)
|
||||
return response, nil
|
||||
}
|
||||
|
||||
@ -7,13 +7,16 @@ import (
|
||||
)
|
||||
|
||||
// HandleStopNotifyingPruningPointUTXOSetOverrideRequest handles the respectively named RPC command
|
||||
func HandleStopNotifyingPruningPointUTXOSetOverrideRequest(context *rpccontext.Context, router *router.Router, _ appmessage.Message) (appmessage.Message, error) {
|
||||
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
|
||||
}
|
||||
listener.StopPropagatingPruningPointUTXOSetOverrideNotifications()
|
||||
listener.StopPropagatingPruningPointUTXOSetOverrideNotifications(stopNotifyingPruningPointUTXOSetOverrideRequest.ID)
|
||||
|
||||
response := appmessage.NewStopNotifyingPruningPointUTXOSetOverrideResponseMessage()
|
||||
response := appmessage.NewStopNotifyingPruningPointUTXOSetOverrideResponseMessage(stopNotifyingPruningPointUTXOSetOverrideRequest.ID)
|
||||
return response, nil
|
||||
}
|
||||
|
||||
@ -8,16 +8,18 @@ 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 {
|
||||
errorMessage := appmessage.NewStopNotifyingUTXOsChangedResponseMessage()
|
||||
errorMessage := appmessage.NewStopNotifyingUTXOsChangedResponseMessage(stopNotifyingUTXOsChangedRequest.ID)
|
||||
errorMessage.Error = appmessage.RPCErrorf("Method unavailable when kaspad is run without --utxoindex")
|
||||
return errorMessage, nil
|
||||
}
|
||||
|
||||
stopNotifyingUTXOsChangedRequest := request.(*appmessage.StopNotifyingUTXOsChangedRequestMessage)
|
||||
addresses, err := context.ConvertAddressStringsToUTXOsChangedNotificationAddresses(stopNotifyingUTXOsChangedRequest.Addresses)
|
||||
if err != nil {
|
||||
errorMessage := appmessage.NewNotifyUTXOsChangedResponseMessage()
|
||||
errorMessage := appmessage.NewNotifyUTXOsChangedResponseMessage(stopNotifyingUTXOsChangedRequest.ID)
|
||||
errorMessage.Error = appmessage.RPCErrorf("Parsing error: %s", err)
|
||||
return errorMessage, nil
|
||||
}
|
||||
@ -28,6 +30,6 @@ func HandleStopNotifyingUTXOsChanged(context *rpccontext.Context, router *router
|
||||
}
|
||||
listener.StopPropagatingUTXOsChangedNotifications(addresses)
|
||||
|
||||
response := appmessage.NewStopNotifyingUTXOsChangedResponseMessage()
|
||||
response := appmessage.NewStopNotifyingUTXOsChangedResponseMessage(stopNotifyingUTXOsChangedRequest.ID)
|
||||
return response, nil
|
||||
}
|
||||
|
||||
@ -492,6 +492,11 @@ NotifyBlockAddedRequestMessage registers this connection for blockAdded notifica
|
||||
See: BlockAddedNotificationMessage
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -504,6 +509,7 @@ See: BlockAddedNotificationMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| error | [RPCError](#protowire.RPCError) | | |
|
||||
|
||||
|
||||
@ -522,6 +528,7 @@ See: NotifyBlockAddedRequestMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| block | [RpcBlock](#protowire.RpcBlock) | | |
|
||||
|
||||
|
||||
@ -807,6 +814,7 @@ See: VirtualSelectedParentChainChangedNotificationMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| includeAcceptedTransactionIds | [bool](#bool) | | |
|
||||
|
||||
|
||||
@ -822,6 +830,7 @@ See: VirtualSelectedParentChainChangedNotificationMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| error | [RPCError](#protowire.RPCError) | | |
|
||||
|
||||
|
||||
@ -840,6 +849,7 @@ See: NotifyVirtualSelectedParentChainChangedRequestMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| removedChainBlockHashes | [string](#string) | repeated | The chain blocks that were removed, in high-to-low order |
|
||||
| addedChainBlockHashes | [string](#string) | repeated | The chain blocks that were added, in low-to-high order |
|
||||
| acceptedTransactionIds | [AcceptedTransactionIds](#protowire.AcceptedTransactionIds) | repeated | Will be filled only if `includeAcceptedTransactionIds = true` in the notify request. |
|
||||
@ -1099,6 +1109,11 @@ of this kaspad's DAG.
|
||||
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1111,6 +1126,7 @@ of this kaspad's DAG.
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| error | [RPCError](#protowire.RPCError) | | |
|
||||
|
||||
|
||||
@ -1126,6 +1142,7 @@ of this kaspad's DAG.
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| violatingBlockHash | [string](#string) | | |
|
||||
|
||||
|
||||
@ -1141,6 +1158,7 @@ of this kaspad's DAG.
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| finalityBlockHash | [string](#string) | | |
|
||||
|
||||
|
||||
@ -1220,6 +1238,7 @@ See: UtxosChangedNotificationMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| addresses | [string](#string) | repeated | Leave empty to get all updates |
|
||||
|
||||
|
||||
@ -1235,6 +1254,7 @@ See: UtxosChangedNotificationMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| error | [RPCError](#protowire.RPCError) | | |
|
||||
|
||||
|
||||
@ -1252,6 +1272,7 @@ See: NotifyUtxosChangedRequestMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| added | [UtxosByAddressesEntry](#protowire.UtxosByAddressesEntry) | repeated | |
|
||||
| removed | [UtxosByAddressesEntry](#protowire.UtxosByAddressesEntry) | repeated | |
|
||||
|
||||
@ -1290,6 +1311,7 @@ See: UtxosChangedNotificationMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| addresses | [string](#string) | repeated | |
|
||||
|
||||
|
||||
@ -1305,6 +1327,7 @@ See: UtxosChangedNotificationMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| error | [RPCError](#protowire.RPCError) | | |
|
||||
|
||||
|
||||
@ -1462,6 +1485,11 @@ virtualSelectedParentBlueScoreChanged notifications.
|
||||
See: VirtualSelectedParentBlueScoreChangedNotificationMessage
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1474,6 +1502,7 @@ See: VirtualSelectedParentBlueScoreChangedNotificationMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| error | [RPCError](#protowire.RPCError) | | |
|
||||
|
||||
|
||||
@ -1492,6 +1521,7 @@ See NotifyVirtualSelectedParentBlueScoreChangedRequestMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| virtualSelectedParentBlueScore | [uint64](#uint64) | | |
|
||||
|
||||
|
||||
@ -1508,6 +1538,11 @@ virtualDaaScoreChanged notifications.
|
||||
See: VirtualDaaScoreChangedNotificationMessage
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1520,6 +1555,7 @@ See: VirtualDaaScoreChangedNotificationMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| error | [RPCError](#protowire.RPCError) | | |
|
||||
|
||||
|
||||
@ -1538,6 +1574,7 @@ See NotifyVirtualDaaScoreChangedRequestMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| virtualDaaScore | [uint64](#uint64) | | |
|
||||
|
||||
|
||||
@ -1556,6 +1593,11 @@ This call is only available when this kaspad was started with `--utxoindex`
|
||||
See: NotifyPruningPointUTXOSetOverrideResponseMessage
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1568,6 +1610,7 @@ See: NotifyPruningPointUTXOSetOverrideResponseMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| error | [RPCError](#protowire.RPCError) | | |
|
||||
|
||||
|
||||
@ -1584,6 +1627,11 @@ resets due to pruning point change via IBD.
|
||||
See NotifyPruningPointUTXOSetOverrideRequestMessage
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1599,6 +1647,11 @@ This call is only available when this kaspad was started with `--utxoindex`
|
||||
See: PruningPointUTXOSetOverrideNotificationMessage
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1611,6 +1664,7 @@ See: PruningPointUTXOSetOverrideNotificationMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| error | [RPCError](#protowire.RPCError) | | |
|
||||
|
||||
|
||||
@ -1749,6 +1803,11 @@ NewBlockTemplate notifications.
|
||||
See: NewBlockTemplateNotificationMessage
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1761,6 +1820,7 @@ See: NewBlockTemplateNotificationMessage
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
| error | [RPCError](#protowire.RPCError) | | |
|
||||
|
||||
|
||||
@ -1777,6 +1837,11 @@ available for miners.
|
||||
See NotifyNewBlockTemplateRequestMessage
|
||||
|
||||
|
||||
| Field | Type | Label | Description |
|
||||
| ----- | ---- | ----- | ----------- |
|
||||
| id | [string](#string) | | |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -171,9 +171,12 @@ message GetBlockTemplateResponseMessage{
|
||||
//
|
||||
// See: BlockAddedNotificationMessage
|
||||
message NotifyBlockAddedRequestMessage{
|
||||
string id = 1001;
|
||||
|
||||
}
|
||||
|
||||
message NotifyBlockAddedResponseMessage{
|
||||
string id = 1001;
|
||||
RPCError error = 1000;
|
||||
}
|
||||
|
||||
@ -182,6 +185,7 @@ message NotifyBlockAddedResponseMessage{
|
||||
//
|
||||
// See: NotifyBlockAddedRequestMessage
|
||||
message BlockAddedNotificationMessage{
|
||||
string id = 1001;
|
||||
RpcBlock block = 3;
|
||||
}
|
||||
|
||||
@ -306,10 +310,12 @@ message SubmitTransactionResponseMessage{
|
||||
//
|
||||
// See: VirtualSelectedParentChainChangedNotificationMessage
|
||||
message NotifyVirtualSelectedParentChainChangedRequestMessage{
|
||||
string id = 1001;
|
||||
bool includeAcceptedTransactionIds = 1;
|
||||
}
|
||||
|
||||
message NotifyVirtualSelectedParentChainChangedResponseMessage{
|
||||
string id = 1001;
|
||||
RPCError error = 1000;
|
||||
}
|
||||
|
||||
@ -318,7 +324,9 @@ message NotifyVirtualSelectedParentChainChangedResponseMessage{
|
||||
//
|
||||
// See: NotifyVirtualSelectedParentChainChangedRequestMessage
|
||||
message VirtualSelectedParentChainChangedNotificationMessage{
|
||||
// The chain blocks that were removed, in high-to-low order
|
||||
string id = 1001;
|
||||
|
||||
// The chain blocks that were removed, in high-to-low order
|
||||
repeated string removedChainBlockHashes = 1;
|
||||
|
||||
// The chain blocks that were added, in low-to-high order
|
||||
@ -432,17 +440,21 @@ message ResolveFinalityConflictResponseMessage{
|
||||
}
|
||||
|
||||
message NotifyFinalityConflictsRequestMessage{
|
||||
string id = 1001;
|
||||
}
|
||||
|
||||
message NotifyFinalityConflictsResponseMessage{
|
||||
string id = 1001;
|
||||
RPCError error = 1000;
|
||||
}
|
||||
|
||||
message FinalityConflictNotificationMessage{
|
||||
string id = 1001;
|
||||
string violatingBlockHash = 1;
|
||||
}
|
||||
|
||||
message FinalityConflictResolvedNotificationMessage{
|
||||
string id = 1001;
|
||||
string finalityBlockHash = 1;
|
||||
}
|
||||
|
||||
@ -474,10 +486,12 @@ message GetHeadersResponseMessage{
|
||||
//
|
||||
// See: UtxosChangedNotificationMessage
|
||||
message NotifyUtxosChangedRequestMessage {
|
||||
string id = 1001;
|
||||
repeated string addresses = 1; // Leave empty to get all updates
|
||||
}
|
||||
|
||||
message NotifyUtxosChangedResponseMessage {
|
||||
string id = 1001;
|
||||
RPCError error = 1000;
|
||||
}
|
||||
|
||||
@ -485,6 +499,7 @@ message NotifyUtxosChangedResponseMessage {
|
||||
//
|
||||
// See: NotifyUtxosChangedRequestMessage
|
||||
message UtxosChangedNotificationMessage {
|
||||
string id = 1001;
|
||||
repeated UtxosByAddressesEntry added = 1;
|
||||
repeated UtxosByAddressesEntry removed = 2;
|
||||
}
|
||||
@ -502,10 +517,12 @@ message UtxosByAddressesEntry {
|
||||
//
|
||||
// See: UtxosChangedNotificationMessage
|
||||
message StopNotifyingUtxosChangedRequestMessage {
|
||||
string id = 1001;
|
||||
repeated string addresses = 1;
|
||||
}
|
||||
|
||||
message StopNotifyingUtxosChangedResponseMessage {
|
||||
string id = 1001;
|
||||
RPCError error = 1000;
|
||||
}
|
||||
|
||||
@ -568,9 +585,11 @@ message GetVirtualSelectedParentBlueScoreResponseMessage {
|
||||
//
|
||||
// See: VirtualSelectedParentBlueScoreChangedNotificationMessage
|
||||
message NotifyVirtualSelectedParentBlueScoreChangedRequestMessage {
|
||||
string id = 1001;
|
||||
}
|
||||
|
||||
message NotifyVirtualSelectedParentBlueScoreChangedResponseMessage {
|
||||
string id = 1001;
|
||||
RPCError error = 1000;
|
||||
}
|
||||
|
||||
@ -579,6 +598,7 @@ message NotifyVirtualSelectedParentBlueScoreChangedResponseMessage {
|
||||
//
|
||||
// See NotifyVirtualSelectedParentBlueScoreChangedRequestMessage
|
||||
message VirtualSelectedParentBlueScoreChangedNotificationMessage {
|
||||
string id = 1001;
|
||||
uint64 virtualSelectedParentBlueScore = 1;
|
||||
}
|
||||
|
||||
@ -587,9 +607,11 @@ message VirtualSelectedParentBlueScoreChangedNotificationMessage {
|
||||
//
|
||||
// See: VirtualDaaScoreChangedNotificationMessage
|
||||
message NotifyVirtualDaaScoreChangedRequestMessage {
|
||||
string id = 1001;
|
||||
}
|
||||
|
||||
message NotifyVirtualDaaScoreChangedResponseMessage {
|
||||
string id = 1001;
|
||||
RPCError error = 1000;
|
||||
}
|
||||
|
||||
@ -598,6 +620,7 @@ message NotifyVirtualDaaScoreChangedResponseMessage {
|
||||
//
|
||||
// See NotifyVirtualDaaScoreChangedRequestMessage
|
||||
message VirtualDaaScoreChangedNotificationMessage {
|
||||
string id = 1001;
|
||||
uint64 virtualDaaScore = 1;
|
||||
}
|
||||
|
||||
@ -608,10 +631,12 @@ message VirtualDaaScoreChangedNotificationMessage {
|
||||
//
|
||||
// See: NotifyPruningPointUTXOSetOverrideResponseMessage
|
||||
message NotifyPruningPointUTXOSetOverrideRequestMessage {
|
||||
string id = 1001;
|
||||
}
|
||||
|
||||
|
||||
message NotifyPruningPointUTXOSetOverrideResponseMessage {
|
||||
string id = 1001;
|
||||
RPCError error = 1000;
|
||||
}
|
||||
|
||||
@ -620,6 +645,7 @@ message NotifyPruningPointUTXOSetOverrideResponseMessage {
|
||||
//
|
||||
// See NotifyPruningPointUTXOSetOverrideRequestMessage
|
||||
message PruningPointUTXOSetOverrideNotificationMessage {
|
||||
string id = 1001;
|
||||
}
|
||||
|
||||
// StopNotifyingPruningPointUTXOSetOverrideRequestMessage unregisters this connection for
|
||||
@ -629,9 +655,11 @@ message PruningPointUTXOSetOverrideNotificationMessage {
|
||||
//
|
||||
// See: PruningPointUTXOSetOverrideNotificationMessage
|
||||
message StopNotifyingPruningPointUTXOSetOverrideRequestMessage {
|
||||
string id = 1001;
|
||||
}
|
||||
|
||||
message StopNotifyingPruningPointUTXOSetOverrideResponseMessage {
|
||||
string id = 1001;
|
||||
RPCError error = 1000;
|
||||
}
|
||||
|
||||
@ -681,9 +709,11 @@ message EstimateNetworkHashesPerSecondResponseMessage{
|
||||
//
|
||||
// See: NewBlockTemplateNotificationMessage
|
||||
message NotifyNewBlockTemplateRequestMessage {
|
||||
string id = 1001;
|
||||
}
|
||||
|
||||
message NotifyNewBlockTemplateResponseMessage {
|
||||
string id = 1001;
|
||||
RPCError error = 1000;
|
||||
}
|
||||
|
||||
@ -692,6 +722,7 @@ message NotifyNewBlockTemplateResponseMessage {
|
||||
//
|
||||
// See NotifyNewBlockTemplateRequestMessage
|
||||
message NewBlockTemplateNotificationMessage {
|
||||
string id = 1001;
|
||||
}
|
||||
|
||||
message MempoolEntryByAddress{
|
||||
|
||||
@ -6,14 +6,26 @@ import (
|
||||
)
|
||||
|
||||
func (x *KaspadMessage_NotifyBlockAddedRequest) toAppMessage() (appmessage.Message, error) {
|
||||
return &appmessage.NotifyBlockAddedRequestMessage{}, nil
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyBlockAddedRequest is nil")
|
||||
}
|
||||
return x.NotifyBlockAddedRequest.toAppMessage()
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyBlockAddedRequest) fromAppMessage(_ *appmessage.NotifyBlockAddedRequestMessage) error {
|
||||
x.NotifyBlockAddedRequest = &NotifyBlockAddedRequestMessage{}
|
||||
func (x *KaspadMessage_NotifyBlockAddedRequest) fromAppMessage(message *appmessage.NotifyBlockAddedRequestMessage) error {
|
||||
x.NotifyBlockAddedRequest = &NotifyBlockAddedRequestMessage{Id: message.ID}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NotifyBlockAddedRequestMessage) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "NotifyBlockAddedRequest is nil")
|
||||
}
|
||||
return &appmessage.NotifyBlockAddedRequestMessage{
|
||||
ID: x.Id,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyBlockAddedResponse) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyBlockAddedResponse is nil")
|
||||
@ -27,6 +39,7 @@ func (x *KaspadMessage_NotifyBlockAddedResponse) fromAppMessage(message *appmess
|
||||
err = &RPCError{Message: message.Error.Message}
|
||||
}
|
||||
x.NotifyBlockAddedResponse = &NotifyBlockAddedResponseMessage{
|
||||
Id: message.ID,
|
||||
Error: err,
|
||||
}
|
||||
return nil
|
||||
@ -42,6 +55,7 @@ func (x *NotifyBlockAddedResponseMessage) toAppMessage() (appmessage.Message, er
|
||||
return nil, err
|
||||
}
|
||||
return &appmessage.NotifyBlockAddedResponseMessage{
|
||||
ID: x.Id,
|
||||
Error: rpcErr,
|
||||
}, nil
|
||||
}
|
||||
@ -60,6 +74,7 @@ func (x *KaspadMessage_BlockAddedNotification) fromAppMessage(message *appmessag
|
||||
return err
|
||||
}
|
||||
x.BlockAddedNotification = &BlockAddedNotificationMessage{
|
||||
Id: message.ID,
|
||||
Block: block,
|
||||
}
|
||||
return nil
|
||||
@ -74,6 +89,7 @@ func (x *BlockAddedNotificationMessage) toAppMessage() (appmessage.Message, erro
|
||||
return nil, err
|
||||
}
|
||||
return &appmessage.BlockAddedNotificationMessage{
|
||||
ID: x.Id,
|
||||
Block: block,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -6,14 +6,26 @@ import (
|
||||
)
|
||||
|
||||
func (x *KaspadMessage_NotifyFinalityConflictsRequest) toAppMessage() (appmessage.Message, error) {
|
||||
return &appmessage.NotifyFinalityConflictsRequestMessage{}, nil
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyFinalityConflictsRequest is nil")
|
||||
}
|
||||
return x.NotifyFinalityConflictsRequest.toAppMessage()
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyFinalityConflictsRequest) fromAppMessage(_ *appmessage.NotifyFinalityConflictsRequestMessage) error {
|
||||
x.NotifyFinalityConflictsRequest = &NotifyFinalityConflictsRequestMessage{}
|
||||
func (x *KaspadMessage_NotifyFinalityConflictsRequest) fromAppMessage(message *appmessage.NotifyFinalityConflictsRequestMessage) error {
|
||||
x.NotifyFinalityConflictsRequest = &NotifyFinalityConflictsRequestMessage{Id: message.ID}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NotifyFinalityConflictsRequestMessage) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "NotifyFinalityConflictsRequestMessage is nil")
|
||||
}
|
||||
return &appmessage.NotifyFinalityConflictsRequestMessage{
|
||||
ID: x.Id,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyFinalityConflictsResponse) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyFinalityConflictsResponse is nil")
|
||||
@ -27,6 +39,7 @@ func (x *KaspadMessage_NotifyFinalityConflictsResponse) fromAppMessage(message *
|
||||
err = &RPCError{Message: message.Error.Message}
|
||||
}
|
||||
x.NotifyFinalityConflictsResponse = &NotifyFinalityConflictsResponseMessage{
|
||||
Id: message.ID,
|
||||
Error: err,
|
||||
}
|
||||
return nil
|
||||
@ -42,6 +55,7 @@ func (x *NotifyFinalityConflictsResponseMessage) toAppMessage() (appmessage.Mess
|
||||
return nil, err
|
||||
}
|
||||
return &appmessage.NotifyFinalityConflictsResponseMessage{
|
||||
ID: x.Id,
|
||||
Error: rpcErr,
|
||||
}, nil
|
||||
}
|
||||
@ -55,6 +69,7 @@ func (x *KaspadMessage_FinalityConflictNotification) toAppMessage() (appmessage.
|
||||
|
||||
func (x *KaspadMessage_FinalityConflictNotification) fromAppMessage(message *appmessage.FinalityConflictNotificationMessage) error {
|
||||
x.FinalityConflictNotification = &FinalityConflictNotificationMessage{
|
||||
Id: message.ID,
|
||||
ViolatingBlockHash: message.ViolatingBlockHash,
|
||||
}
|
||||
return nil
|
||||
@ -65,6 +80,7 @@ func (x *FinalityConflictNotificationMessage) toAppMessage() (appmessage.Message
|
||||
return nil, errors.Wrapf(errorNil, "FinalityConflictNotificationMessage is nil")
|
||||
}
|
||||
return &appmessage.FinalityConflictNotificationMessage{
|
||||
ID: x.Id,
|
||||
ViolatingBlockHash: x.ViolatingBlockHash,
|
||||
}, nil
|
||||
}
|
||||
@ -78,6 +94,7 @@ func (x *KaspadMessage_FinalityConflictResolvedNotification) toAppMessage() (app
|
||||
|
||||
func (x *KaspadMessage_FinalityConflictResolvedNotification) fromAppMessage(message *appmessage.FinalityConflictResolvedNotificationMessage) error {
|
||||
x.FinalityConflictResolvedNotification = &FinalityConflictResolvedNotificationMessage{
|
||||
Id: message.ID,
|
||||
FinalityBlockHash: message.FinalityBlockHash,
|
||||
}
|
||||
return nil
|
||||
@ -88,6 +105,7 @@ func (x *FinalityConflictResolvedNotificationMessage) toAppMessage() (appmessage
|
||||
return nil, errors.Wrapf(errorNil, "FinalityConflictResolvedNotificationMessage is nil")
|
||||
}
|
||||
return &appmessage.FinalityConflictResolvedNotificationMessage{
|
||||
ID: x.Id,
|
||||
FinalityBlockHash: x.FinalityBlockHash,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -6,14 +6,26 @@ import (
|
||||
)
|
||||
|
||||
func (x *KaspadMessage_NotifyNewBlockTemplateRequest) toAppMessage() (appmessage.Message, error) {
|
||||
return &appmessage.NotifyNewBlockTemplateRequestMessage{}, nil
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyNewBlockTemplateRequest is nil")
|
||||
}
|
||||
return x.NotifyNewBlockTemplateRequest.toAppMessage()
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyNewBlockTemplateRequest) fromAppMessage(_ *appmessage.NotifyNewBlockTemplateRequestMessage) error {
|
||||
x.NotifyNewBlockTemplateRequest = &NotifyNewBlockTemplateRequestMessage{}
|
||||
func (x *KaspadMessage_NotifyNewBlockTemplateRequest) fromAppMessage(message *appmessage.NotifyNewBlockTemplateRequestMessage) error {
|
||||
x.NotifyNewBlockTemplateRequest = &NotifyNewBlockTemplateRequestMessage{Id: message.ID}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NotifyNewBlockTemplateRequestMessage) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "NotifyNewBlockTemplateRequestMessage is nil")
|
||||
}
|
||||
return &appmessage.NotifyNewBlockTemplateRequestMessage{
|
||||
ID: x.Id,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyNewBlockTemplateResponse) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyNewBlockTemplateResponse is nil")
|
||||
@ -27,6 +39,7 @@ func (x *KaspadMessage_NotifyNewBlockTemplateResponse) fromAppMessage(message *a
|
||||
err = &RPCError{Message: message.Error.Message}
|
||||
}
|
||||
x.NotifyNewBlockTemplateResponse = &NotifyNewBlockTemplateResponseMessage{
|
||||
Id: message.ID,
|
||||
Error: err,
|
||||
}
|
||||
return nil
|
||||
@ -42,6 +55,7 @@ func (x *NotifyNewBlockTemplateResponseMessage) toAppMessage() (appmessage.Messa
|
||||
return nil, err
|
||||
}
|
||||
return &appmessage.NotifyNewBlockTemplateResponseMessage{
|
||||
ID: x.Id,
|
||||
Error: rpcErr,
|
||||
}, nil
|
||||
}
|
||||
@ -54,7 +68,7 @@ func (x *KaspadMessage_NewBlockTemplateNotification) toAppMessage() (appmessage.
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NewBlockTemplateNotification) fromAppMessage(message *appmessage.NewBlockTemplateNotificationMessage) error {
|
||||
x.NewBlockTemplateNotification = &NewBlockTemplateNotificationMessage{}
|
||||
x.NewBlockTemplateNotification = &NewBlockTemplateNotificationMessage{Id: message.ID}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -62,5 +76,5 @@ func (x *NewBlockTemplateNotificationMessage) toAppMessage() (appmessage.Message
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "NewBlockTemplateNotificationMessage is nil")
|
||||
}
|
||||
return &appmessage.NewBlockTemplateNotificationMessage{}, nil
|
||||
return &appmessage.NewBlockTemplateNotificationMessage{ID: x.Id}, nil
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ func (x *KaspadMessage_NotifyPruningPointUTXOSetOverrideRequest) toAppMessage()
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyPruningPointUTXOSetOverrideRequest is nil")
|
||||
}
|
||||
return &appmessage.NotifyPruningPointUTXOSetOverrideRequestMessage{}, nil
|
||||
return x.NotifyPruningPointUTXOSetOverrideRequest.toAppMessage()
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyPruningPointUTXOSetOverrideRequest) fromAppMessage(_ *appmessage.NotifyPruningPointUTXOSetOverrideRequestMessage) error {
|
||||
@ -17,6 +17,15 @@ func (x *KaspadMessage_NotifyPruningPointUTXOSetOverrideRequest) fromAppMessage(
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NotifyPruningPointUTXOSetOverrideRequestMessage) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "NotifyPruningPointUTXOSetOverrideRequestMessage is nil")
|
||||
}
|
||||
return &appmessage.NotifyPruningPointUTXOSetOverrideRequestMessage{
|
||||
ID: x.Id,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyPruningPointUTXOSetOverrideResponse) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyPruningPointUTXOSetOverrideResponse is nil")
|
||||
@ -30,6 +39,7 @@ func (x *KaspadMessage_NotifyPruningPointUTXOSetOverrideResponse) fromAppMessage
|
||||
err = &RPCError{Message: message.Error.Message}
|
||||
}
|
||||
x.NotifyPruningPointUTXOSetOverrideResponse = &NotifyPruningPointUTXOSetOverrideResponseMessage{
|
||||
Id: message.ID,
|
||||
Error: err,
|
||||
}
|
||||
return nil
|
||||
@ -45,6 +55,7 @@ func (x *NotifyPruningPointUTXOSetOverrideResponseMessage) toAppMessage() (appme
|
||||
return nil, err
|
||||
}
|
||||
return &appmessage.NotifyPruningPointUTXOSetOverrideResponseMessage{
|
||||
ID: x.Id,
|
||||
Error: rpcErr,
|
||||
}, nil
|
||||
}
|
||||
@ -53,11 +64,11 @@ func (x *KaspadMessage_PruningPointUTXOSetOverrideNotification) toAppMessage() (
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_PruningPointUTXOSetOverrideNotification is nil")
|
||||
}
|
||||
return &appmessage.PruningPointUTXOSetOverrideNotificationMessage{}, nil
|
||||
return &appmessage.PruningPointUTXOSetOverrideNotificationMessage{ID: x.PruningPointUTXOSetOverrideNotification.Id}, nil
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_PruningPointUTXOSetOverrideNotification) fromAppMessage(_ *appmessage.PruningPointUTXOSetOverrideNotificationMessage) error {
|
||||
x.PruningPointUTXOSetOverrideNotification = &PruningPointUTXOSetOverrideNotificationMessage{}
|
||||
func (x *KaspadMessage_PruningPointUTXOSetOverrideNotification) fromAppMessage(message *appmessage.PruningPointUTXOSetOverrideNotificationMessage) error {
|
||||
x.PruningPointUTXOSetOverrideNotification = &PruningPointUTXOSetOverrideNotificationMessage{Id: message.ID}
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -65,14 +76,23 @@ func (x *KaspadMessage_StopNotifyingPruningPointUTXOSetOverrideRequest) toAppMes
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_StopNotifyingPruningPointUTXOSetOverrideRequest is nil")
|
||||
}
|
||||
return &appmessage.StopNotifyingPruningPointUTXOSetOverrideRequestMessage{}, nil
|
||||
return x.StopNotifyingPruningPointUTXOSetOverrideRequest.toAppMessage()
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_StopNotifyingPruningPointUTXOSetOverrideRequest) fromAppMessage(_ *appmessage.StopNotifyingPruningPointUTXOSetOverrideRequestMessage) error {
|
||||
x.StopNotifyingPruningPointUTXOSetOverrideRequest = &StopNotifyingPruningPointUTXOSetOverrideRequestMessage{}
|
||||
func (x *KaspadMessage_StopNotifyingPruningPointUTXOSetOverrideRequest) fromAppMessage(message *appmessage.StopNotifyingPruningPointUTXOSetOverrideRequestMessage) error {
|
||||
x.StopNotifyingPruningPointUTXOSetOverrideRequest = &StopNotifyingPruningPointUTXOSetOverrideRequestMessage{Id: message.ID}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *StopNotifyingPruningPointUTXOSetOverrideRequestMessage) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "StopNotifyingPruningPointUTXOSetOverrideRequestMessage is nil")
|
||||
}
|
||||
return &appmessage.StopNotifyingPruningPointUTXOSetOverrideRequestMessage{
|
||||
ID: x.Id,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_StopNotifyingPruningPointUTXOSetOverrideResponse) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_StopNotifyingPruningPointUTXOSetOverrideResponse is nil")
|
||||
@ -88,6 +108,7 @@ func (x *KaspadMessage_StopNotifyingPruningPointUTXOSetOverrideResponse) fromApp
|
||||
err = &RPCError{Message: message.Error.Message}
|
||||
}
|
||||
x.StopNotifyingPruningPointUTXOSetOverrideResponse = &StopNotifyingPruningPointUTXOSetOverrideResponseMessage{
|
||||
Id: message.ID,
|
||||
Error: err,
|
||||
}
|
||||
return nil
|
||||
@ -103,6 +124,7 @@ func (x *StopNotifyingPruningPointUTXOSetOverrideResponseMessage) toAppMessage()
|
||||
return nil, err
|
||||
}
|
||||
return &appmessage.StopNotifyingPruningPointUTXOSetOverrideResponseMessage{
|
||||
ID: x.Id,
|
||||
Error: rpcErr,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ func (x *KaspadMessage_NotifyUtxosChangedRequest) toAppMessage() (appmessage.Mes
|
||||
|
||||
func (x *KaspadMessage_NotifyUtxosChangedRequest) fromAppMessage(message *appmessage.NotifyUTXOsChangedRequestMessage) error {
|
||||
x.NotifyUtxosChangedRequest = &NotifyUtxosChangedRequestMessage{
|
||||
Id: message.ID,
|
||||
Addresses: message.Addresses,
|
||||
}
|
||||
return nil
|
||||
@ -24,6 +25,7 @@ func (x *NotifyUtxosChangedRequestMessage) toAppMessage() (appmessage.Message, e
|
||||
return nil, errors.Wrapf(errorNil, "NotifyUtxosChangedRequestMessage is nil")
|
||||
}
|
||||
return &appmessage.NotifyUTXOsChangedRequestMessage{
|
||||
ID: x.Id,
|
||||
Addresses: x.Addresses,
|
||||
}, nil
|
||||
}
|
||||
@ -41,6 +43,7 @@ func (x *KaspadMessage_NotifyUtxosChangedResponse) fromAppMessage(message *appme
|
||||
err = &RPCError{Message: message.Error.Message}
|
||||
}
|
||||
x.NotifyUtxosChangedResponse = &NotifyUtxosChangedResponseMessage{
|
||||
Id: message.ID,
|
||||
Error: err,
|
||||
}
|
||||
return nil
|
||||
@ -56,6 +59,7 @@ func (x *NotifyUtxosChangedResponseMessage) toAppMessage() (appmessage.Message,
|
||||
return nil, err
|
||||
}
|
||||
return &appmessage.NotifyUTXOsChangedResponseMessage{
|
||||
ID: x.Id,
|
||||
Error: rpcErr,
|
||||
}, nil
|
||||
}
|
||||
@ -81,6 +85,7 @@ func (x *KaspadMessage_UtxosChangedNotification) fromAppMessage(message *appmess
|
||||
}
|
||||
|
||||
x.UtxosChangedNotification = &UtxosChangedNotificationMessage{
|
||||
Id: message.ID,
|
||||
Added: added,
|
||||
Removed: removed,
|
||||
}
|
||||
@ -114,6 +119,7 @@ func (x *UtxosChangedNotificationMessage) toAppMessage() (appmessage.Message, er
|
||||
}
|
||||
|
||||
return &appmessage.UTXOsChangedNotificationMessage{
|
||||
ID: x.Id,
|
||||
Added: added,
|
||||
Removed: removed,
|
||||
}, nil
|
||||
|
||||
@ -9,14 +9,21 @@ func (x *KaspadMessage_NotifyVirtualDaaScoreChangedRequest) toAppMessage() (appm
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyVirtualDaaScoreChangedRequest is nil")
|
||||
}
|
||||
return &appmessage.NotifyVirtualDaaScoreChangedRequestMessage{}, nil
|
||||
return x.NotifyVirtualDaaScoreChangedRequest.toAppMessage()
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyVirtualDaaScoreChangedRequest) fromAppMessage(_ *appmessage.NotifyVirtualDaaScoreChangedRequestMessage) error {
|
||||
x.NotifyVirtualDaaScoreChangedRequest = &NotifyVirtualDaaScoreChangedRequestMessage{}
|
||||
func (x *KaspadMessage_NotifyVirtualDaaScoreChangedRequest) fromAppMessage(message *appmessage.NotifyVirtualDaaScoreChangedRequestMessage) error {
|
||||
x.NotifyVirtualDaaScoreChangedRequest = &NotifyVirtualDaaScoreChangedRequestMessage{Id: message.ID}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NotifyVirtualDaaScoreChangedRequestMessage) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "NotifyVirtualDaaScoreChangedRequestMessage is nil")
|
||||
}
|
||||
return &appmessage.NotifyVirtualDaaScoreChangedRequestMessage{ID: x.Id}, nil
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyVirtualDaaScoreChangedResponse) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyVirtualDaaScoreChangedResponse is nil")
|
||||
@ -30,6 +37,7 @@ func (x *KaspadMessage_NotifyVirtualDaaScoreChangedResponse) fromAppMessage(mess
|
||||
err = &RPCError{Message: message.Error.Message}
|
||||
}
|
||||
x.NotifyVirtualDaaScoreChangedResponse = &NotifyVirtualDaaScoreChangedResponseMessage{
|
||||
Id: message.ID,
|
||||
Error: err,
|
||||
}
|
||||
return nil
|
||||
@ -45,6 +53,7 @@ func (x *NotifyVirtualDaaScoreChangedResponseMessage) toAppMessage() (appmessage
|
||||
return nil, err
|
||||
}
|
||||
return &appmessage.NotifyVirtualDaaScoreChangedResponseMessage{
|
||||
ID: x.Id,
|
||||
Error: rpcErr,
|
||||
}, nil
|
||||
}
|
||||
@ -58,6 +67,7 @@ func (x *KaspadMessage_VirtualDaaScoreChangedNotification) toAppMessage() (appme
|
||||
|
||||
func (x *KaspadMessage_VirtualDaaScoreChangedNotification) fromAppMessage(message *appmessage.VirtualDaaScoreChangedNotificationMessage) error {
|
||||
x.VirtualDaaScoreChangedNotification = &VirtualDaaScoreChangedNotificationMessage{
|
||||
Id: message.ID,
|
||||
VirtualDaaScore: message.VirtualDaaScore,
|
||||
}
|
||||
return nil
|
||||
@ -68,6 +78,7 @@ func (x *VirtualDaaScoreChangedNotificationMessage) toAppMessage() (appmessage.M
|
||||
return nil, errors.Wrapf(errorNil, "VirtualDaaScoreChangedNotificationMessage is nil")
|
||||
}
|
||||
return &appmessage.VirtualDaaScoreChangedNotificationMessage{
|
||||
ID: x.Id,
|
||||
VirtualDaaScore: x.VirtualDaaScore,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -9,14 +9,23 @@ func (x *KaspadMessage_NotifyVirtualSelectedParentBlueScoreChangedRequest) toApp
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyVirtualSelectedParentBlueScoreChangedRequest is nil")
|
||||
}
|
||||
return &appmessage.NotifyVirtualSelectedParentBlueScoreChangedRequestMessage{}, nil
|
||||
return x.NotifyVirtualSelectedParentBlueScoreChangedRequest.toAppMessage()
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyVirtualSelectedParentBlueScoreChangedRequest) fromAppMessage(_ *appmessage.NotifyVirtualSelectedParentBlueScoreChangedRequestMessage) error {
|
||||
x.NotifyVirtualSelectedParentBlueScoreChangedRequest = &NotifyVirtualSelectedParentBlueScoreChangedRequestMessage{}
|
||||
func (x *KaspadMessage_NotifyVirtualSelectedParentBlueScoreChangedRequest) fromAppMessage(message *appmessage.NotifyVirtualSelectedParentBlueScoreChangedRequestMessage) error {
|
||||
x.NotifyVirtualSelectedParentBlueScoreChangedRequest = &NotifyVirtualSelectedParentBlueScoreChangedRequestMessage{
|
||||
Id: message.ID,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NotifyVirtualSelectedParentBlueScoreChangedRequestMessage) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "NotifyVirtualSelectedParentBlueScoreChangedRequestMessage is nil")
|
||||
}
|
||||
return &appmessage.NotifyVirtualSelectedParentBlueScoreChangedRequestMessage{ID: x.Id}, nil
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyVirtualSelectedParentBlueScoreChangedResponse) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyVirtualSelectedParentBlueScoreChangedResponse is nil")
|
||||
@ -30,6 +39,7 @@ func (x *KaspadMessage_NotifyVirtualSelectedParentBlueScoreChangedResponse) from
|
||||
err = &RPCError{Message: message.Error.Message}
|
||||
}
|
||||
x.NotifyVirtualSelectedParentBlueScoreChangedResponse = &NotifyVirtualSelectedParentBlueScoreChangedResponseMessage{
|
||||
Id: message.ID,
|
||||
Error: err,
|
||||
}
|
||||
return nil
|
||||
@ -45,6 +55,7 @@ func (x *NotifyVirtualSelectedParentBlueScoreChangedResponseMessage) toAppMessag
|
||||
return nil, err
|
||||
}
|
||||
return &appmessage.NotifyVirtualSelectedParentBlueScoreChangedResponseMessage{
|
||||
ID: x.Id,
|
||||
Error: rpcErr,
|
||||
}, nil
|
||||
}
|
||||
@ -58,6 +69,7 @@ func (x *KaspadMessage_VirtualSelectedParentBlueScoreChangedNotification) toAppM
|
||||
|
||||
func (x *KaspadMessage_VirtualSelectedParentBlueScoreChangedNotification) fromAppMessage(message *appmessage.VirtualSelectedParentBlueScoreChangedNotificationMessage) error {
|
||||
x.VirtualSelectedParentBlueScoreChangedNotification = &VirtualSelectedParentBlueScoreChangedNotificationMessage{
|
||||
Id: message.ID,
|
||||
VirtualSelectedParentBlueScore: message.VirtualSelectedParentBlueScore,
|
||||
}
|
||||
return nil
|
||||
@ -68,6 +80,7 @@ func (x *VirtualSelectedParentBlueScoreChangedNotificationMessage) toAppMessage(
|
||||
return nil, errors.Wrapf(errorNil, "VirtualSelectedParentBlueScoreChangedNotificationMessage is nil")
|
||||
}
|
||||
return &appmessage.VirtualSelectedParentBlueScoreChangedNotificationMessage{
|
||||
ID: x.Id,
|
||||
VirtualSelectedParentBlueScore: x.VirtualSelectedParentBlueScore,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -9,18 +9,24 @@ func (x *KaspadMessage_NotifyVirtualSelectedParentChainChangedRequest) toAppMess
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyVirtualSelectedParentChainChangedRequest is nil")
|
||||
}
|
||||
return &appmessage.NotifyVirtualSelectedParentChainChangedRequestMessage{
|
||||
IncludeAcceptedTransactionIDs: x.NotifyVirtualSelectedParentChainChangedRequest.IncludeAcceptedTransactionIds,
|
||||
}, nil
|
||||
return x.NotifyVirtualSelectedParentChainChangedRequest.toAppMessage()
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyVirtualSelectedParentChainChangedRequest) fromAppMessage(appmessage *appmessage.NotifyVirtualSelectedParentChainChangedRequestMessage) error {
|
||||
func (x *KaspadMessage_NotifyVirtualSelectedParentChainChangedRequest) fromAppMessage(message *appmessage.NotifyVirtualSelectedParentChainChangedRequestMessage) error {
|
||||
x.NotifyVirtualSelectedParentChainChangedRequest = &NotifyVirtualSelectedParentChainChangedRequestMessage{
|
||||
IncludeAcceptedTransactionIds: appmessage.IncludeAcceptedTransactionIDs,
|
||||
Id: message.ID,
|
||||
IncludeAcceptedTransactionIds: message.IncludeAcceptedTransactionIDs,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *NotifyVirtualSelectedParentChainChangedRequestMessage) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "NotifyVirtualSelectedParentChainChangedRequestMessage is nil")
|
||||
}
|
||||
return &appmessage.NotifyVirtualSelectedParentChainChangedRequestMessage{ID: x.Id}, nil
|
||||
}
|
||||
|
||||
func (x *KaspadMessage_NotifyVirtualSelectedParentChainChangedResponse) toAppMessage() (appmessage.Message, error) {
|
||||
if x == nil {
|
||||
return nil, errors.Wrapf(errorNil, "KaspadMessage_NotifyVirtualSelectedParentChainChangedResponse is nil")
|
||||
@ -34,6 +40,7 @@ func (x *KaspadMessage_NotifyVirtualSelectedParentChainChangedResponse) fromAppM
|
||||
err = &RPCError{Message: message.Error.Message}
|
||||
}
|
||||
x.NotifyVirtualSelectedParentChainChangedResponse = &NotifyVirtualSelectedParentChainChangedResponseMessage{
|
||||
Id: message.ID,
|
||||
Error: err,
|
||||
}
|
||||
return nil
|
||||
@ -49,6 +56,7 @@ func (x *NotifyVirtualSelectedParentChainChangedResponseMessage) toAppMessage()
|
||||
return nil, err
|
||||
}
|
||||
return &appmessage.NotifyVirtualSelectedParentChainChangedResponseMessage{
|
||||
ID: x.Id,
|
||||
Error: rpcErr,
|
||||
}, nil
|
||||
}
|
||||
@ -62,6 +70,7 @@ func (x *KaspadMessage_VirtualSelectedParentChainChangedNotification) toAppMessa
|
||||
|
||||
func (x *KaspadMessage_VirtualSelectedParentChainChangedNotification) fromAppMessage(message *appmessage.VirtualSelectedParentChainChangedNotificationMessage) error {
|
||||
x.VirtualSelectedParentChainChangedNotification = &VirtualSelectedParentChainChangedNotificationMessage{
|
||||
Id: message.ID,
|
||||
RemovedChainBlockHashes: message.RemovedChainBlockHashes,
|
||||
AddedChainBlockHashes: message.AddedChainBlockHashes,
|
||||
AcceptedTransactionIds: make([]*AcceptedTransactionIds, len(message.AcceptedTransactionIDs)),
|
||||
@ -79,6 +88,7 @@ func (x *VirtualSelectedParentChainChangedNotificationMessage) toAppMessage() (a
|
||||
return nil, errors.Wrapf(errorNil, "VirtualSelectedParentChainChangedNotificationMessage is nil")
|
||||
}
|
||||
message := &appmessage.VirtualSelectedParentChainChangedNotificationMessage{
|
||||
ID: x.Id,
|
||||
RemovedChainBlockHashes: x.RemovedChainBlockHashes,
|
||||
AddedChainBlockHashes: x.AddedChainBlockHashes,
|
||||
AcceptedTransactionIDs: make([]*appmessage.AcceptedTransactionIDs, len(x.AcceptedTransactionIds)),
|
||||
|
||||
@ -14,6 +14,7 @@ func (x *KaspadMessage_StopNotifyingUtxosChangedRequest) toAppMessage() (appmess
|
||||
|
||||
func (x *KaspadMessage_StopNotifyingUtxosChangedRequest) fromAppMessage(message *appmessage.StopNotifyingUTXOsChangedRequestMessage) error {
|
||||
x.StopNotifyingUtxosChangedRequest = &StopNotifyingUtxosChangedRequestMessage{
|
||||
Id: message.ID,
|
||||
Addresses: message.Addresses,
|
||||
}
|
||||
return nil
|
||||
@ -24,6 +25,7 @@ func (x *StopNotifyingUtxosChangedRequestMessage) toAppMessage() (appmessage.Mes
|
||||
return nil, errors.Wrapf(errorNil, "StopNotifyingUtxosChangedRequestMessage is nil")
|
||||
}
|
||||
return &appmessage.StopNotifyingUTXOsChangedRequestMessage{
|
||||
ID: x.Id,
|
||||
Addresses: x.Addresses,
|
||||
}, nil
|
||||
}
|
||||
@ -41,6 +43,7 @@ func (x *KaspadMessage_StopNotifyingUtxosChangedResponse) fromAppMessage(message
|
||||
err = &RPCError{Message: message.Error.Message}
|
||||
}
|
||||
x.StopNotifyingUtxosChangedResponse = &StopNotifyingUtxosChangedResponseMessage{
|
||||
Id: message.ID,
|
||||
Error: err,
|
||||
}
|
||||
return nil
|
||||
@ -56,6 +59,7 @@ func (x *StopNotifyingUtxosChangedResponseMessage) toAppMessage() (appmessage.Me
|
||||
return nil, err
|
||||
}
|
||||
return &appmessage.StopNotifyingUTXOsChangedResponseMessage{
|
||||
ID: x.Id,
|
||||
Error: rpcErr,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ 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"
|
||||
)
|
||||
@ -9,7 +10,38 @@ import (
|
||||
// RegisterForBlockAddedNotifications sends an RPC request respective to the function's name and returns the RPC server's response.
|
||||
// Additionally, it starts listening for the appropriate notification using the given handler function
|
||||
func (c *RPCClient) RegisterForBlockAddedNotifications(onBlockAdded func(notification *appmessage.BlockAddedNotificationMessage)) error {
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyBlockAddedRequestMessage())
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyBlockAddedRequestMessage(rpccontext.DefaultNotificationID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
response, err := c.route(appmessage.CmdNotifyBlockAddedResponseMessage).DequeueWithTimeout(c.timeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
notifyBlockAddedResponse := response.(*appmessage.NotifyBlockAddedResponseMessage)
|
||||
if notifyBlockAddedResponse.Error != nil {
|
||||
return c.convertRPCError(notifyBlockAddedResponse.Error)
|
||||
}
|
||||
spawn("RegisterForBlockAddedNotifications", func() {
|
||||
for {
|
||||
notification, err := c.route(appmessage.CmdBlockAddedNotificationMessage).Dequeue()
|
||||
if err != nil {
|
||||
if errors.Is(err, routerpkg.ErrRouteClosed) {
|
||||
break
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
blockAddedNotification := notification.(*appmessage.BlockAddedNotificationMessage)
|
||||
onBlockAdded(blockAddedNotification)
|
||||
}
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterForBlockAddedNotificationsWithID does the same as
|
||||
// RegisterForBlockAddedNotifications, but allows the client to specify an id
|
||||
func (c *RPCClient) RegisterForBlockAddedNotificationsWithID(onBlockAdded func(notification *appmessage.BlockAddedNotificationMessage), id string) error {
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyBlockAddedRequestMessage(id))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ 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"
|
||||
)
|
||||
@ -12,7 +13,7 @@ func (c *RPCClient) RegisterForVirtualSelectedParentChainChangedNotifications(in
|
||||
onChainChanged func(notification *appmessage.VirtualSelectedParentChainChangedNotificationMessage)) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(
|
||||
appmessage.NewNotifyVirtualSelectedParentChainChangedRequestMessage(includeAcceptedTransactionIDs))
|
||||
appmessage.NewNotifyVirtualSelectedParentChainChangedRequestMessage(includeAcceptedTransactionIDs, rpccontext.DefaultNotificationID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -39,3 +40,37 @@ func (c *RPCClient) RegisterForVirtualSelectedParentChainChangedNotifications(in
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterForVirtualSelectedParentChainChangedNotificationsWithID does the same as
|
||||
// RegisterForVirtualSelectedParentChainChangedNotifications, but allows the client to specify an id
|
||||
func (c *RPCClient) RegisterForVirtualSelectedParentChainChangedNotificationsWithID(includeAcceptedTransactionIDs bool,
|
||||
onChainChanged func(notification *appmessage.VirtualSelectedParentChainChangedNotificationMessage), id string) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(
|
||||
appmessage.NewNotifyVirtualSelectedParentChainChangedRequestMessage(includeAcceptedTransactionIDs, id))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
response, err := c.route(appmessage.CmdNotifyVirtualSelectedParentChainChangedResponseMessage).DequeueWithTimeout(c.timeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
notifyChainChangedResponse := response.(*appmessage.NotifyVirtualSelectedParentChainChangedResponseMessage)
|
||||
if notifyChainChangedResponse.Error != nil {
|
||||
return c.convertRPCError(notifyChainChangedResponse.Error)
|
||||
}
|
||||
spawn("RegisterForVirtualSelectedParentChainChangedNotificationsWithID", func() {
|
||||
for {
|
||||
notification, err := c.route(appmessage.CmdVirtualSelectedParentChainChangedNotificationMessage).Dequeue()
|
||||
if err != nil {
|
||||
if errors.Is(err, routerpkg.ErrRouteClosed) {
|
||||
break
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
ChainChangedNotification := notification.(*appmessage.VirtualSelectedParentChainChangedNotificationMessage)
|
||||
onChainChanged(ChainChangedNotification)
|
||||
}
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ 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"
|
||||
)
|
||||
@ -12,7 +13,7 @@ func (c *RPCClient) RegisterForFinalityConflictsNotifications(
|
||||
onFinalityConflict func(notification *appmessage.FinalityConflictNotificationMessage),
|
||||
onFinalityConflictResolved func(notification *appmessage.FinalityConflictResolvedNotificationMessage)) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyFinalityConflictsRequestMessage())
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyFinalityConflictsRequestMessage(rpccontext.DefaultNotificationID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -52,3 +53,50 @@ func (c *RPCClient) RegisterForFinalityConflictsNotifications(
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterForFinalityConflictsNotificationsWithID does the same as
|
||||
// RegisterForFinalityConflictsNotifications, but allows the client to specify an id
|
||||
func (c *RPCClient) RegisterForFinalityConflictsNotificationsWithID(
|
||||
onFinalityConflict func(notification *appmessage.FinalityConflictNotificationMessage),
|
||||
onFinalityConflictResolved func(notification *appmessage.FinalityConflictResolvedNotificationMessage), id string) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyFinalityConflictsRequestMessage(id))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
response, err := c.route(appmessage.CmdNotifyFinalityConflictsResponseMessage).DequeueWithTimeout(c.timeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
notifyFinalityConflictsResponse := response.(*appmessage.NotifyFinalityConflictsResponseMessage)
|
||||
if notifyFinalityConflictsResponse.Error != nil {
|
||||
return c.convertRPCError(notifyFinalityConflictsResponse.Error)
|
||||
}
|
||||
spawn("RegisterForFinalityConflictsNotificationsWithID-finalityConflict", func() {
|
||||
for {
|
||||
notification, err := c.route(appmessage.CmdFinalityConflictNotificationMessage).Dequeue()
|
||||
if err != nil {
|
||||
if errors.Is(err, routerpkg.ErrRouteClosed) {
|
||||
break
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
finalityConflictNotification := notification.(*appmessage.FinalityConflictNotificationMessage)
|
||||
onFinalityConflict(finalityConflictNotification)
|
||||
}
|
||||
})
|
||||
spawn("RegisterForFinalityConflictsNotificationsWithID-finalityConflictResolved", func() {
|
||||
for {
|
||||
notification, err := c.route(appmessage.CmdFinalityConflictResolvedNotificationMessage).Dequeue()
|
||||
if err != nil {
|
||||
if errors.Is(err, routerpkg.ErrRouteClosed) {
|
||||
break
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
finalityConflictResolvedNotification := notification.(*appmessage.FinalityConflictResolvedNotificationMessage)
|
||||
onFinalityConflictResolved(finalityConflictResolvedNotification)
|
||||
}
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ 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"
|
||||
)
|
||||
@ -9,7 +10,7 @@ import (
|
||||
// RegisterForNewBlockTemplateNotifications sends an RPC request respective to the function's name and returns the RPC server's response.
|
||||
// Additionally, it starts listening for the appropriate notification using the given handler function
|
||||
func (c *RPCClient) RegisterForNewBlockTemplateNotifications(onNewBlockTemplate func(notification *appmessage.NewBlockTemplateNotificationMessage)) error {
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyNewBlockTemplateRequestMessage())
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyNewBlockTemplateRequestMessage(rpccontext.DefaultNotificationID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -36,3 +37,34 @@ func (c *RPCClient) RegisterForNewBlockTemplateNotifications(onNewBlockTemplate
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterForNewBlockTemplateNotificationsWithID does the same as
|
||||
// RegisterForNewBlockTemplateNotifications, but allows the client to specify an id
|
||||
func (c *RPCClient) RegisterForNewBlockTemplateNotificationsWithID(onNewBlockTemplate func(notification *appmessage.NewBlockTemplateNotificationMessage), id string) error {
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyNewBlockTemplateRequestMessage(id))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
response, err := c.route(appmessage.CmdNotifyNewBlockTemplateResponseMessage).DequeueWithTimeout(c.timeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
notifyNewBlockTemplateResponse := response.(*appmessage.NotifyNewBlockTemplateResponseMessage)
|
||||
if notifyNewBlockTemplateResponse.Error != nil {
|
||||
return c.convertRPCError(notifyNewBlockTemplateResponse.Error)
|
||||
}
|
||||
spawn("RegisterForNewBlockTemplateNotificationsWithID", func() {
|
||||
for {
|
||||
notification, err := c.route(appmessage.CmdNewBlockTemplateNotificationMessage).Dequeue()
|
||||
if err != nil {
|
||||
if errors.Is(err, routerpkg.ErrRouteClosed) {
|
||||
break
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
NewBlockTemplateNotification := notification.(*appmessage.NewBlockTemplateNotificationMessage)
|
||||
onNewBlockTemplate(NewBlockTemplateNotification)
|
||||
}
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -2,15 +2,16 @@ 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"
|
||||
)
|
||||
|
||||
// RegisterPruningPointUTXOSetNotifications sends an RPC request respective to the function's name and returns the RPC server's response.
|
||||
// Additionally, it starts listening for the appropriate notification using the given handler function
|
||||
func (c *RPCClient) RegisterPruningPointUTXOSetNotifications(onPruningPointUTXOSetNotifications func()) error {
|
||||
func (c *RPCClient) RegisterPruningPointUTXOSetNotifications(onPruningPointUTXOSetNotifications func(notification *appmessage.PruningPointUTXOSetOverrideNotificationMessage)) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyPruningPointUTXOSetOverrideRequestMessage())
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyPruningPointUTXOSetOverrideRequestMessage(rpccontext.DefaultNotificationID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -31,8 +32,8 @@ func (c *RPCClient) RegisterPruningPointUTXOSetNotifications(onPruningPointUTXOS
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
_ = notification.(*appmessage.PruningPointUTXOSetOverrideNotificationMessage) // Sanity check the type
|
||||
onPruningPointUTXOSetNotifications()
|
||||
newPruningPointUTXOSetOverrideNotification := notification.(*appmessage.PruningPointUTXOSetOverrideNotificationMessage) // Sanity check the type
|
||||
onPruningPointUTXOSetNotifications(newPruningPointUTXOSetOverrideNotification)
|
||||
}
|
||||
})
|
||||
return nil
|
||||
@ -42,7 +43,58 @@ func (c *RPCClient) RegisterPruningPointUTXOSetNotifications(onPruningPointUTXOS
|
||||
// Additionally, it stops listening for the appropriate notification using the given handler function
|
||||
func (c *RPCClient) UnregisterPruningPointUTXOSetNotifications() error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewStopNotifyingPruningPointUTXOSetOverrideRequestMessage())
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewStopNotifyingPruningPointUTXOSetOverrideRequestMessage(rpccontext.DefaultNotificationID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
response, err := c.route(appmessage.CmdStopNotifyingPruningPointUTXOSetOverrideResponseMessage).DequeueWithTimeout(c.timeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
stopNotifyPruningPointUTXOSetOverrideResponse := response.(*appmessage.StopNotifyingPruningPointUTXOSetOverrideResponseMessage)
|
||||
if stopNotifyPruningPointUTXOSetOverrideResponse.Error != nil {
|
||||
return c.convertRPCError(stopNotifyPruningPointUTXOSetOverrideResponse.Error)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterPruningPointUTXOSetNotificationsWithID does the same as
|
||||
// RegisterPruningPointUTXOSetNotifications, but allows the client to specify an id
|
||||
func (c *RPCClient) RegisterPruningPointUTXOSetNotificationsWithID(onPruningPointUTXOSetNotifications func(notification *appmessage.PruningPointUTXOSetOverrideNotificationMessage), id string) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyPruningPointUTXOSetOverrideRequestMessage(id))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
response, err := c.route(appmessage.CmdNotifyPruningPointUTXOSetOverrideResponseMessage).DequeueWithTimeout(c.timeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
notifyPruningPointUTXOSetOverrideResponse := response.(*appmessage.NotifyPruningPointUTXOSetOverrideResponseMessage)
|
||||
if notifyPruningPointUTXOSetOverrideResponse.Error != nil {
|
||||
return c.convertRPCError(notifyPruningPointUTXOSetOverrideResponse.Error)
|
||||
}
|
||||
spawn("RegisterPruningPointUTXOSetNotificationsWithID", func() {
|
||||
for {
|
||||
notification, err := c.route(appmessage.CmdPruningPointUTXOSetOverrideNotificationMessage).Dequeue()
|
||||
if err != nil {
|
||||
if errors.Is(err, routerpkg.ErrRouteClosed) {
|
||||
break
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
newPruningPointUTXOSetOverrideNotification := notification.(*appmessage.PruningPointUTXOSetOverrideNotificationMessage) // Sanity check the type
|
||||
onPruningPointUTXOSetNotifications(newPruningPointUTXOSetOverrideNotification)
|
||||
}
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnregisterPruningPointUTXOSetNotificationsWithID does the same as
|
||||
// UnregisterPruningPointUTXOSetNotifications, but allows the client to specify an id
|
||||
func (c *RPCClient) UnregisterPruningPointUTXOSetNotificationsWithID(id string) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewStopNotifyingPruningPointUTXOSetOverrideRequestMessage(id))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ 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"
|
||||
)
|
||||
@ -11,7 +12,7 @@ import (
|
||||
func (c *RPCClient) RegisterForUTXOsChangedNotifications(addresses []string,
|
||||
onUTXOsChanged func(notification *appmessage.UTXOsChangedNotificationMessage)) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyUTXOsChangedRequestMessage(addresses))
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyUTXOsChangedRequestMessage(addresses, rpccontext.DefaultNotificationID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -38,3 +39,36 @@ func (c *RPCClient) RegisterForUTXOsChangedNotifications(addresses []string,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterForUTXOsChangedNotificationsWithID does the same as
|
||||
// RegisterForUTXOsChangedNotifications, but allows the client to specify an id
|
||||
func (c *RPCClient) RegisterForUTXOsChangedNotificationsWithID(addresses []string,
|
||||
onUTXOsChanged func(notification *appmessage.UTXOsChangedNotificationMessage), id string) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyUTXOsChangedRequestMessage(addresses, id))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
response, err := c.route(appmessage.CmdNotifyUTXOsChangedResponseMessage).DequeueWithTimeout(c.timeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
notifyUTXOsChangedResponse := response.(*appmessage.NotifyUTXOsChangedResponseMessage)
|
||||
if notifyUTXOsChangedResponse.Error != nil {
|
||||
return c.convertRPCError(notifyUTXOsChangedResponse.Error)
|
||||
}
|
||||
spawn("RegisterForUTXOsChangedNotificationsWithID", func() {
|
||||
for {
|
||||
notification, err := c.route(appmessage.CmdUTXOsChangedNotificationMessage).Dequeue()
|
||||
if err != nil {
|
||||
if errors.Is(err, routerpkg.ErrRouteClosed) {
|
||||
break
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
UTXOsChangedNotification := notification.(*appmessage.UTXOsChangedNotificationMessage)
|
||||
onUTXOsChanged(UTXOsChangedNotification)
|
||||
}
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ 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"
|
||||
)
|
||||
@ -12,7 +13,7 @@ import (
|
||||
func (c *RPCClient) RegisterForVirtualDaaScoreChangedNotifications(
|
||||
onVirtualDaaScoreChanged func(notification *appmessage.VirtualDaaScoreChangedNotificationMessage)) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyVirtualDaaScoreChangedRequestMessage())
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyVirtualDaaScoreChangedRequestMessage(rpccontext.DefaultNotificationID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -39,3 +40,36 @@ func (c *RPCClient) RegisterForVirtualDaaScoreChangedNotifications(
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterForVirtualDaaScoreChangedNotificationsWithID does the same as
|
||||
// RegisterForVirtualDaaScoreChangedNotifications, but allows the client to specify an id
|
||||
func (c *RPCClient) RegisterForVirtualDaaScoreChangedNotificationsWithID(
|
||||
onVirtualDaaScoreChanged func(notification *appmessage.VirtualDaaScoreChangedNotificationMessage), id string) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyVirtualDaaScoreChangedRequestMessage(id))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
response, err := c.route(appmessage.CmdNotifyVirtualDaaScoreChangedResponseMessage).DequeueWithTimeout(c.timeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
notifyVirtualDaaScoreChangedResponse := response.(*appmessage.NotifyVirtualDaaScoreChangedResponseMessage)
|
||||
if notifyVirtualDaaScoreChangedResponse.Error != nil {
|
||||
return c.convertRPCError(notifyVirtualDaaScoreChangedResponse.Error)
|
||||
}
|
||||
spawn("RegisterForVirtualDaaScoreChangedNotificationsWithID", func() {
|
||||
for {
|
||||
notification, err := c.route(appmessage.CmdVirtualDaaScoreChangedNotificationMessage).Dequeue()
|
||||
if err != nil {
|
||||
if errors.Is(err, routerpkg.ErrRouteClosed) {
|
||||
break
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
VirtualDaaScoreChangedNotification := notification.(*appmessage.VirtualDaaScoreChangedNotificationMessage)
|
||||
onVirtualDaaScoreChanged(VirtualDaaScoreChangedNotification)
|
||||
}
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ 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"
|
||||
)
|
||||
@ -12,7 +13,7 @@ import (
|
||||
func (c *RPCClient) RegisterForVirtualSelectedParentBlueScoreChangedNotifications(
|
||||
onVirtualSelectedParentBlueScoreChanged func(notification *appmessage.VirtualSelectedParentBlueScoreChangedNotificationMessage)) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyVirtualSelectedParentBlueScoreChangedRequestMessage())
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyVirtualSelectedParentBlueScoreChangedRequestMessage(rpccontext.DefaultNotificationID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -39,3 +40,36 @@ func (c *RPCClient) RegisterForVirtualSelectedParentBlueScoreChangedNotification
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// RegisterForVirtualSelectedParentBlueScoreChangedNotificationsWithID does the same as
|
||||
// RegisterForVirtualSelectedParentBlueScoreChangedNotifications, but allows the client to specify an id
|
||||
func (c *RPCClient) RegisterForVirtualSelectedParentBlueScoreChangedNotificationsWithID(
|
||||
onVirtualSelectedParentBlueScoreChanged func(notification *appmessage.VirtualSelectedParentBlueScoreChangedNotificationMessage), id string) error {
|
||||
|
||||
err := c.rpcRouter.outgoingRoute().Enqueue(appmessage.NewNotifyVirtualSelectedParentBlueScoreChangedRequestMessage(id))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
response, err := c.route(appmessage.CmdNotifyVirtualSelectedParentBlueScoreChangedResponseMessage).DequeueWithTimeout(c.timeout)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
notifyVirtualSelectedParentBlueScoreChangedResponse := response.(*appmessage.NotifyVirtualSelectedParentBlueScoreChangedResponseMessage)
|
||||
if notifyVirtualSelectedParentBlueScoreChangedResponse.Error != nil {
|
||||
return c.convertRPCError(notifyVirtualSelectedParentBlueScoreChangedResponse.Error)
|
||||
}
|
||||
spawn("RegisterForVirtualSelectedParentBlueScoreChangedNotificationsWithID", func() {
|
||||
for {
|
||||
notification, err := c.route(appmessage.CmdVirtualSelectedParentBlueScoreChangedNotificationMessage).Dequeue()
|
||||
if err != nil {
|
||||
if errors.Is(err, routerpkg.ErrRouteClosed) {
|
||||
break
|
||||
}
|
||||
panic(err)
|
||||
}
|
||||
VirtualSelectedParentBlueScoreChangedNotification := notification.(*appmessage.VirtualSelectedParentBlueScoreChangedNotificationMessage)
|
||||
onVirtualSelectedParentBlueScoreChanged(VirtualSelectedParentBlueScoreChangedNotification)
|
||||
}
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ func TestIBD(t *testing.T) {
|
||||
func TestIBDWithPruning(t *testing.T) {
|
||||
testSync := func(syncer, syncee *appHarness) {
|
||||
utxoSetOverriden := make(chan struct{})
|
||||
err := syncee.rpcClient.RegisterPruningPointUTXOSetNotifications(func() {
|
||||
err := syncee.rpcClient.RegisterPruningPointUTXOSetNotifications(func(notification *appmessage.PruningPointUTXOSetOverrideNotificationMessage) {
|
||||
close(utxoSetOverriden)
|
||||
})
|
||||
|
||||
@ -107,7 +107,7 @@ func TestIBDWithPruning(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
const timeout = 10 * time.Second
|
||||
const timeout = 20 * time.Second
|
||||
select {
|
||||
case <-utxoSetOverriden:
|
||||
case <-time.After(timeout):
|
||||
|
||||
@ -12,3 +12,286 @@ func setOnBlockAddedHandler(t *testing.T, harness *appHarness, handler func(noti
|
||||
t.Fatalf("Error from RegisterForBlockAddedNotifications: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNotificationIDs(t *testing.T) {
|
||||
kaspad1, kaspad2, kaspad3, teardown := standardSetupWithUtxoindex(t)
|
||||
|
||||
defer teardown()
|
||||
|
||||
ID1 := "kaspad1"
|
||||
ID2 := "kaspad2"
|
||||
ID3 := "kaspad3"
|
||||
|
||||
err := kaspad1.rpcClient.RegisterForBlockAddedNotificationsWithID(
|
||||
func(notification *appmessage.BlockAddedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID1)
|
||||
},
|
||||
ID1,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForBlockAddedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad2.rpcClient.RegisterForBlockAddedNotificationsWithID(
|
||||
func(notification *appmessage.BlockAddedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID2)
|
||||
},
|
||||
ID2,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForBlockAddedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad3.rpcClient.RegisterForBlockAddedNotificationsWithID(
|
||||
func(notification *appmessage.BlockAddedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID3)
|
||||
},
|
||||
ID3,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForBlockAddedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad1.rpcClient.RegisterForVirtualSelectedParentBlueScoreChangedNotificationsWithID(
|
||||
func(notification *appmessage.VirtualSelectedParentBlueScoreChangedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID1)
|
||||
},
|
||||
ID1,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForVirtualSelectedParentBlueScoreChangedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad2.rpcClient.RegisterForVirtualSelectedParentBlueScoreChangedNotificationsWithID(
|
||||
func(notification *appmessage.VirtualSelectedParentBlueScoreChangedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID2)
|
||||
},
|
||||
ID2,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForVirtualSelectedParentBlueScoreChangedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad3.rpcClient.RegisterForVirtualSelectedParentBlueScoreChangedNotificationsWithID(
|
||||
func(notification *appmessage.VirtualSelectedParentBlueScoreChangedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID3)
|
||||
},
|
||||
ID3,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForUTXOsChangedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad1.rpcClient.RegisterForUTXOsChangedNotificationsWithID(
|
||||
[]string{kaspad1.miningAddress, kaspad2.miningAddress, kaspad3.miningAddress},
|
||||
func(notification *appmessage.UTXOsChangedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID1)
|
||||
},
|
||||
ID1,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForUTXOsChangedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad2.rpcClient.RegisterForUTXOsChangedNotificationsWithID(
|
||||
[]string{kaspad1.miningAddress, kaspad2.miningAddress, kaspad3.miningAddress},
|
||||
func(notification *appmessage.UTXOsChangedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID2)
|
||||
},
|
||||
ID2,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForUTXOsChangedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad3.rpcClient.RegisterForUTXOsChangedNotificationsWithID(
|
||||
[]string{kaspad1.miningAddress, kaspad2.miningAddress, kaspad3.miningAddress},
|
||||
func(notification *appmessage.UTXOsChangedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID3)
|
||||
},
|
||||
ID3,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForUTXOsChangedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad1.rpcClient.RegisterForNewBlockTemplateNotificationsWithID(
|
||||
func(notification *appmessage.NewBlockTemplateNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID1)
|
||||
},
|
||||
ID1,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForNewBlockTemplateNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad2.rpcClient.RegisterForNewBlockTemplateNotificationsWithID(
|
||||
func(notification *appmessage.NewBlockTemplateNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID2)
|
||||
},
|
||||
ID2,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForNewBlockTemplateNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad3.rpcClient.RegisterForNewBlockTemplateNotificationsWithID(
|
||||
func(notification *appmessage.NewBlockTemplateNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID3)
|
||||
},
|
||||
ID3,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForNewBlockTemplateNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad1.rpcClient.RegisterForVirtualDaaScoreChangedNotificationsWithID(
|
||||
func(notification *appmessage.VirtualDaaScoreChangedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID1)
|
||||
},
|
||||
ID1,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForVirtualDaaScoreChangedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad2.rpcClient.RegisterForVirtualDaaScoreChangedNotificationsWithID(
|
||||
func(notification *appmessage.VirtualDaaScoreChangedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID2)
|
||||
},
|
||||
ID2,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForVirtualDaaScoreChangedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad3.rpcClient.RegisterForVirtualDaaScoreChangedNotificationsWithID(
|
||||
func(notification *appmessage.VirtualDaaScoreChangedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID3)
|
||||
},
|
||||
ID3,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForVirtualDaaScoreChangedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad1.rpcClient.RegisterForVirtualSelectedParentChainChangedNotificationsWithID(
|
||||
false,
|
||||
func(notification *appmessage.VirtualSelectedParentChainChangedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID1)
|
||||
},
|
||||
ID1,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForVirtualSelectedParentChainChangedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad2.rpcClient.RegisterForVirtualSelectedParentChainChangedNotificationsWithID(
|
||||
false,
|
||||
func(notification *appmessage.VirtualSelectedParentChainChangedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID2)
|
||||
},
|
||||
ID2,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForVirtualSelectedParentChainChangedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad3.rpcClient.RegisterForVirtualSelectedParentChainChangedNotificationsWithID(
|
||||
false,
|
||||
func(notification *appmessage.VirtualSelectedParentChainChangedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID3)
|
||||
},
|
||||
ID3,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForVirtualSelectedParentChainChangedNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad1.rpcClient.RegisterForFinalityConflictsNotificationsWithID(
|
||||
func(notification *appmessage.FinalityConflictNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID1)
|
||||
},
|
||||
func(notification *appmessage.FinalityConflictResolvedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID1)
|
||||
},
|
||||
ID1,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForFinalityConflictsNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad2.rpcClient.RegisterForFinalityConflictsNotificationsWithID(
|
||||
func(notification *appmessage.FinalityConflictNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID2)
|
||||
},
|
||||
func(notification *appmessage.FinalityConflictResolvedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID1)
|
||||
},
|
||||
ID2,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForFinalityConflictsNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad3.rpcClient.RegisterForFinalityConflictsNotificationsWithID(
|
||||
func(notification *appmessage.FinalityConflictNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID3)
|
||||
},
|
||||
func(notification *appmessage.FinalityConflictResolvedNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID1)
|
||||
},
|
||||
ID3,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterForFinalityConflictsNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad1.rpcClient.RegisterPruningPointUTXOSetNotificationsWithID(
|
||||
func(notification *appmessage.PruningPointUTXOSetOverrideNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID1)
|
||||
},
|
||||
ID1,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterPruningPointUTXOSetNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad2.rpcClient.RegisterPruningPointUTXOSetNotificationsWithID(
|
||||
func(notification *appmessage.PruningPointUTXOSetOverrideNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID2)
|
||||
},
|
||||
ID2,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterPruningPointUTXOSetNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
err = kaspad3.rpcClient.RegisterPruningPointUTXOSetNotificationsWithID(
|
||||
func(notification *appmessage.PruningPointUTXOSetOverrideNotificationMessage) {
|
||||
checkIDs(t, notification.ID, ID3)
|
||||
},
|
||||
ID3,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to register with RegisterPruningPointUTXOSetNotificationsWithID: %s", err)
|
||||
}
|
||||
|
||||
const approxBlockAmountToMine = 100
|
||||
|
||||
for i := 0; i < approxBlockAmountToMine/3; i++ {
|
||||
|
||||
mineNextBlock(t, kaspad1)
|
||||
mineNextBlock(t, kaspad2)
|
||||
mineNextBlock(t, kaspad3)
|
||||
}
|
||||
}
|
||||
|
||||
func checkIDs(t *testing.T, notificationID string, expectedID string) {
|
||||
if expectedID == "" {
|
||||
t.Fatalf("the kaspad with assigned id %s is using the default id %s - cannot test id assignment!", expectedID, "")
|
||||
}
|
||||
if notificationID != expectedID {
|
||||
t.Fatalf("the kaspad with assigned id %s got a notification with id %s", expectedID, notificationID)
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,6 +100,33 @@ func standardSetup(t *testing.T) (appHarness1, appHarness2, appHarness3 *appHarn
|
||||
return harnesses[0], harnesses[1], harnesses[2], teardown
|
||||
}
|
||||
|
||||
func standardSetupWithUtxoindex(t *testing.T) (appHarness1, appHarness2, appHarness3 *appHarness, teardownFunc func()) {
|
||||
harnesses, teardown := setupHarnesses(t, []*harnessParams{
|
||||
{
|
||||
p2pAddress: p2pAddress1,
|
||||
rpcAddress: rpcAddress1,
|
||||
miningAddress: miningAddress1,
|
||||
miningAddressPrivateKey: miningAddress1PrivateKey,
|
||||
utxoIndex: true,
|
||||
},
|
||||
{
|
||||
p2pAddress: p2pAddress2,
|
||||
rpcAddress: rpcAddress2,
|
||||
miningAddress: miningAddress2,
|
||||
miningAddressPrivateKey: miningAddress2PrivateKey,
|
||||
utxoIndex: true,
|
||||
}, {
|
||||
p2pAddress: p2pAddress3,
|
||||
rpcAddress: rpcAddress3,
|
||||
miningAddress: miningAddress3,
|
||||
miningAddressPrivateKey: miningAddress3PrivateKey,
|
||||
utxoIndex: true,
|
||||
},
|
||||
})
|
||||
|
||||
return harnesses[0], harnesses[1], harnesses[2], teardown
|
||||
}
|
||||
|
||||
func setRPCClient(t *testing.T, harness *appHarness) {
|
||||
var err error
|
||||
harness.rpcClient, err = newTestRPCClient(harness.rpcAddress)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user