Skip to main content

NewPluginStateManager

Creates a PluginStateManager initialized with the previous round's state.

def NewPluginStateManager(
prevState: []byte,
prevVersion: uint8
) - > *PluginStateManager

Creates a PluginStateManager initialized with the previous round's state. This function is used to restore the state of a plugin from a previous execution, allowing for continuity between rounds.

Parameters

NameTypeDescription
prevState[]byteThe byte slice representing the serialized state from the previous round. This data is used to rehydrate the plugin's state.
prevVersionuint8The version of the previous state. This allows for handling different state formats or migrations if the state structure changes over time.

Returns

TypeDescription
*PluginStateManagerA pointer to a new PluginStateManager instance, initialized with the provided previous state and version.