Skip to content

Commit 8d029e4

Browse files
magik6kLexLuthr
authored andcommitted
migrate-curio: Add proposal cid to migration
1 parent 813ee47 commit 8d029e4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Diff for: cmd/migrate-curio/migrate.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ func migrateBoostDeals(ctx context.Context, activeSectors bitfield.BitField, mad
275275

276276
// Cbor marshal the Deal Label manually as non-string label will result in "" with JSON marshal
277277
label := prop.Label
278+
propCid, err := prop.Cid()
279+
if err != nil {
280+
return fmt.Errorf("deal: %s: failed to calculate prop.Cid: %s", deal.DealUuid.String(), err)
281+
}
278282
buf := new(bytes.Buffer)
279283
err = label.MarshalCBOR(buf)
280284
if err != nil {
@@ -286,12 +290,12 @@ func migrateBoostDeals(ctx context.Context, activeSectors bitfield.BitField, mad
286290
// Add deal to HarmonyDB
287291
if !a {
288292
_, err = tx.Exec(`INSERT INTO market_mk12_deals (uuid, sp_id, signed_proposal_cid,
289-
proposal_signature, proposal, piece_cid,
293+
proposal_signature, proposal, proposal_cid, piece_cid,
290294
piece_size, offline, verified, start_epoch, end_epoch,
291295
client_peer_id, fast_retrieval, announce_to_ipni, url, url_headers, chain_deal_id, publish_cid, created_at, label)
292-
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)
296+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21)
293297
ON CONFLICT (uuid) DO NOTHING`,
294-
deal.DealUuid.String(), mid, sProp.String(), sigByte, propJson, prop.PieceCID.String(),
298+
deal.DealUuid.String(), mid, sProp.String(), sigByte, propJson, propCid, prop.PieceCID.String(),
295299
prop.PieceSize, deal.IsOffline, prop.VerifiedDeal, prop.StartEpoch, prop.EndEpoch, deal.ClientPeerID.String(),
296300
deal.FastRetrieval, deal.AnnounceToIPNI, tInfo.URL, headers, int64(deal.ChainDealID), deal.PublishCID.String(), deal.CreatedAt, buf.Bytes())
297301

0 commit comments

Comments
 (0)