Golang implemented sidechain for Bytom
Revision | c3dc15de4b7b56d8d8412b6048f624f6cf25fbf0 (tree) |
---|---|
Time | 2019-06-24 20:49:31 |
Author | Chengcheng Zhang <943420582@qq.c...> |
Commiter | Chengcheng Zhang |
update
@@ -165,15 +165,17 @@ func (store *WalletStore) GetAccountByAccountID(accountID string) []byte { | ||
165 | 165 | // DeleteTransactions delete transactions when orphan block rollback |
166 | 166 | func (store *WalletStore) DeleteTransactions(height uint64) { |
167 | 167 | tmpTx := query.AnnotatedTx{} |
168 | + batch := store.DB.NewBatch() | |
168 | 169 | txIter := store.DB.IteratorPrefix(calcDeleteKey(height)) |
169 | 170 | defer txIter.Release() |
170 | 171 | |
171 | 172 | for txIter.Next() { |
172 | 173 | if err := json.Unmarshal(txIter.Value(), &tmpTx); err == nil { |
173 | - store.batch.Delete(calcTxIndexKey(tmpTx.ID.String())) | |
174 | + batch.Delete(calcTxIndexKey(tmpTx.ID.String())) | |
174 | 175 | } |
175 | - store.batch.Delete(txIter.Key()) | |
176 | + batch.Delete(txIter.Key()) | |
176 | 177 | } |
178 | + batch.Write() | |
177 | 179 | } |
178 | 180 | |
179 | 181 | // SetTransaction set raw transaction by block height and tx position |