mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-04 07:12:54 +00:00
Fixed GetBlock when no block can be found
This commit is contained in:
parent
fde3e01f80
commit
b98cc2fb4e
1 changed files with 9 additions and 1 deletions
|
|
@ -24,7 +24,15 @@ func (lib *PEthereum) GetBlock(hexHash string) *PBlock {
|
||||||
|
|
||||||
block := lib.blockChain.GetBlock(hash)
|
block := lib.blockChain.GetBlock(hash)
|
||||||
|
|
||||||
return &PBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Hex(block.Hash())}
|
var blockInfo *PBlock
|
||||||
|
|
||||||
|
if block != nil {
|
||||||
|
blockInfo = &PBlock{Number: int(block.BlockInfo().Number), Hash: ethutil.Hex(block.Hash())}
|
||||||
|
} else {
|
||||||
|
blockInfo = &PBlock{Number: -1, Hash: ""}
|
||||||
|
}
|
||||||
|
|
||||||
|
return blockInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
func (lib *PEthereum) GetKey() *PKey {
|
func (lib *PEthereum) GetKey() *PKey {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue