Documentation
¶
Index ¶
- func FindSlotLeader(timeslot jamtime.Timeslot, currentState *state.State, keys []ValidatorKeys) (string, crypto.BandersnatchPrivateKey, error)
- func IsSlotLeader(timeslot jamtime.Timeslot, currentState *state.State, ...) (bool, error)
- func NextSafroleState(currentState *state.State, nextTimeslot jamtime.Timeslot) (validator.ValidatorState, statetransition.SafroleOutput, error)
- func ProduceBlock(timeslot jamtime.Timeslot, parentHash crypto.Hash, currentState *state.State, ...) (block.Block, error)
- type ValidatorKeys
- type ValidatorKeysEncoded
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindSlotLeader ¶
func FindSlotLeader(timeslot jamtime.Timeslot, currentState *state.State, keys []ValidatorKeys) (string, crypto.BandersnatchPrivateKey, error)
Figures out the current slot leader by checking each of the validator keys. Useful only for testing.
func IsSlotLeader ¶
func IsSlotLeader(timeslot jamtime.Timeslot, currentState *state.State, privateKey crypto.BandersnatchPrivateKey) (bool, error)
Determines if the given private key is the slot leader for the given timeslot.
func NextSafroleState ¶
func NextSafroleState(currentState *state.State, nextTimeslot jamtime.Timeslot) ( validator.ValidatorState, statetransition.SafroleOutput, error)
Determines the next SAFROLE state. Useful for functions that need to determine the SAFROLE state outside of the main UpdateState function.
func ProduceBlock ¶
func ProduceBlock( timeslot jamtime.Timeslot, parentHash crypto.Hash, currentState *state.State, trie *store.Trie, privateKey crypto.BandersnatchPrivateKey, extrinsics block.Extrinsic, ) (block.Block, error)
Produces a block. This function will stabilize over time and eventually be moved into a node package. Right now it can correctly package tickets but other extrinsics are just added to the block as is.
Types ¶
type ValidatorKeys ¶
type ValidatorKeys struct {
Name string `json:"name"`
Seed string `json:"seed"`
Ed25519Private ed25519.PrivateKey `json:"ed25519_private"`
Ed25519Public ed25519.PublicKey `json:"ed25519_public"`
BandersnatchPrivate crypto.BandersnatchPrivateKey `json:"bandersnatch_private"`
BandersnatchPublic crypto.BandersnatchPublicKey `json:"bandersnatch_public"`
DnsAltName string `json:"dns_alt_name"`
}
Stores validator keys for testing purposes.
func (*ValidatorKeys) MarshalJSON ¶
func (v *ValidatorKeys) MarshalJSON() ([]byte, error)
func (*ValidatorKeys) UnmarshalJSON ¶
func (v *ValidatorKeys) UnmarshalJSON(data []byte) error
type ValidatorKeysEncoded ¶
type ValidatorKeysEncoded struct {
Name string `json:"name"`
Seed string `json:"seed"`
Ed25519Private string `json:"ed25519_private"`
Ed25519Public string `json:"ed25519_public"`
BandersnatchPrivate string `json:"bandersnatch_private"`
BandersnatchPublic string `json:"bandersnatch_public"`
DnsAltName string `json:"dns_alt_name"`
}
Click to show internal directories.
Click to hide internal directories.