mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-01 19:56:45 +00:00

* Move OnBlockAdded event to the channel that was only used by virtualChanged events * Don't send notifications for header-only and invalid blocks * Return block status from block processor and use it for event raising decision * Use MaybeEnqueue for consensus events * go lint * Fix RPC call to actually include tx ids Co-authored-by: msutton <mikisiton2@gmail.com>
31 lines
883 B
Go
31 lines
883 B
Go
package externalapi
|
|
|
|
// ConsensusEvent is an interface type that is implemented by all events raised by consensus
|
|
type ConsensusEvent interface {
|
|
isConsensusEvent()
|
|
}
|
|
|
|
// BlockAdded is an event raised by consensus when a block was added to the dag
|
|
type BlockAdded struct {
|
|
Block *DomainBlock
|
|
}
|
|
|
|
func (*BlockAdded) isConsensusEvent() {}
|
|
|
|
// VirtualChangeSet is an event raised by consensus when virtual changes
|
|
type VirtualChangeSet struct {
|
|
VirtualSelectedParentChainChanges *SelectedChainPath
|
|
VirtualUTXODiff UTXODiff
|
|
VirtualParents []*DomainHash
|
|
VirtualSelectedParentBlueScore uint64
|
|
VirtualDAAScore uint64
|
|
}
|
|
|
|
func (*VirtualChangeSet) isConsensusEvent() {}
|
|
|
|
// SelectedChainPath is a path the of the selected chains between two blocks.
|
|
type SelectedChainPath struct {
|
|
Added []*DomainHash
|
|
Removed []*DomainHash
|
|
}
|