compile
parent
8e008eb286
commit
115358880c
|
@ -1702,20 +1702,20 @@ func (w *Worker) getAddrDescUtxo(addrDesc bchain.AddressDescriptor, ba *bchain.A
|
||||||
|
|
||||||
// GetAddressUtxo returns unspent outputs for given address
|
// GetAddressUtxo returns unspent outputs for given address
|
||||||
func (w *Worker) GetAddressUtxo(address string, onlyConfirmed bool) (Utxos, error) {
|
func (w *Worker) GetAddressUtxo(address string, onlyConfirmed bool) (Utxos, error) {
|
||||||
|
var utxoRes Utxos
|
||||||
if w.chainType != bchain.ChainBitcoinType {
|
if w.chainType != bchain.ChainBitcoinType {
|
||||||
return nil, NewAPIError("Not supported", true)
|
return utxoRes, NewAPIError("Not supported", true)
|
||||||
}
|
}
|
||||||
assets := make([]*AssetSpecific, 0, 0)
|
assets := make([]*AssetSpecific, 0, 0)
|
||||||
assetsMap := make(map[uint32]bool, 0)
|
assetsMap := make(map[uint32]bool, 0)
|
||||||
var utxoRes Utxos
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
addrDesc, err := w.chainParser.GetAddrDescFromAddress(address)
|
addrDesc, err := w.chainParser.GetAddrDescFromAddress(address)
|
||||||
if err != nil {
|
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)
|
utxoRes.Utxos, err := w.getAddrDescUtxo(addrDesc, nil, onlyConfirmed, false)
|
||||||
if err != nil {
|
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
|
// add applicable assets to UTXO so spending based on mutable auxfees/notarization fields can be done by SDK's
|
||||||
for j := range utxoRes.Utxos {
|
for j := range utxoRes.Utxos {
|
||||||
|
|
|
@ -658,10 +658,11 @@ func (w *Worker) GetXpubUtxo(xpub string, onlyConfirmed bool, gap int) (Utxos, e
|
||||||
OnlyConfirmed: onlyConfirmed,
|
OnlyConfirmed: onlyConfirmed,
|
||||||
AssetsMask: bchain.AllMask,
|
AssetsMask: bchain.AllMask,
|
||||||
}, gap)
|
}, gap)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
var utxoRes Utxos
|
var utxoRes Utxos
|
||||||
|
if err != nil {
|
||||||
|
return utxoRes, err
|
||||||
|
}
|
||||||
|
|
||||||
utxoRes.Utxos = make([]Utxo, 0, 8)
|
utxoRes.Utxos = make([]Utxo, 0, 8)
|
||||||
assets := make([]*AssetSpecific, 0, 0)
|
assets := make([]*AssetSpecific, 0, 0)
|
||||||
assetsMap := make(map[uint32]bool, 0)
|
assetsMap := make(map[uint32]bool, 0)
|
||||||
|
|
Loading…
Reference in New Issue