From 115358880c64e200f3c9693117ece11ee0e864f7 Mon Sep 17 00:00:00 2001 From: sidhujag Date: Wed, 2 Sep 2020 19:36:34 -0700 Subject: [PATCH] compile --- api/worker.go | 8 ++++---- api/xpub.go | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/api/worker.go b/api/worker.go index 99c1978c..854290ca 100644 --- a/api/worker.go +++ b/api/worker.go @@ -1702,20 +1702,20 @@ func (w *Worker) getAddrDescUtxo(addrDesc bchain.AddressDescriptor, ba *bchain.A // GetAddressUtxo returns unspent outputs for given address func (w *Worker) GetAddressUtxo(address string, onlyConfirmed bool) (Utxos, error) { + var utxoRes Utxos if w.chainType != bchain.ChainBitcoinType { - return nil, NewAPIError("Not supported", true) + return utxoRes, NewAPIError("Not supported", true) } assets := make([]*AssetSpecific, 0, 0) assetsMap := make(map[uint32]bool, 0) - var utxoRes Utxos start := time.Now() addrDesc, err := w.chainParser.GetAddrDescFromAddress(address) if err != nil { - return utxos, NewAPIError(fmt.Sprintf("Invalid address '%v', %v", address, err), true) + return utxoRes, NewAPIError(fmt.Sprintf("Invalid address '%v', %v", address, err), true) } utxoRes.Utxos, err := w.getAddrDescUtxo(addrDesc, nil, onlyConfirmed, false) if err != nil { - return utxos, err + return utxoRes, err } // add applicable assets to UTXO so spending based on mutable auxfees/notarization fields can be done by SDK's for j := range utxoRes.Utxos { diff --git a/api/xpub.go b/api/xpub.go index a496951a..8632c29a 100644 --- a/api/xpub.go +++ b/api/xpub.go @@ -658,10 +658,11 @@ func (w *Worker) GetXpubUtxo(xpub string, onlyConfirmed bool, gap int) (Utxos, e OnlyConfirmed: onlyConfirmed, AssetsMask: bchain.AllMask, }, gap) - if err != nil { - return nil, err - } var utxoRes Utxos + if err != nil { + return utxoRes, err + } + utxoRes.Utxos = make([]Utxo, 0, 8) assets := make([]*AssetSpecific, 0, 0) assetsMap := make(map[uint32]bool, 0)