Skip to content

Commit 997c6a8

Browse files
magik6kLexLuthr
authored andcommitted
migrate-curio: Correctly marshal the libp2p key
1 parent ce3cf50 commit 997c6a8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cmd/migrate-curio/migrate.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -576,12 +576,12 @@ func generateNewKeys(ctx context.Context, maddr address.Address, hdb *harmonydb.
576576
return fmt.Errorf("generating private key: %w", err)
577577
}
578578

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

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

0 commit comments

Comments
 (0)