Skip to content

Commit

Permalink
Trade limit (#186)
Browse files Browse the repository at this point in the history
* update sdk

* update sdk to v0.6.2
  • Loading branch information
AstaFrode committed Sep 6, 2024
1 parent 233e57c commit 94827e2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21
toolchain go1.22.4

require (
github.com/CESSProject/cess-go-sdk v0.6.2-0.20240822075251-93843c2a4017
github.com/CESSProject/cess-go-sdk v0.6.2
github.com/CESSProject/cess-go-tools v0.2.12
github.com/CESSProject/go-keyring v0.0.0-20220614131247-ee3a8da30fde
github.com/CESSProject/p2p-go v0.4.1-0.20240809013702-e989d204843e
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D
git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/CESSProject/cess-go-sdk v0.6.2-0.20240822075251-93843c2a4017 h1:q488VDsCSykpJ1v+QmOxPVolkCBHvSxEP8dW3/+/MH0=
github.com/CESSProject/cess-go-sdk v0.6.2-0.20240822075251-93843c2a4017/go.mod h1:L5IDeS2ydsdgtdybzhWk9fIdBsDkU2XrQyo5mrWHkdQ=
github.com/CESSProject/cess-go-sdk v0.6.2 h1:B1MHE4xWErXVFMIwy9JGJKJxtjmtQhLm9Dnk/pYAh9k=
github.com/CESSProject/cess-go-sdk v0.6.2/go.mod h1:Ue6EJicYGCW3CtEYCni/XT9mJFFc0YAvaBuQuciUdYk=
github.com/CESSProject/cess-go-tools v0.2.12 h1:VqghaGaWgL+JelKXCXaABj4rCDFFRdbhiXifyMpkjqo=
github.com/CESSProject/cess-go-tools v0.2.12/go.mod h1:ov1vSPbTlBSRWl3XqsibrKrK9smIq2hWeGs0TEhactc=
github.com/CESSProject/go-keyring v0.0.0-20220614131247-ee3a8da30fde h1:5MDRjjtg6PEhqyVjupwaapN96cOZiddOGAYwKQeaTu0=
Expand Down
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ func (n *Node) ListTrackFiles() ([]string, error) {

func (n *Node) DeleteTrackFile(filehash string) {
n.trackLock.Lock()
defer n.trackLock.Unlock()
os.Remove(filepath.Join(n.trackDir, filehash))
n.trackLock.Unlock()
}

func (n *Node) RebuildDirs() {
Expand Down
22 changes: 10 additions & 12 deletions node/trackerv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ func (n *Node) checkFileState(fid string) (StorageDataType, bool, error) {
return StorageDataType{}, false, fmt.Errorf("The fid after reprocessing is inconsistent [%s != %s] %v", recordFile.Fid, hash, err)
}
recordFile.Segment = segment
b, err := json.Marshal(&recordFile)
if err != nil {
return StorageDataType{}, false, errors.Wrapf(err, "[%s] [json.Marshal]", fid)
}
err = n.WriteTrackFile(fid, b)
if err != nil {
return StorageDataType{}, false, errors.Wrapf(err, "[%s] [WriteTrackFile]", fid)
}
}

var storageDataType = StorageDataType{
Expand Down Expand Up @@ -179,16 +187,6 @@ func (n *Node) checkFileState(fid string) (StorageDataType, bool, error) {
return storageDataType, false, nil
}

recordFile.PutFlag = false
b, err := json.Marshal(&recordFile)
if err != nil {
return StorageDataType{}, false, errors.Wrapf(err, "[%s] [json.Marshal]", fid)
}
err = n.WriteTrackFile(fid, b)
if err != nil {
return StorageDataType{}, false, errors.Wrapf(err, "[%s] [WriteTrackFile]", fid)
}

// verify the space is authorized
authAccs, err := n.QueryAuthorityList(recordFile.Owner, -1)
if err != nil {
Expand Down Expand Up @@ -222,9 +220,9 @@ func (n *Node) checkFileState(fid string) (StorageDataType, bool, error) {
recordFile.FileSize,
)
if err != nil {
return StorageDataType{}, false, err
return StorageDataType{}, false, fmt.Errorf(" %s [UploadDeclaration] %v", fid, err)
}
n.Logtrack("info", fmt.Sprintf("[%s] PlaceStorageOrder suc: %s", fid, txhash))
n.Logtrack("info", fmt.Sprintf(" %s [UploadDeclaration] suc: %s", fid, txhash))

for index := 0; index < (sconfig.DataShards + sconfig.ParShards); index++ {
var value = make([]string, 0)
Expand Down

0 comments on commit 94827e2

Please sign in to comment.