diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@
 The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
 and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
 
+## 0.6.5
+### Changed
+- Delete transactions in reverse topological order when reverting a block.
+
 ## 0.6.4
 ### Changed
 - Do not fail silently when importing orphan transactions into the mempool.
diff --git a/haskoin-store.cabal b/haskoin-store.cabal
--- a/haskoin-store.cabal
+++ b/haskoin-store.cabal
@@ -2,10 +2,10 @@
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: fcd3e8377f4350d2c7dc147552da91e06021944773c25399c08de50d10665ca2
+-- hash: 5c969c44d301acb86079c09d17e0b11f747975c2f78bd968bae27f268d20f56c
 
 name:           haskoin-store
-version:        0.6.4
+version:        0.6.5
 synopsis:       Storage and index for Bitcoin and Bitcoin Cash
 description:    Store blocks, transactions, and balances for Bitcoin or Bitcoin Cash, and make that information via REST API.
 category:       Bitcoin, Finance, Network
diff --git a/src/Network/Haskoin/Store/Logic.hs b/src/Network/Haskoin/Store/Logic.hs
--- a/src/Network/Haskoin/Store/Logic.hs
+++ b/src/Network/Haskoin/Store/Logic.hs
@@ -182,7 +182,8 @@
                                 "Attempted to delete block that isn't best: " <>
                                 blockHashToHex h
                             throwError (BlockNotBest bh)
-    mapM_ (deleteTx net i False) (reverse (blockDataTxs bd))
+    txs <- mapM (fmap transactionData . getImportTx i) (blockDataTxs bd)
+    mapM_ (deleteTx net i False . txHash) (reverse (sortTxs txs))
     setBest i (prevBlock (blockDataHeader bd))
     insertBlock i bd {blockDataMainChain = False}
 
