// ListAccountUTXOs get all account unspent outputs
func (store *MockWalletStore) ListAccountUTXOs(key string) ([]*acc.UTXO, error) {
- fmt.Println("ListAccountUTXOs []byte(key):", []byte(key))
accountUtxoIter := store.walletDB.IteratorPrefix([]byte(key))
defer accountUtxoIter.Release()
if unconfirmed {
accountUtxos = w.AccountMgr.ListUnconfirmedUtxo(accountID, isSmartContract)
}
- idBytes, _ := hex.DecodeString(id)
+ idBytes, err := hex.DecodeString(id)
+ if err != nil {
+ log.WithFields(log.Fields{"module": logModule, "err": err}).Error("GetAccountUtxos fail.")
+ }
- // confirmedUTXOs, err := w.store.ListAccountUTXOs(string(prefix) + id)
confirmedUTXOs, err := w.store.ListAccountUTXOs(string(append(prefix, idBytes...)))
if err != nil {
log.WithFields(log.Fields{"module": logModule, "err": err}).Error("GetAccountUtxos fail.")
string(mock.StandardUTXOKey(bc.Hash{V0: 2, V1: 2})): &account.UTXO{
OutputID: bc.Hash{V0: 2, V1: 2},
},
-
- // hex.EncodeToString(mock.StandardUTXOKey(bc.Hash{V0: 1})): &account.UTXO{
- // OutputID: bc.Hash{V0: 1},
- // },
- // hex.EncodeToString(mock.StandardUTXOKey(bc.Hash{V0: 1, V1: 2})): &account.UTXO{
- // OutputID: bc.Hash{V0: 1, V1: 2},
- // },
- // hex.EncodeToString(mock.StandardUTXOKey(bc.Hash{V0: 2})): &account.UTXO{
- // OutputID: bc.Hash{V0: 2},
- // },
- // hex.EncodeToString(mock.StandardUTXOKey(bc.Hash{V0: 2, V1: 2})): &account.UTXO{
- // OutputID: bc.Hash{V0: 2, V1: 2},
- // },
},
unconfirmedUtxos: []*account.UTXO{
&account.UTXO{
if err != nil {
t.Error(err)
}
- fmt.Println("k:", []byte(k))
- // newKey, _ := hex.DecodeString(k)
- // fmt.Println("newkey:", newKey)
- // testDB.Set([]byte(k), data)
testDB.Set([]byte(k), data)
}
}
for k := range c.dbUtxos {
- // newKey, _ := hex.DecodeString(k)
- // testDB.Delete([]byte(k))
testDB.Delete([]byte(k))
}
}