Override desc from address function

pull/526/head
Julien Richard 2020-12-02 11:04:11 +01:00
parent abeb79fd8f
commit fc79ddab39
2 changed files with 12 additions and 0 deletions

View File

@ -66,6 +66,11 @@ func GetChainParams(chain string) *chaincfg.Params {
}
}
func (p *GhostParser) GetAddrDescFromAddress(address string) (bchain.AddressDescriptor, error) {
addressByte := []byte(address)
return bchain.AddressDescriptor(addressByte), nil
}
func (p *GhostParser) GetAddrDescFromVout(output *bchain.Vout) (bchain.AddressDescriptor, error) {
addrs := output.ScriptPubKey.Addresses
if addrs == nil || len(addrs) == 0 {

View File

@ -58,6 +58,13 @@ func (b *GhostRPC) Initialize() error {
// GetBlock returns block with given hash.
func (g *GhostRPC) GetBlock(hash string, height uint32) (*bchain.Block, error) {
var err error
if hash == "" && height > 0 {
hash, err = g.GetBlockHash(height)
if err != nil {
return nil, err
}
}
block, err := g.GetBlockFull(hash)
return block, err
}