A validator which has a stake for which the withdrawer address is not the validator address can never mine a block. This is due to the way his power is calculated. In mining.rs, a StakeKey is contructed where own_pkh is the pkh of the validator:
let key = StakeKey::from((own_pkh, own_pkh));
This StakeKey is later on used to query the power of the validator (which will determine its mining eligibility) using the self.by_key staking tracker. However, since that structure is indexed by a StakeKey<validator, withdrawer> no StakeEntry is found and this his power and eligibility is zero.
Either the query_power should use the by_validator structure (not sure if this has other implications) or the validator should construct its StakeKey using the correct withdrawer as second argument (and I don't know how it can currently know the withdrawer address)?
A validator which has a stake for which the withdrawer address is not the validator address can never mine a block. This is due to the way his power is calculated. In
mining.rs
, aStakeKey
is contructed whereown_pkh
is the pkh of the validator:This
StakeKey
is later on used to query the power of the validator (which will determine its mining eligibility) using theself.by_key
staking tracker. However, since that structure is indexed by aStakeKey<validator, withdrawer>
noStakeEntry
is found and this his power and eligibility is zero.Either the
query_power
should use theby_validator
structure (not sure if this has other implications) or the validator should construct itsStakeKey
using the correct withdrawer as second argument (and I don't know how it can currently know the withdrawer address)?