fix getblock & tx for genesis

pull/181/head
Sotiris Blad 2019-05-03 01:53:51 +03:00 committed by Martin
parent 7c4e8c5750
commit beb8244570
1 changed files with 15 additions and 0 deletions

View File

@ -61,6 +61,21 @@ func (b *MonetaryUnitRPC) Initialize() error {
// Get Block
func (b *MonetaryUnitRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) {
if height == 0 {
var err error
if hash == "" {
hash, err = b.GetBlockHash(height)
if err != nil {
return nil, err
}
}
if !b.ParseBlocks {
return b.GetBlockFull(hash)
}
return b.GetBlockWithoutHeader(hash, height)
}
var err error
if hash == "" && height > 0 {
hash, err = b.GetBlockHash(height)