mirror of https://github.com/poanetwork/gecko.git
fix bug where no chains other than platform created if staking disabled
This commit is contained in:
parent
fb5f6a9d5d
commit
633e72394f
|
@ -361,8 +361,9 @@ func (n *Node) initChains() {
|
|||
n.vmManager.RegisterVMFactory(
|
||||
/*vmID=*/ platformvm.ID,
|
||||
/*vmFactory=*/ &platformvm.Factory{
|
||||
ChainManager: n.chainManager,
|
||||
Validators: vdrs,
|
||||
ChainManager: n.chainManager,
|
||||
Validators: vdrs,
|
||||
StakingEnabled: n.Config.EnableStaking,
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
@ -16,14 +16,16 @@ var (
|
|||
|
||||
// Factory can create new instances of the Platform Chain
|
||||
type Factory struct {
|
||||
ChainManager chains.Manager
|
||||
Validators validators.Manager
|
||||
ChainManager chains.Manager
|
||||
Validators validators.Manager
|
||||
StakingEnabled bool
|
||||
}
|
||||
|
||||
// New returns a new instance of the Platform Chain
|
||||
func (f *Factory) New() interface{} {
|
||||
return &VM{
|
||||
ChainManager: f.ChainManager,
|
||||
Validators: f.Validators,
|
||||
ChainManager: f.ChainManager,
|
||||
Validators: f.Validators,
|
||||
StakingEnabled: f.StakingEnabled,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -136,8 +136,13 @@ func init() {
|
|||
type VM struct {
|
||||
*core.SnowmanVM
|
||||
|
||||
// Node's validator manager
|
||||
// Maps Subnets --> nodes in the Subnet
|
||||
Validators validators.Manager
|
||||
|
||||
// true if the node is being run with staking enabled
|
||||
StakingEnabled bool
|
||||
|
||||
// The node's chain manager
|
||||
ChainManager chains.Manager
|
||||
|
||||
|
@ -327,7 +332,7 @@ func (vm *VM) createChain(tx *CreateChainTx) {
|
|||
vm.Ctx.Log.Error("blockchain %s validated by Subnet %s but couldn't get that Subnet. Blockchain not created")
|
||||
return
|
||||
}
|
||||
if !validators.Contains(vm.Ctx.NodeID) { // This node doesn't validate this blockchain
|
||||
if !validators.Contains(vm.Ctx.NodeID) && vm.StakingEnabled { // This node doesn't validate this blockchain
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue