aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_utilities
diff options
context:
space:
mode:
authorstoffu <stoffu@protonmail.ch>2019-08-13 15:25:53 +0900
committerstoffu <stoffu@protonmail.ch>2019-08-22 21:34:47 +0900
commit2425f27acd843b510136f780eb3600bd11e16f8b (patch)
tree0a6a3544fdfc16680dc9d5d8d5c337162b6705a4 /src/blockchain_utilities
parentblockchain_blackball: add --historical-stat which prints historical stats of ... (diff)
downloadmonero-2425f27acd843b510136f780eb3600bd11e16f8b.tar.xz
blockchain_blackball: use is_output_spent instead of ringdb.blackballed for spentness test
Diffstat (limited to 'src/blockchain_utilities')
-rw-r--r--src/blockchain_utilities/blockchain_blackball.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/blockchain_utilities/blockchain_blackball.cpp b/src/blockchain_utilities/blockchain_blackball.cpp
index 68fd9e14a..857e97afd 100644
--- a/src/blockchain_utilities/blockchain_blackball.cpp
+++ b/src/blockchain_utilities/blockchain_blackball.cpp
@@ -1317,6 +1317,13 @@ int main(int argc, char* argv[])
MINFO("Spent outputs database is empty. Either you haven't run the analysis mode yet, or there is really no output marked as spent.");
goto skip_secondary_passes;
}
+ MDB_txn *txn;
+ int dbr = mdb_txn_begin(env, NULL, 0, &txn);
+ CHECK_AND_ASSERT_THROW_MES(!dbr, "Failed to create LMDB transaction: " + std::string(mdb_strerror(dbr)));
+ MDB_cursor *cur;
+ dbr = mdb_cursor_open(txn, dbi_spent, &cur);
+ CHECK_AND_ASSERT_THROW_MES(!dbr, "Failed to open LMDB cursor: " + std::string(mdb_strerror(dbr)));
+
const uint64_t STAT_WINDOW = 10000;
uint64_t outs_total = 0;
uint64_t outs_spent = 0;
@@ -1342,7 +1349,7 @@ int main(int argc, char* argv[])
++outs_total;
CHECK_AND_ASSERT_THROW_MES(out.target.type() == typeid(txout_to_key), "Out target type is not txout_to_key: height=" + std::to_string(height));
uint64_t out_global_index = outs_per_amount[out.amount]++;
- if (ringdb.blackballed({out.amount, out_global_index}))
+ if (is_output_spent(cur, output_data(out.amount, out_global_index)))
++outs_spent;
}
if (last_tx)
@@ -1358,6 +1365,9 @@ int main(int argc, char* argv[])
}
return true;
});
+ mdb_cursor_close(cur);
+ dbr = mdb_txn_commit(txn);
+ CHECK_AND_ASSERT_THROW_MES(!dbr, "Failed to commit txn creating/opening database: " + std::string(mdb_strerror(dbr)));
goto skip_secondary_passes;
}