aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2015-12-25 21:49:15 +0200
committerRiccardo Spagni <ric@spagni.net>2015-12-25 21:49:18 +0200
commitc35501c6adb31fe67857a3cee6ca0df64ad62976 (patch)
tree859b7e0d786900945b2287a45a03b243dc31a2ef /src/blockchain_db
parentMerge pull request #561 (diff)
parentBlockchainDB: Remove txs in reverse order (diff)
downloadmonero-c35501c6adb31fe67857a3cee6ca0df64ad62976.tar.xz
Merge pull request #562
d4c2fae BlockchainDB: Remove txs in reverse order (warptangent)
Diffstat (limited to 'src/blockchain_db')
-rw-r--r--src/blockchain_db/blockchain_db.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp
index 32e89e06a..4fa8cce26 100644
--- a/src/blockchain_db/blockchain_db.cpp
+++ b/src/blockchain_db/blockchain_db.cpp
@@ -26,6 +26,8 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#include <boost/range/adaptor/reversed.hpp>
+
#include "blockchain_db.h"
#include "cryptonote_core/cryptonote_format_utils.h"
#include "profile_tools.h"
@@ -133,13 +135,13 @@ void BlockchainDB::pop_block(block& blk, std::vector<transaction>& txs)
blk = get_top_block();
remove_block();
-
- remove_transaction(get_transaction_hash(blk.miner_tx));
- for (const auto& h : blk.tx_hashes)
+
+ for (const auto& h : boost::adaptors::reverse(blk.tx_hashes))
{
txs.push_back(get_tx(h));
remove_transaction(h);
}
+ remove_transaction(get_transaction_hash(blk.miner_tx));
}
bool BlockchainDB::is_open() const