Skip to content

Commit

Permalink
Check that state proofs aren't empty
Browse files Browse the repository at this point in the history
  • Loading branch information
AlgoStephenAkiki committed May 16, 2022
1 parent 2b75387 commit fe3fd13
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func (node *AlgorandFullNode) Start() {
// startMonitoringRoutines starts the internal monitoring routines used by the node.
func (node *AlgorandFullNode) startMonitoringRoutines() {
node.monitoringRoutinesWaitGroup.Add(2)
go node.txPoolGaugeThread()
go node.txPoolGaugeThread(node.ctx.Done())
// Delete old participation keys
go node.oldKeyDeletionThread(node.ctx.Done())

Expand Down Expand Up @@ -899,6 +899,16 @@ func (node *AlgorandFullNode) InstallParticipationKey(partKeyBinary []byte) (acc
}
defer partkey.Close()

// We want to make sure that the state proof keys are included in the participation key

if partkey.StateProofSecrets == nil {
return account.ParticipationID{}, fmt.Errorf("cannot install partkey with missing state proof keys")
}

if len(partkey.StateProofSecrets.GetAllKeys()) == 0 {
return account.ParticipationID{}, fmt.Errorf("cannot install partkey with missing state proof keys")
}

if partkey.Parent == (basics.Address{}) {
return account.ParticipationID{}, fmt.Errorf("cannot install partkey with missing (zero) parent address")
}
Expand Down

0 comments on commit fe3fd13

Please sign in to comment.