Skip to content

Commit 9b49a92

Browse files
Remove Node Key Monitoring Function
Resolves #2596 Removes function which calls loadParticipationKeys() every 60 seconds since MakeFull() for the FullNode does the same thing
1 parent 25a2eef commit 9b49a92

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed

node/node.go

+1-36
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,7 @@ func (node *AlgorandFullNode) Start() {
403403

404404
// startMonitoringRoutines starts the internal monitoring routines used by the node.
405405
func (node *AlgorandFullNode) startMonitoringRoutines() {
406-
node.monitoringRoutinesWaitGroup.Add(3)
407-
408-
// PKI TODO: Remove this with #2596
409-
// Periodically check for new participation keys
410-
go node.checkForParticipationKeys(node.ctx.Done())
406+
node.monitoringRoutinesWaitGroup.Add(2)
411407

412408
go node.txPoolGaugeThread(node.ctx.Done())
413409
// Delete old participation keys
@@ -781,24 +777,6 @@ func ensureParticipationDB(genesisDir string, log logging.Logger) (account.Parti
781777
return account.MakeParticipationRegistry(accessor, log)
782778
}
783779

784-
// Reload participation keys from disk periodically
785-
func (node *AlgorandFullNode) checkForParticipationKeys(done <-chan struct{}) {
786-
defer node.monitoringRoutinesWaitGroup.Done()
787-
ticker := time.NewTicker(node.config.ParticipationKeysRefreshInterval)
788-
for {
789-
select {
790-
case <-ticker.C:
791-
err := node.loadParticipationKeys()
792-
if err != nil {
793-
node.log.Errorf("Could not refresh participation keys: %v", err)
794-
}
795-
case <-done:
796-
ticker.Stop()
797-
return
798-
}
799-
}
800-
}
801-
802780
// ListParticipationKeys returns all participation keys currently installed on the node
803781
func (node *AlgorandFullNode) ListParticipationKeys() (partKeys []account.ParticipationRecord, err error) {
804782
return node.accountManager.Registry().GetAll(), nil
@@ -942,19 +920,6 @@ func (node *AlgorandFullNode) InstallParticipationKey(partKeyBinary []byte) (acc
942920
return account.ParticipationID{}, err
943921
}
944922

945-
newFilename := config.PartKeyFilename(partkey.ID().String(), uint64(partkey.FirstValid), uint64(partkey.LastValid))
946-
newFullyQualifiedFilename := filepath.Join(outDir, filepath.Base(newFilename))
947-
948-
if _, err = os.Stat(newFullyQualifiedFilename); os.IsExist(err) {
949-
return account.ParticipationID{}, fmt.Errorf("KeyInstallation: cannot register duplicate participation key")
950-
}
951-
952-
err = os.Rename(fullyQualifiedTempFile, newFullyQualifiedFilename)
953-
954-
if err != nil {
955-
return account.ParticipationID{}, nil
956-
}
957-
958923
return partkey.ID(), nil
959924
}
960925

0 commit comments

Comments
 (0)