MCPcopy
hub / github.com/canopy-network/canopy / GetRootChainLotteryWinner

Method GetRootChainLotteryWinner

controller/controller.go:222–232  ·  view source on GitHub ↗

GetRootChainLotteryWinner() gets the pseudorandomly selected delegate to reward and their cut

(fsm *fsm.StateMachine, rootHeight uint64)

Source from the content-addressed store, hash-verified

220
221// GetRootChainLotteryWinner() gets the pseudorandomly selected delegate to reward and their cut
222func (c *Controller) GetRootChainLotteryWinner(fsm *fsm.StateMachine, rootHeight uint64) (winner *lib.LotteryWinner, err lib.ErrorI) {
223 // get the root chain id from the state machine
224 rootChainId, err := fsm.LoadRootChainId(c.ChainHeight())
225 // if an error occurred retrieving the id
226 if err != nil {
227 // exit with error
228 return nil, err
229 }
230 // execute the remote call
231 return c.RCManager.GetLotteryWinner(rootChainId, rootHeight, c.Config.ChainId)
232}
233
234// IsValidDoubleSigner() checks if the double signer is valid at a certain double sign height
235func (c *Controller) IsValidDoubleSigner(rootChainId, rootHeight uint64, address []byte) bool {

Callers 1

Calls 3

ChainHeightMethod · 0.95
LoadRootChainIdMethod · 0.65
GetLotteryWinnerMethod · 0.65

Tested by

no test coverage detected