Skip to content

Commit

Permalink
fix: set deal id when import deal from boost
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Oct 31, 2023
1 parent 1608706 commit bea21de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cli/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

"github.com/docker/go-units"
"github.com/fatih/color"
"github.com/google/uuid"
"github.com/howeyc/gopass"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-cidutil/cidenc"
Expand Down Expand Up @@ -552,7 +553,13 @@ func (d *boostDeal) minerDeal() (deal *types.MinerDeal, err error) {
}
pieceCID := shared.MustParseCid(d.PieceCid)

id, err := uuid.Parse(d.ID)
if err != nil {
return nil, err
}

deal = &types.MinerDeal{
ID: id,
ClientDealProposal: market.ClientDealProposal{
Proposal: market.DealProposal{
PieceCID: pieceCID,
Expand Down
4 changes: 4 additions & 0 deletions cli/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ func TestUnmarshalBoostDeal(t *testing.T) {
assert.NoError(t, err)
fmt.Println("create at", createAt)

minerDeal, err := deal.minerDeal()
assert.NoError(t, err)
assert.Equal(t, "1b4b8f7e-6b55-4f71-93d7-be1b46ea00c6", minerDeal.ID.String())

data, err = os.ReadFile("./testdata/lotus_miner_query_result.json")
assert.NoError(t, err)

Expand Down

0 comments on commit bea21de

Please sign in to comment.