accountUtxos = w.AccountMgr.ListUnconfirmedUtxo(accountID, isSmartContract)
}
- confirmedUtxos := w.store.GetAccountUtxos(prefix + id)
- accountUtxos = append(accountUtxos, confirmedUtxos...)
+ rawConfirmedUTXOs := w.store.GetAccountUTXOs(prefix + id)
+ confirmedUTXOs := []*account.UTXO{}
+ for _, rawConfirmedUTXO := range rawConfirmedUTXOs {
+ confirmedUTXO := new(account.UTXO)
+ if err := json.Unmarshal(rawConfirmedUTXO, confirmedUTXO); err != nil {
+ log.WithFields(log.Fields{"module": logModule, "err": err}).Warn("GetAccountUTXOs fail on unmarshal utxo")
+ continue
+ }
+ confirmedUTXOs = append(confirmedUTXOs, confirmedUTXO)
+ }
+ accountUtxos = append(accountUtxos, confirmedUTXOs...)
+
newAccountUtxos := []*account.UTXO{}
for _, accountUtxo := range accountUtxos {
if vote && accountUtxo.Vote == nil {
inputUtxos := txInToUtxos(tx, statusFail)
for _, inputUtxo := range inputUtxos {
if segwit.IsP2WScript(inputUtxo.ControlProgram) {
- w.store.DeleteStardardUTXOByOutputID(inputUtxo.OutputID)
+ w.store.DeleteStardardUTXO(inputUtxo.OutputID)
} else {
- w.store.DeleteContractUTXOByOutputID(inputUtxo.OutputID)
+ w.store.DeleteContractUTXO(inputUtxo.OutputID)
}
}
outputUtxos := txOutToUtxos(tx, statusFail, b.Height)
utxos := w.filterAccountUtxo(outputUtxos)
if err := w.saveUtxos(utxos); err != nil {
- log.WithFields(log.Fields{"module": logModule, "err": err}).Error("attachUtxos fail on batchSaveUtxos")
+ log.WithFields(log.Fields{"module": logModule, "err": err}).Error("attachUtxos fail on saveUtxos")
}
}
}
}
if segwit.IsP2WScript(code) {
- w.store.DeleteStardardUTXOByOutputID(*tx.ResultIds[j])
+ w.store.DeleteStardardUTXO(*tx.ResultIds[j])
} else {
- w.store.DeleteContractUTXOByOutputID(*tx.ResultIds[j])
+ w.store.DeleteContractUTXO(*tx.ResultIds[j])
}
}
var hash [32]byte
sha3pool.Sum256(hash[:], []byte(s))
- data := w.store.GetRawProgramByAccountHash(hash)
+ data := w.store.GetRawProgram(hash)
if data == nil {
continue
}