mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
optional block param
This commit is contained in:
parent
ed4cbaf20f
commit
32312912c9
2 changed files with 7 additions and 3 deletions
|
|
@ -1243,8 +1243,12 @@ type multicallOpts struct {
|
|||
//
|
||||
// Note, this function doesn't make any changes in the state/blockchain and is
|
||||
// useful to execute and retrieve values.
|
||||
func (s *BlockChainAPI) MulticallV1(ctx context.Context, opts multicallOpts, blockNrOrHash rpc.BlockNumberOrHash) ([]blockResult, error) {
|
||||
state, header, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
|
||||
func (s *BlockChainAPI) MulticallV1(ctx context.Context, opts multicallOpts, blockNrOrHash *rpc.BlockNumberOrHash) ([]blockResult, error) {
|
||||
if blockNrOrHash == nil {
|
||||
n := rpc.BlockNumberOrHashWithNumber(rpc.LatestBlockNumber)
|
||||
blockNrOrHash = &n
|
||||
}
|
||||
state, header, err := s.b.StateAndHeaderByNumberOrHash(ctx, *blockNrOrHash)
|
||||
if state == nil || err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1659,7 +1659,7 @@ func TestMulticallV1(t *testing.T) {
|
|||
if tc.validation != nil && *tc.validation {
|
||||
opts.Validation = true
|
||||
}
|
||||
result, err := api.MulticallV1(context.Background(), opts, tc.tag)
|
||||
result, err := api.MulticallV1(context.Background(), opts, &tc.tag)
|
||||
if tc.expectErr != nil {
|
||||
if err == nil {
|
||||
t.Fatalf("test %s: want error %v, have nothing", tc.name, tc.expectErr)
|
||||
|
|
|
|||
Loading…
Reference in a new issue