Skip to content

Commit

Permalink
migrate-curio: Correctly marshal the libp2p key
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Oct 13, 2024
1 parent 024988d commit 85445a5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/migrate-curio/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,12 @@ func generateNewKeys(ctx context.Context, maddr address.Address, hdb *harmonydb.
return fmt.Errorf("generating private key: %w", err)
}

pkey, err := pk.Raw()
kbytes, err := crypto.MarshalPrivateKey(pk)
if err != nil {
return fmt.Errorf("converting private key: %w", err)
return fmt.Errorf("marshaling private key: %w", err)
}

_, err = hdb.Exec(ctx, `INSERT INTO libp2p (sp_id, priv_key) VALUES ($1, $2) ON CONFLICT(sp_id) DO NOTHING`, mid, pkey)
_, err = hdb.Exec(ctx, `INSERT INTO libp2p (sp_id, priv_key) VALUES ($1, $2) ON CONFLICT(sp_id) DO NOTHING`, mid, kbytes)
if err != nil {
return fmt.Errorf("inserting private key into libp2p table: %w", err)
}
Expand Down

0 comments on commit 85445a5

Please sign in to comment.