Skip to content

Commit

Permalink
renterd: use private key directly
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Sep 25, 2024
1 parent 9a1351f commit 8134689
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion nodes/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,14 @@ func (m *Manager) addNodeAndWait(ctx context.Context, node Node, ready chan<- st
// Close closes the manager and all running nodes and waits for them to exit.
func (m *Manager) Close() error {
m.mu.Lock()
defer m.mu.Unlock()

select {
case <-m.close:
m.mu.Unlock()
return errors.New("manager already closed")
default:
close(m.close)
m.mu.Unlock()
m.wg.Wait()
return nil
}
Expand Down
7 changes: 2 additions & 5 deletions nodes/renterd.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"strings"
"time"

"github.com/minio/blake2b-simd"
"go.sia.tech/core/gateway"
"go.sia.tech/core/types"
"go.sia.tech/coreutils"
Expand Down Expand Up @@ -212,9 +211,7 @@ func (m *Manager) StartRenterd(ctx context.Context, sk types.PrivateKey, ready c
}
defer wm.Close()

masterKey := blake2b.Sum256(append([]byte("worker"), sk...))

b, err := bus.New(ctx, masterKey, am, wh, cm, s, wm, store, 24*time.Hour, log.Named("bus"))
b, err := bus.New(ctx, ([32]byte)(sk[:32]), am, wh, cm, s, wm, store, 24*time.Hour, log.Named("bus"))
if err != nil {
return fmt.Errorf("failed to create bus: %w", err)
}
Expand Down Expand Up @@ -244,7 +241,7 @@ func (m *Manager) StartRenterd(ctx context.Context, sk types.PrivateKey, ready c
DownloadMaxMemory: 1 << 28, // 256 MiB
UploadMaxMemory: 1 << 28, // 256 MiB
UploadMaxOverdrive: 5,
}, masterKey, busClient, log.Named("worker"))
}, ([32]byte)(sk[:32]), busClient, log.Named("worker"))
if err != nil {
return fmt.Errorf("failed to create worker: %w", err)
}
Expand Down

0 comments on commit 8134689

Please sign in to comment.