fix(node): fix updating node stats during synchronization#1771
fix(node): fix updating node stats during synchronization#1771lrubiorod merged 1 commit intowitnet:masterfrom
Conversation
| // This will run all the validations again | ||
|
|
||
| let block_hash = block.hash(); | ||
| // TODO. Currently last_block_proposed is not used, but removing it is a breaking change |
There was a problem hiding this comment.
Maybe change the TODO as FIXME to track it and change it when there is a new release with breaking changes. :)
| // During synchronization, we assume that every consolidated block has, | ||
| // at least, one proposed block. |
There was a problem hiding this comment.
| // During synchronization, we assume that every consolidated block has, | |
| // at least, one proposed block. | |
| // During synchronization, we assume that every consolidated block has, at least, one proposed block. |
| @@ -2140,21 +2160,19 @@ fn update_pools( | |||
| transactions_pool.clear_reveals(); | |||
|
|
|||
| // Update own_utxos: | |||
There was a problem hiding this comment.
| // Update own_utxos: | |
| // Update own_utxos |
| let own_pkh = match self.own_pkh { | ||
| Some(x) => x, | ||
| None => { | ||
| log::error!("No OwnPkh loaded in ChainManager"); |
There was a problem hiding this comment.
This is the kind of error that we should never see, isn't it? :P What happens if it is None?
There was a problem hiding this comment.
If it is None, something wrong happened. We have different ways to handle those "non optional" option fields (match, if let, unwrap...) So, we should unify in a refactor PR, but by the moment...
| } else { | ||
| // During synchronization, we assume that every consolidated block has, | ||
| // at least, one proposed block. | ||
| self.chain_state.node_stats.block_proposed_count += 1; |
There was a problem hiding this comment.
I thought this is the count of blocks proposed by this node? So it should be assumed to be 0 unless the miner pkh is the same as the node pkh?
There was a problem hiding this comment.
block_proposed_count is a counter for all the proposed blocks by the node, in order that you can check how many times you create and broadcast a valid block and how many times it was included it in the blockchain, the block_mined_count
There was a problem hiding this comment.
In this case, if you detect a mined block by you during synchronization, you assume that you proposed a candidate in the past
There was a problem hiding this comment.
Ok, so I would assume that the number of proposed blocks is 0, because the probability of proposing a block is very low. Right?
There was a problem hiding this comment.
Ah, nevermind, I missed the if miner_pkh == own_pkh
8c116c3 to
579befd
Compare
| // This will run all the validations again | ||
|
|
||
| let block_hash = block.hash(); | ||
| // FIXME(#1773). Currently last_block_proposed is not used, but removing it is a breaking change |
There was a problem hiding this comment.
| // FIXME(#1773). Currently last_block_proposed is not used, but removing it is a breaking change | |
| // FIXME(#1773): Currently last_block_proposed is not used, but removing it is a breaking change |
579befd to
08cdd38
Compare
Before to stop it:

After clean storage and restarting again:
