Skip to content

Commit

Permalink
update QueryCompleteMinerSnapShot
Browse files Browse the repository at this point in the history
  • Loading branch information
AstaFrode committed Oct 15, 2024
1 parent 3552cef commit 075d7ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion chain/chainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type Chainer interface {
QueryAllRestoralTarget(block int32) ([]RestoralTargetInfo, error)
QueryPendingReplacements(accountID []byte, block int32) (types.U128, error)
QueryCompleteSnapShot(era uint32, block int32) (uint32, uint64, error)
QueryCompleteMinerSnapShot(puk []byte, block int32) (MinerCompleteInfo, error)
QueryCompleteMinerSnapShot(puk []byte, block int32) ([]MinerCompleteInfo, error)
IncreaseCollateral(accountID []byte, token string) (string, error)
IncreaseDeclarationSpace(tibCount uint32) (string, error)
MinerExitPrep() (string, error)
Expand Down
13 changes: 4 additions & 9 deletions chain/sminer.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,12 @@ func (c *ChainClient) QueryCompleteSnapShot(era uint32, block int32) (uint32, ui
// Return:
// - MinerCompleteInfo: CompleteMinerSnapShot
// - error: error message
func (c *ChainClient) QueryCompleteMinerSnapShot(puk []byte, block int32) (MinerCompleteInfo, error) {
func (c *ChainClient) QueryCompleteMinerSnapShot(puk []byte, block int32) ([]MinerCompleteInfo, error) {
if !c.GetRpcState() {
err := c.ReconnectRpc()
if err != nil {
err = fmt.Errorf("rpc err: [%s] [st] [%s.%s] %s", c.GetCurrentRpcAddr(), Sminer, CompleteMinerSnapShot, ERR_RPC_CONNECTION.Error())
return MinerCompleteInfo{}, err
return nil, err
}
}

Expand All @@ -664,14 +664,9 @@ func (c *ChainClient) QueryCompleteMinerSnapShot(puk []byte, block int32) (Miner
}
}()

var data MinerCompleteInfo

param, err := codec.Encode(puk)
if err != nil {
return data, err
}
var data []MinerCompleteInfo

key, err := types.CreateStorageKey(c.metadata, Sminer, CompleteMinerSnapShot, param)
key, err := types.CreateStorageKey(c.metadata, Sminer, CompleteMinerSnapShot, puk)
if err != nil {
err = fmt.Errorf("rpc err: [%s] [st] [%s.%s] CreateStorageKey: %v", c.GetCurrentRpcAddr(), Sminer, CompleteMinerSnapShot, err)
return data, err
Expand Down

0 comments on commit 075d7ca

Please sign in to comment.