stacks-core
stacks-core copied to clipboard
[stacks-signer] add reward cycle number to all stackerdb messages to prevent new signers reading old data
Currently this behaviour has been observed:
Signers N-1 come online. Read stackerdb. See nothing. do DKG, Signers N come online. Read stackerdb. See nothing. do DKG Signers N+1 come online. Read stackerdb. See Signers N-1 DKG and apply it. Then fail because they get the same key or fail to do DKG because signers keys have changed, and do DKG again.
Now that signers reread stackerdb messages on spin up (in case they missed incoming messages), they need to make sure that the messages they are reading belong to their own reward cycles. The stackerdb messages currently reuse stackerdb slots which can result in old reward cycle data being reread and applied to the wrong reward cycle