pull/541/head
sidhujag 2020-09-02 19:36:34 -07:00
parent 8e008eb286
commit 115358880c
2 changed files with 8 additions and 7 deletions

View File

@ -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 {

View File

@ -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)