forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add les chain reader for istanbul (ethereum#771)
- Loading branch information
1 parent
a90c7a4
commit 36357a9
Showing
2 changed files
with
54 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package les | ||
|
||
import ( | ||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/light" | ||
"github.com/ethereum/go-ethereum/params" | ||
) | ||
|
||
type LightChainReader struct { | ||
config *params.ChainConfig | ||
blockchain *light.LightChain | ||
} | ||
|
||
// Config returns the chain configuration. | ||
func (lcr *LightChainReader) Config() *params.ChainConfig { | ||
return lcr.config | ||
} | ||
|
||
func (lcr *LightChainReader) CurrentHeader() *types.Header { | ||
return lcr.blockchain.CurrentHeader() | ||
} | ||
func (lcr *LightChainReader) GetHeaderByNumber(number uint64) *types.Header { | ||
return lcr.blockchain.GetHeaderByNumber(number) | ||
} | ||
func (lcr *LightChainReader) GetHeaderByHash(hash common.Hash) *types.Header { | ||
return lcr.blockchain.GetHeaderByHash(hash) | ||
} | ||
func (lcr *LightChainReader) GetHeader(hash common.Hash, number uint64) *types.Header { | ||
return lcr.blockchain.GetHeader(hash, number) | ||
} | ||
func (lcr *LightChainReader) GetBlock(hash common.Hash, number uint64) *types.Block { | ||
panic("GetBlock cannot be called on LightChainReader") | ||
return nil | ||
} |