diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/build/azure.go | 1 | ||||
-rw-r--r-- | internal/build/pgp.go | 1 | ||||
-rw-r--r-- | internal/ethapi/api.go | 15 | ||||
-rw-r--r-- | internal/ethapi/backend.go | 6 | ||||
-rw-r--r-- | internal/jsre/pretty.go | 2 |
5 files changed, 14 insertions, 11 deletions
diff --git a/internal/build/azure.go b/internal/build/azure.go index ceac6a4cd..32f535558 100644 --- a/internal/build/azure.go +++ b/internal/build/azure.go @@ -1,3 +1,4 @@ +// Copyright 2016 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify diff --git a/internal/build/pgp.go b/internal/build/pgp.go index 7938df51a..79ab9c06f 100644 --- a/internal/build/pgp.go +++ b/internal/build/pgp.go @@ -1,3 +1,4 @@ +// Copyright 2016 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 0e8e905aa..36bb8c077 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1,4 +1,4 @@ -// Copyright 2016 The go-ethereum Authors +// Copyright 2015 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify @@ -366,14 +366,15 @@ func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI { // BlockNumber returns the block number of the chain head. func (s *PublicBlockChainAPI) BlockNumber() *big.Int { - return s.b.HeaderByNumber(rpc.LatestBlockNumber).Number + header, _ := s.b.HeaderByNumber(context.Background(), rpc.LatestBlockNumber) // latest header should always be available + return header.Number } // GetBalance returns the amount of wei for the given address in the state of the // given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta // block numbers are also allowed. func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*big.Int, error) { - state, _, err := s.b.StateAndHeaderByNumber(blockNr) + state, _, err := s.b.StateAndHeaderByNumber(ctx, blockNr) if state == nil || err != nil { return nil, err } @@ -458,7 +459,7 @@ func (s *PublicBlockChainAPI) GetUncleCountByBlockHash(ctx context.Context, bloc // GetCode returns the code stored at the given address in the state for the given block number. func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (string, error) { - state, _, err := s.b.StateAndHeaderByNumber(blockNr) + state, _, err := s.b.StateAndHeaderByNumber(ctx, blockNr) if state == nil || err != nil { return "", err } @@ -473,7 +474,7 @@ func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Addres // block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block // numbers are also allowed. func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, key string, blockNr rpc.BlockNumber) (string, error) { - state, _, err := s.b.StateAndHeaderByNumber(blockNr) + state, _, err := s.b.StateAndHeaderByNumber(ctx, blockNr) if state == nil || err != nil { return "0x", err } @@ -517,7 +518,7 @@ type CallArgs struct { func (s *PublicBlockChainAPI) doCall(ctx context.Context, args CallArgs, blockNr rpc.BlockNumber) (string, *big.Int, error) { defer func(start time.Time) { glog.V(logger.Debug).Infof("call took %v", time.Since(start)) }(time.Now()) - state, header, err := s.b.StateAndHeaderByNumber(blockNr) + state, header, err := s.b.StateAndHeaderByNumber(ctx, blockNr) if state == nil || err != nil { return "0x", common.Big0, err } @@ -859,7 +860,7 @@ func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex(ctx cont // GetTransactionCount returns the number of transactions the given address has sent for the given block number func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*rpc.HexNumber, error) { - state, _, err := s.b.StateAndHeaderByNumber(blockNr) + state, _, err := s.b.StateAndHeaderByNumber(ctx, blockNr) if state == nil || err != nil { return nil, err } diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index 0aa3da18d..f9358b6cf 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -1,4 +1,4 @@ -// Copyright 2016 The go-ethereum Authors +// Copyright 2015 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify @@ -44,9 +44,9 @@ type Backend interface { AccountManager() *accounts.Manager // BlockChain API SetHead(number uint64) - HeaderByNumber(blockNr rpc.BlockNumber) *types.Header + HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error) - StateAndHeaderByNumber(blockNr rpc.BlockNumber) (State, *types.Header, error) + StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (State, *types.Header, error) GetBlock(ctx context.Context, blockHash common.Hash) (*types.Block, error) GetReceipts(ctx context.Context, blockHash common.Hash) (types.Receipts, error) GetTd(blockHash common.Hash) *big.Int diff --git a/internal/jsre/pretty.go b/internal/jsre/pretty.go index f32e16243..8fe00cc4c 100644 --- a/internal/jsre/pretty.go +++ b/internal/jsre/pretty.go @@ -1,4 +1,4 @@ -// Copyright 2015 The go-ethereum Authors +// Copyright 2016 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify |