Skip to content

Commit

Permalink
U 077 (#264)
Browse files Browse the repository at this point in the history
* update sdk

* update stat
  • Loading branch information
AstaFrode committed May 26, 2024
1 parent 93fe114 commit ee6917b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
6 changes: 3 additions & 3 deletions cmd/console/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func runCmd(cmd *cobra.Command, args []string) {
os.Exit(1)
}
}
fmt.Println("config: ", cfg.ReadUseCpu())

runtime.SetCpuCores(configs.SysInit(cfg.ReadUseCpu()))

// new chain client
Expand Down Expand Up @@ -982,7 +982,7 @@ func checkRegistrationInfo(cli *chain.ChainClient, signatureAcc, stakingAcc stri
if err.Error() != chain.ERR_Empty {
return configs.Unregistered, decTib, &minerInfo, fmt.Errorf("failed to query signature account information: %v", err)
}
return configs.Unregistered, decTib, &minerInfo, errors.New("signature account does not exist, possible: 1.balance is empty 2.rpc address error")
return configs.Unregistered, decTib, &minerInfo, errors.New("signature account does not exist, possible cause: 1.balance is empty 2.wrong rpc address")
}
token_cess, _ := new(big.Int).SetString(fmt.Sprintf("%d%s", token, chain.TokenPrecision_CESS), 10)
if stakingAcc == "" || stakingAcc == signatureAcc {
Expand All @@ -995,7 +995,7 @@ func checkRegistrationInfo(cli *chain.ChainClient, signatureAcc, stakingAcc stri
if err.Error() != chain.ERR_Empty {
return configs.Unregistered, decTib, &minerInfo, fmt.Errorf("failed to query staking account information: %v", err)
}
return configs.Unregistered, decTib, &minerInfo, fmt.Errorf("staking account does not exist, possible: 1.balance is empty 2.rpc address error")
return configs.Unregistered, decTib, &minerInfo, fmt.Errorf("staking account does not exist, possible: 1.balance is empty 2.wrong rpc address")
}
if stakingAccInfo.Data.Free.CmpAbs(token_cess) < 0 {
return configs.Unregistered, decTib, &minerInfo, fmt.Errorf("staking account balance less than %d %s", token, cli.GetTokenSymbol())
Expand Down
10 changes: 2 additions & 8 deletions cmd/console/stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"fmt"
"math/big"
"os"
"strings"

cess "github.com/CESSProject/cess-go-sdk"
"github.com/CESSProject/cess-go-sdk/chain"
Expand Down Expand Up @@ -53,7 +52,7 @@ func Command_State_Runfunc(cmd *cobra.Command, args []string) {
if err.Error() != chain.ERR_Empty {
out.Err(chain.ERR_RPC_CONNECTION.Error())
} else {
out.Err("signature account does not exist, possible: 1.balance is empty 2.rpc address error")
out.Err("you are not registered as a storage miner, possible cause: 1.insufficient balance in signature account 2.wrong rpc address")
}
os.Exit(1)
}
Expand All @@ -62,11 +61,6 @@ func Command_State_Runfunc(cmd *cobra.Command, args []string) {

beneficiaryAcc, _ := sutils.EncodePublicKeyAsCessAccount(minerInfo.BeneficiaryAccount[:])

name := cli.GetSDKName()
if strings.Contains(name, "bucket") {
name = "storage miner"
}

startBlock, err := cli.QueryStakingStartBlock(cli.GetSignatureAccPulickey(), -1)
if err != nil {
if err.Error() != chain.ERR_Empty {
Expand All @@ -83,7 +77,7 @@ func Command_State_Runfunc(cmd *cobra.Command, args []string) {
}

var tableRows = []table.Row{
{"name", name},
{"name", "storage miner"},
{"peer id", base58.Encode([]byte(string(minerInfo.PeerId[:])))},
{"state", string(minerInfo.State)},
{"staking amount", fmt.Sprintf("%v %s", minerInfo.Collaterals, cli.GetTokenSymbol())},
Expand Down
2 changes: 1 addition & 1 deletion configs/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const (
// version
Version = "v0.7.11 devnet"
// Description is the description of the program
Description = "Storage node implementation in CESS networks"
Description = "Storage miner implementation in CESS networks"
// NameSpace is the cached namespace
NameSpaces = Name
// Chain version
Expand Down
3 changes: 1 addition & 2 deletions node/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"context"
"encoding/json"
"fmt"
"log"
"strings"

"github.com/CESSProject/p2p-go/core"
Expand Down Expand Up @@ -84,7 +83,7 @@ func Subscribe(ctx context.Context, h host.Host, minerRecord MinerRecord, bootno
if err != nil {
continue
}
log.Println("got a peer: ", findpeer.ID.String())
//log.Println("got a peer: ", findpeer.ID.String())
minerRecord.SavePeer(findpeer)
}
}
Expand Down

0 comments on commit ee6917b

Please sign in to comment.