BuildOnViction/tomochain-v1

Error with the latest code base

richardwing121 opened this issue · 8 comments

Hello
I am using the latest code of tomochain on my private chain it gives me following error
ERROR[09-05|18:08:48] No masternode found. Stopping node
ERROR[09-05|18:08:48] No masternode found. Stopping node
ERROR[09-05|18:08:48] No masternode found. Stopping node
ERROR[09-05|18:08:49] No masternode found. Stopping node
ERROR[09-05|18:08:49] No masternode found. Stopping node
ERROR[09-05|18:08:49] No masternode found. Stopping node
ERROR[09-05|18:08:49] No masternode found. Stopping node
ERROR[09-05|18:08:49] No masternode found. Stopping node
ERROR[09-05|18:08:49] No masternode found. Stopping node
ERROR[09-05|18:08:49] No masternode found. Stopping node
ERROR[09-05|18:08:49] No masternode found. Stopping node
ERROR[09-05|18:08:50] No masternode found. Stopping node
And please note i am running 12 node on my private network but the error arrives on some of the random nodes.

        addr := common.HexToAddress(common.MasternodeVotingSMC)
	validator, err := contractValidator.NewTomoValidator(addr, client)
	if err != nil {
		return err
	}
	opts := new(bind.CallOpts)
	candidates, err := validator.GetCandidates(opts)
	if err != nil {
		return err
	}
	var ms []posv.Masternode
	for _, candidate := range candidates {
		v, err := validator.GetCandidateCap(opts, candidate)
		if err != nil {
			return err
		}
		//TODO: smart contract shouldn't return "0x0000000000000000000000000000000000000000"
		if candidate.String() != "0x0000000000000000000000000000000000000000" {
			ms = append(ms, posv.Masternode{Address: candidate, Stake: v})
		}
	}
	if len(ms) == 0 {
		log.Error("No masternode found. Stopping node")
		os.Exit(1)
	}

I guess you dont have any masternodes in the MasternodeVotingSMC smart contract then candidates is empty. Make sure you run network with proper genesis setup.

Thanks @ngtuna
As i am using my private network and i am not using any voting mechanism so according to you what changes i need to do it https://github.com/tomochain/tomochain/blob/master/core/blockchain.go

so that i can run my private network properly without any voting mechanism

Generate proper genesis file with puppeth.

$ make puppeth
$ ./build/bin/puppeth

Then follow its instruction to generate genesis file.

As i am running the private chain and i don't want to change my genesis file @ngtuna

Then you can't do anything else. Your current chain doesn't have any masternode to create block, it has stopped.

You said you want to run network without voting mechanism, so that your genesis must declare some masternodes (at least 3) from the beginning. And those masternodes will be remaining unchanged until the end of the chain's life.

Another approach: running a private Ethereum with POA clique consensus.

Hello @ngtuna As i am running with V1.5.1 it works properly As i upgrde my node to v 1.5.2 it gives me the above error

Any suggestion @ngtuna why it's happening ?

ping me on Telegram @ngtuna I will support