Skip to content

Commit 56c8598

Browse files
committed
deal label fix
1 parent 3a5110d commit 56c8598

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

cmd/migrate-curio/migrate.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"bytes"
45
"database/sql"
56
"encoding/json"
67
"errors"
@@ -266,18 +267,27 @@ func migrateBoostDeals(ctx context.Context, activeSectors bitfield.BitField, mad
266267
return fmt.Errorf("deal: %s: failed to marshal headers: %s", deal.DealUuid.String(), err)
267268
}
268269

270+
// Cbor marshal the Deal Label manually as non-string label will result in "" with JSON marshal
271+
label := prop.Label
272+
buf := new(bytes.Buffer)
273+
err = label.MarshalCBOR(buf)
274+
if err != nil {
275+
return fmt.Errorf("cbor marshal label: %w", err)
276+
277+
}
278+
269279
_, err = hdb.BeginTransaction(ctx, func(tx *harmonydb.Tx) (bool, error) {
270280
// Add deal to HarmonyDB
271281
if !a {
272282
_, err = tx.Exec(`INSERT INTO market_mk12_deals (uuid, sp_id, signed_proposal_cid,
273283
proposal_signature, proposal, piece_cid,
274284
piece_size, offline, verified, start_epoch, end_epoch,
275-
client_peer_id, fast_retrieval, announce_to_ipni, url, url_headers, chain_deal_id, publish_cid, created_at)
276-
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)
285+
client_peer_id, fast_retrieval, announce_to_ipni, url, url_headers, chain_deal_id, publish_cid, created_at, label)
286+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)
277287
ON CONFLICT (uuid) DO NOTHING`,
278288
deal.DealUuid.String(), mid, sProp.String(), sigByte, propJson, prop.PieceCID.String(),
279289
prop.PieceSize, deal.IsOffline, prop.VerifiedDeal, prop.StartEpoch, prop.EndEpoch, deal.ClientPeerID.String(),
280-
deal.FastRetrieval, deal.AnnounceToIPNI, tInfo.URL, headers, int64(deal.ChainDealID), deal.PublishCID.String(), deal.CreatedAt)
290+
deal.FastRetrieval, deal.AnnounceToIPNI, tInfo.URL, headers, int64(deal.ChainDealID), deal.PublishCID.String(), deal.CreatedAt, buf.Bytes())
281291

282292
if err != nil {
283293
return false, fmt.Errorf("deal: %s: failed to add the deal to harmonyDB: %w", deal.DealUuid.String(), err)

0 commit comments

Comments
 (0)