RequiredBlockState declarations on api

This commit is contained in:
Your Name 2023-10-05 01:14:26 +08:00 committed by jstr1121
parent 07eeb7d86a
commit 530cea02f8
3 changed files with 25 additions and 0 deletions

View file

@ -125,6 +125,15 @@ func (ec *Client) GetProof(ctx context.Context, account common.Address, keys []s
return &result, err return &result, err
} }
type RequiredBlockState struct {
}
// GetRequiredBlockState returns all state required to execute a single historical block.
func (ec *Client) GetRequiredBlockState(ctx context.Context, blockNumber *big.Int) (*RequiredBlockState, error) {
result := RequiredBlockState{}
return &result, nil
}
// CallContract executes a message call transaction, which is directly executed in the VM // CallContract executes a message call transaction, which is directly executed in the VM
// of the node, but never mined into the blockchain. // of the node, but never mined into the blockchain.
// //

View file

@ -933,6 +933,18 @@ func (s *BlockChainAPI) GetBlockReceipts(ctx context.Context, blockNrOrHash rpc.
return result, nil return result, nil
} }
// GetRequiredBlockState returns all state required to execute a single historical block.
func (s *BlockChainAPI) GetRequiredBlockState(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]map[string]interface{}, error) {
block, err := s.b.BlockByNumberOrHash(ctx, blockNrOrHash)
if block == nil || err != nil {
// When the block doesn't exist, the RPC method should return JSON null
return nil, nil
}
result := make([]map[string]interface{}, 1)
return result, nil
}
// OverrideAccount indicates the overriding fields of account during the execution // OverrideAccount indicates the overriding fields of account during the execution
// of a message call. // of a message call.
// Note, state and stateDiff can't be specified at the same time. If state is // Note, state and stateDiff can't be specified at the same time. If state is

View file

@ -1619,6 +1619,10 @@ func TestRPCGetBlockReceipts(t *testing.T) {
} }
} }
func TestRPCGetRequiredBlockState(t *testing.T) {
//
}
func testRPCResponseWithFile(t *testing.T, testid int, result interface{}, rpc string, file string) { func testRPCResponseWithFile(t *testing.T, testid int, result interface{}, rpc string, file string) {
data, err := json.MarshalIndent(result, "", " ") data, err := json.MarshalIndent(result, "", " ")
if err != nil { if err != nil {