kaspad/domain/consensus/model/externalapi/consensus_events.go
Svarog 24c94b38be
Move OnBlockAdded event to the channel that was only used by virtualChanged events (#2059)
* 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>
2022-05-24 01:11:01 +03:00

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
}