|
1 | 1 | package main
|
2 | 2 |
|
3 | 3 | import (
|
| 4 | + "bytes" |
4 | 5 | "database/sql"
|
5 | 6 | "encoding/json"
|
6 | 7 | "errors"
|
@@ -266,18 +267,27 @@ func migrateBoostDeals(ctx context.Context, activeSectors bitfield.BitField, mad
|
266 | 267 | return fmt.Errorf("deal: %s: failed to marshal headers: %s", deal.DealUuid.String(), err)
|
267 | 268 | }
|
268 | 269 |
|
| 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 | + |
269 | 279 | _, err = hdb.BeginTransaction(ctx, func(tx *harmonydb.Tx) (bool, error) {
|
270 | 280 | // Add deal to HarmonyDB
|
271 | 281 | if !a {
|
272 | 282 | _, err = tx.Exec(`INSERT INTO market_mk12_deals (uuid, sp_id, signed_proposal_cid,
|
273 | 283 | proposal_signature, proposal, piece_cid,
|
274 | 284 | 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) |
277 | 287 | ON CONFLICT (uuid) DO NOTHING`,
|
278 | 288 | deal.DealUuid.String(), mid, sProp.String(), sigByte, propJson, prop.PieceCID.String(),
|
279 | 289 | 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()) |
281 | 291 |
|
282 | 292 | if err != nil {
|
283 | 293 | return false, fmt.Errorf("deal: %s: failed to add the deal to harmonyDB: %w", deal.DealUuid.String(), err)
|
|
0 commit comments