mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
ethclient/gethclient: remove unused function GetProof (#1448)
Co-authored-by: Wit Liu <wit765765346@gmail>
This commit is contained in:
parent
0a1bcdcbff
commit
81f84b79ce
1 changed files with 0 additions and 58 deletions
|
|
@ -61,17 +61,6 @@ func (ec *Client) CreateAccessList(ctx context.Context, msg ethereum.CallMsg) (*
|
|||
return result.Accesslist, uint64(result.GasUsed), result.Error, nil
|
||||
}
|
||||
|
||||
// AccountResult is the result of a GetProof operation.
|
||||
type AccountResult struct {
|
||||
Address common.Address `json:"address"`
|
||||
AccountProof []string `json:"accountProof"`
|
||||
Balance *big.Int `json:"balance"`
|
||||
CodeHash common.Hash `json:"codeHash"`
|
||||
Nonce uint64 `json:"nonce"`
|
||||
StorageHash common.Hash `json:"storageHash"`
|
||||
StorageProof []StorageResult `json:"storageProof"`
|
||||
}
|
||||
|
||||
// StorageResult provides a proof for a key-value pair.
|
||||
type StorageResult struct {
|
||||
Key string `json:"key"`
|
||||
|
|
@ -79,53 +68,6 @@ type StorageResult struct {
|
|||
Proof []string `json:"proof"`
|
||||
}
|
||||
|
||||
// GetProof returns the account and storage values of the specified account including the Merkle-proof.
|
||||
// The block number can be nil, in which case the value is taken from the latest known block.
|
||||
func (ec *Client) GetProof(ctx context.Context, account common.Address, keys []string, blockNumber *big.Int) (*AccountResult, error) {
|
||||
type storageResult struct {
|
||||
Key string `json:"key"`
|
||||
Value *hexutil.Big `json:"value"`
|
||||
Proof []string `json:"proof"`
|
||||
}
|
||||
|
||||
type accountResult struct {
|
||||
Address common.Address `json:"address"`
|
||||
AccountProof []string `json:"accountProof"`
|
||||
Balance *hexutil.Big `json:"balance"`
|
||||
CodeHash common.Hash `json:"codeHash"`
|
||||
Nonce hexutil.Uint64 `json:"nonce"`
|
||||
StorageHash common.Hash `json:"storageHash"`
|
||||
StorageProof []storageResult `json:"storageProof"`
|
||||
}
|
||||
|
||||
// Avoid keys being 'null'.
|
||||
if keys == nil {
|
||||
keys = []string{}
|
||||
}
|
||||
|
||||
var res accountResult
|
||||
err := ec.c.CallContext(ctx, &res, "eth_getProof", account, keys, toBlockNumArg(blockNumber))
|
||||
// Turn hexutils back to normal datatypes
|
||||
storageResults := make([]StorageResult, 0, len(res.StorageProof))
|
||||
for _, st := range res.StorageProof {
|
||||
storageResults = append(storageResults, StorageResult{
|
||||
Key: st.Key,
|
||||
Value: st.Value.ToInt(),
|
||||
Proof: st.Proof,
|
||||
})
|
||||
}
|
||||
result := AccountResult{
|
||||
Address: res.Address,
|
||||
AccountProof: res.AccountProof,
|
||||
Balance: res.Balance.ToInt(),
|
||||
Nonce: uint64(res.Nonce),
|
||||
CodeHash: res.CodeHash,
|
||||
StorageHash: res.StorageHash,
|
||||
StorageProof: storageResults,
|
||||
}
|
||||
return &result, err
|
||||
}
|
||||
|
||||
// CallContract executes a message call transaction, which is directly executed in the VM
|
||||
// of the node, but never mined into the blockchain.
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in a new issue