github.com/MetalBlockchain/metalgo@v1.11.9/snow/engine/common/message.go (about) 1 // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. 2 // See the file LICENSE for licensing terms. 3 4 package common 5 6 import "fmt" 7 8 // TODO: Consider renaming Message to, say, VMMessage 9 10 // Message is an enum of the message types that vms can send to consensus 11 type Message uint32 12 13 const ( 14 // PendingTxs notifies a consensus engine that its VM has pending 15 // transactions. 16 // 17 // The consensus engine must eventually call BuildBlock at least once after 18 // receiving this message. If the consensus engine receives multiple 19 // PendingTxs messages between calls to BuildBlock, the engine may only call 20 // BuildBlock once. 21 PendingTxs Message = iota + 1 22 23 // StateSyncDone notifies the state syncer engine that the VM has finishing 24 // syncing the requested state summary. 25 StateSyncDone 26 ) 27 28 func (msg Message) String() string { 29 switch msg { 30 case PendingTxs: 31 return "Pending Transactions" 32 case StateSyncDone: 33 return "State Sync Done" 34 default: 35 return fmt.Sprintf("Unknown Message: %d", msg) 36 } 37 }