)
type rawOutput struct {
- OutputID bc.Hash
+ OutputID bc.Hash
bc.AssetAmount
ControlProgram []byte
txHash bc.Hash
func (w *Wallet) indexTransactions(batch db.Batch, b *types.Block, txStatus *bc.TransactionStatus) error {
annotatedTxs := w.filterAccountTxs(b, txStatus)
saveExternalAssetDefinition(b, w.DB)
- annotateTxsAsset(w, annotatedTxs)
annotateTxsAccount(annotatedTxs, w.DB)
for _, tx := range annotatedTxs {
AccountID: out.AccountID,
Address: out.Address,
ValidHeight: out.ValidHeight,
+ Change: out.change,
}
data, err := json.Marshal(u)
var hash [32]byte
sha3pool.Sum256(hash[:], v.ControlProgram)
if bytes := w.DB.Get(account.CPKey(hash)); bytes != nil {
- annotatedTxs = append(annotatedTxs, buildAnnotatedTransaction(tx, b, statusFail, pos))
+ annotatedTxs = append(annotatedTxs, w.buildAnnotatedTransaction(tx, b, statusFail, pos))
continue transactionLoop
}
}
continue
}
if bytes := w.DB.Get(account.StandardUTXOKey(outid)); bytes != nil {
- annotatedTxs = append(annotatedTxs, buildAnnotatedTransaction(tx, b, statusFail, pos))
+ annotatedTxs = append(annotatedTxs, w.buildAnnotatedTransaction(tx, b, statusFail, pos))
continue transactionLoop
}
}
// GetTransactionsByTxID get account txs by account tx ID
func (w *Wallet) GetTransactionsByTxID(txID string) ([]*query.AnnotatedTx, error) {
- var annotatedTxs []*query.AnnotatedTx
+ annotatedTxs := []*query.AnnotatedTx{}
formatKey := ""
if txID != "" {
if err := json.Unmarshal(txIter.Value(), annotatedTx); err != nil {
return nil, err
}
+ annotateTxsAsset(w, []*query.AnnotatedTx{annotatedTx})
annotatedTxs = append([]*query.AnnotatedTx{annotatedTx}, annotatedTxs...)
}
}
if findTransactionsByAccount(annotatedTx, accountID) {
+ annotateTxsAsset(w, []*query.AnnotatedTx{annotatedTx})
annotatedTxs = append(annotatedTxs, annotatedTx)
}
}