From 1a1e9f50e4c26665162fbf7bb64d5a9945870cc0 Mon Sep 17 00:00:00 2001 From: AstaFrode Date: Sat, 16 Dec 2023 11:31:04 +0800 Subject: [PATCH] update CertIdleSpace and ReplaceIdleSpace --- chain/fileBank.go | 13 ++++++++++--- core/sdk/sdk.go | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/chain/fileBank.go b/chain/fileBank.go index 700b78b..1a19cb7 100644 --- a/chain/fileBank.go +++ b/chain/fileBank.go @@ -1463,7 +1463,7 @@ func (c *chainClient) RestoralComplete(restoralFragmentHash string) (string, err } } -func (c *chainClient) CertIdleSpace(idleSignInfo pattern.SpaceProofInfo, sign pattern.TeeSignature, tee_acc []byte) (string, error) { +func (c *chainClient) CertIdleSpace(idleSignInfo pattern.SpaceProofInfo, sign pattern.TeeSignature, teeWorkAcc string) (string, error) { c.lock.Lock() defer func() { c.lock.Unlock() @@ -1480,7 +1480,10 @@ func (c *chainClient) CertIdleSpace(idleSignInfo pattern.SpaceProofInfo, sign pa if !c.GetChainState() { return txhash, pattern.ERR_RPC_CONNECTION } - + tee_acc, err := utils.ParsingPublickey(teeWorkAcc) + if err != nil { + return txhash, errors.Wrap(err, fmt.Sprintf("[ParsingPublickey(%s)]", teeWorkAcc)) + } acc, err := types.NewAccountID(tee_acc) if err != nil { return txhash, errors.Wrap(err, "[NewAccountID]") @@ -1572,7 +1575,7 @@ func (c *chainClient) CertIdleSpace(idleSignInfo pattern.SpaceProofInfo, sign pa } } -func (c *chainClient) ReplaceIdleSpace(idleSignInfo pattern.SpaceProofInfo, sign pattern.TeeSignature, tee_acc []byte) (string, error) { +func (c *chainClient) ReplaceIdleSpace(idleSignInfo pattern.SpaceProofInfo, sign pattern.TeeSignature, teeWorkAcc string) (string, error) { c.lock.Lock() defer func() { c.lock.Unlock() @@ -1589,6 +1592,10 @@ func (c *chainClient) ReplaceIdleSpace(idleSignInfo pattern.SpaceProofInfo, sign if !c.GetChainState() { return txhash, pattern.ERR_RPC_CONNECTION } + tee_acc, err := utils.ParsingPublickey(teeWorkAcc) + if err != nil { + return txhash, errors.Wrap(err, fmt.Sprintf("[ParsingPublickey(%s)]", teeWorkAcc)) + } acc, err := types.NewAccountID(tee_acc) if err != nil { diff --git a/core/sdk/sdk.go b/core/sdk/sdk.go index bbc7881..dd2dd31 100644 --- a/core/sdk/sdk.go +++ b/core/sdk/sdk.go @@ -90,9 +90,9 @@ type SDK interface { // GenerateStorageOrder for generating storage orders GenerateStorageOrder(roothash string, segment []pattern.SegmentDataInfo, owner []byte, filename, buckname string, filesize uint64) (string, error) // CertIdleSpace - CertIdleSpace(idleSignInfo pattern.SpaceProofInfo, sign pattern.TeeSignature, tee_acc []byte) (string, error) + CertIdleSpace(idleSignInfo pattern.SpaceProofInfo, sign pattern.TeeSignature, teeWorkAcc string) (string, error) // ReplaceIdleSpace - ReplaceIdleSpace(idleSignInfo pattern.SpaceProofInfo, sign pattern.TeeSignature, tee_acc []byte) (string, error) + ReplaceIdleSpace(idleSignInfo pattern.SpaceProofInfo, sign pattern.TeeSignature, teeWorkAcc string) (string, error) // ReportTagCalculated ReportTagCalculated(teeSig pattern.TeeSignature, tagSigInfo pattern.TagSigInfo) (string, error)