harmony-one / harmony

The core protocol of harmony
https://harmony.one
GNU Lesser General Public License v3.0
1.46k stars 286 forks source link

Isbackup initialization with provided value. #4644

Open Frozen opened 6 months ago

Frozen commented 6 months ago

value on node start is not provided to consensus, can be changed only by api call

sophoah commented 5 months ago

Hey @Frozen nice addition in the logs. I just tested in localnet

{"level":"info","port":"9004","ip":"127.0.0.1","myBlock":440,"myViewID":440,"phase":"Announce","mode":"Normal","caller":"/home/soph/harmony/harmony/consensus/consensus_v2.go:110","time":"2024-04-04T11:52:00.00257412+07:00","message":"IsBackup: true"}
{"level":"info","port":"9004","ip":"127.0.0.1","myBlock":440,"myViewID":440,"phase":"Announce","mode":"Normal","MsgBlockNum":440,"MsgViewID":440,"caller":"/home/soph/harmony/harmony/consensus/validator.go:187","time":"2024-04-04T11:52:00.002605096+07:00","message":"[OnPrepared] Received prepared message"}
{"level":"info","port":"9004","ip":"127.0.0.1","caller":"/home/soph/harmony/harmony/internal/chain/reward.go:297","time":"2024-04-04T11:52:00.012140987+07:00","message":"Commit sigs are ready"}
{"level":"warn","port":"9004","ip":"127.0.0.1","myBlock":440,"myViewID":440,"phase":"Announce","mode":"Normal","caller":"/home/soph/harmony/harmony/consensus/validator.go:159","time":"2024-04-04T11:52:00.012297026+07:00","message":"[sendCommitMessages] I am a backup node, will not send commit message"}

however even being a backup node, the node still show BINGO :

{"level":"info","port":"9004","ip":"127.0.0.1","blockNum":440,"epochNum":7,"ViewId":440,"blockHash":"0x45fb5e804f8b91f93485068982d67cb05bdcfc50ebc5c16802ac482b2a96d69f","numTxns":0,"numStakingTxns":0,"numSignatures":0,"mode":"Normal","caller":"/home/soph/harmony/harmony/node/node_handler.go:351","time":"2024-04-04T11:52:00.038832126+07:00","message":"BINGO !!! Reached Consensus"}

which has a "numSignatures":0 and is the expected behavior, so this is also good.

However I'd like to keep the BINGO message for only when consensus mode is normal and node mode isbackup is False because let's be real, the node when in backup mode didn't Reached Consensus. At the end showing the BINGO here would only lead to confusion from the node operator.