diff --git a/configs/configs.go b/configs/configs.go index 7ca3fb8..7f46be1 100644 --- a/configs/configs.go +++ b/configs/configs.go @@ -12,7 +12,7 @@ import "time" // account const ( // CESS token precision - CESSTokenPrecision = 1_000_000_000_000 + CESSTokenPrecision = 1_000_000_000_000_000_000 // MinimumBalance is the minimum balance required for the program to run // The unit is pico MinimumBalance = 2 * CESSTokenPrecision @@ -24,7 +24,6 @@ const ( Header_BucketName = "BucketName" Header_Account = "Account" Header_Operation = "Operation" - TokenDated = 60 * 60 * 24 * 30 ) const FileCacheExpirationTime = 720 diff --git a/configs/system.go b/configs/system.go index d59883f..b478de1 100644 --- a/configs/system.go +++ b/configs/system.go @@ -14,7 +14,7 @@ const ( // Name space NameSpace = Name // version - Version = Name + " " + "v0.3.5 pre-release" + Version = Name + " " + "v0.3.5" // description Description = "Object storage service based on CESS network" ) diff --git a/go.mod b/go.mod index e9da0f9..c40594f 100644 --- a/go.mod +++ b/go.mod @@ -4,9 +4,9 @@ go 1.20 require ( github.com/AstaFrode/go-libp2p v0.26.4-0.20231113143058-912296254d44 - github.com/CESSProject/cess-go-sdk v0.4.22 + github.com/CESSProject/cess-go-sdk v0.5.0 github.com/CESSProject/go-keyring v0.0.0-20220614131247-ee3a8da30fde - github.com/CESSProject/p2p-go v0.2.11 + github.com/CESSProject/p2p-go v0.3.0 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/cbergoon/merkletree v0.2.0 github.com/centrifuge/go-substrate-rpc-client/v4 v4.2.1 diff --git a/go.sum b/go.sum index ebcc109..82767d2 100644 --- a/go.sum +++ b/go.sum @@ -21,12 +21,12 @@ github.com/AstaFrode/go-peertaskqueue v0.8.2-0.20231108073729-990e433425a4 h1:fu github.com/AstaFrode/go-peertaskqueue v0.8.2-0.20231108073729-990e433425a4/go.mod h1:0YcQDsyTRKBTK9yE22DQgiwQndGFvenqMvD6Spkxl28= 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.4.22 h1:d9xnRHaaudntJEHy0cCXysuNfj+cfvfdOs3QsLnF21o= -github.com/CESSProject/cess-go-sdk v0.4.22/go.mod h1:IamF02Ng+FQvThFbQRtpEpPzmlPOXqQzgaF9YDE0YhY= +github.com/CESSProject/cess-go-sdk v0.5.0 h1:N87Trs+Btt3mftpRxMt7ZeI7va4v/SaT4OiZxi00KA4= +github.com/CESSProject/cess-go-sdk v0.5.0/go.mod h1:IamF02Ng+FQvThFbQRtpEpPzmlPOXqQzgaF9YDE0YhY= github.com/CESSProject/go-keyring v0.0.0-20220614131247-ee3a8da30fde h1:5MDRjjtg6PEhqyVjupwaapN96cOZiddOGAYwKQeaTu0= github.com/CESSProject/go-keyring v0.0.0-20220614131247-ee3a8da30fde/go.mod h1:RUXBd3ROP98MYepEEa0Y0l/T0vQlIKqFJxI/ocdnRLM= -github.com/CESSProject/p2p-go v0.2.11 h1:2o1YzM1YcJhVsZYLAuyWKJ4ib3WA3Qpt6pllVlmKzik= -github.com/CESSProject/p2p-go v0.2.11/go.mod h1:SMwJt5Zpk98k+d2J5gsN+0Forr7MbqOYWbHLd3mBLrI= +github.com/CESSProject/p2p-go v0.3.0 h1:PdwbLBri3qYwIHxaG4BHHS3ETH1BlVRCnBG87jr5cQg= +github.com/CESSProject/p2p-go v0.3.0/go.mod h1:SMwJt5Zpk98k+d2J5gsN+0Forr7MbqOYWbHLd3mBLrI= github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= diff --git a/node/putHandle.go b/node/putHandle.go index 3fc2b1c..8b04249 100644 --- a/node/putHandle.go +++ b/node/putHandle.go @@ -273,7 +273,7 @@ func (n *Node) putHandle(c *gin.Context) { } if filename == "" { - filename = "null.ces" + filename = "null" } if len(filename) < 3 { @@ -410,6 +410,20 @@ func (n *Node) putHandle(c *gin.Context) { return } + txhash, err := n.GenerateStorageOrder( + roothash, + recordInfo.SegmentInfo, + recordInfo.Owner, + recordInfo.Filename, + recordInfo.Buckname, + recordInfo.Filesize, + ) + if err != nil { + n.Upfile("err", fmt.Sprintf("[%s] GenerateStorageOrder failed, tx: %s err: %v", roothash, txhash, err)) + } else { + n.Upfile("info", fmt.Sprintf("[%s] GenerateStorageOrder suc: %s", roothash, txhash)) + } + n.Upfile("info", fmt.Sprintf("[%v] [%s] uploaded successfully", clientIp, roothash)) c.JSON(http.StatusOK, roothash) } diff --git a/node/tracker.go b/node/tracker.go index bb49351..8d0d88b 100644 --- a/node/tracker.go +++ b/node/tracker.go @@ -177,7 +177,8 @@ func (n *Node) trackFile(trackfile string) error { if err != nil { return errors.Wrapf(err, "[%s] [%s] [GenerateStorageOrder]", txhash, roothash) } - time.Sleep(pattern.BlockInterval * 2) + n.Track("info", fmt.Sprintf("[%s] GenerateStorageOrder: %s", roothash, txhash)) + time.Sleep(pattern.BlockInterval * 3) storageOrder, err = n.QueryStorageOrder(roothash) if err != nil { return errors.Wrapf(err, "[%s] [QueryStorageOrder]", roothash)