Skip to content

Commit

Permalink
fix QueryDealMap (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
AstaFrode authored Apr 11, 2023
1 parent 9d2fd21 commit 424f616
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions core/chain/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,20 @@ func (c *chainClient) QueryStorageOrder(roothash string) (StorageOrder, error) {
}
}()
var data StorageOrder
var hash FileHash

if len(hash) != len(roothash) {
return data, errors.New("invalid filehash")
}

for i := 0; i < len(hash); i++ {
hash[i] = types.U8(roothash[i])
}

b, err := codec.Encode(hash)
if err != nil {
return data, errors.Wrap(err, "[Encode]")
}

if !c.IsChainClientOk() {
c.SetChainState(false)
Expand All @@ -489,6 +503,7 @@ func (c *chainClient) QueryStorageOrder(roothash string) (StorageOrder, error) {
c.metadata,
FILEBANK,
DEALMAP,
b,
)
if err != nil {
return data, errors.Wrap(err, "[CreateStorageKey]")
Expand Down
4 changes: 2 additions & 2 deletions core/chain/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ type FragmentList struct {

type StorageOrder struct {
Stage types.U8
SegmentList SegmentList
NeededList SegmentList
SegmentList []SegmentList
NeededList []SegmentList
User UserBrief
AssignedMiner []MinerTaskList
ShareInfo []SegmentInfo
Expand Down

0 comments on commit 424f616

Please sign in to comment.