mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
mylmdb and tools updated
This commit is contained in:
parent
3ef2f662a8
commit
a136d90b92
1 changed files with 47 additions and 0 deletions
47
src/mylmdb.h
47
src/mylmdb.h
|
@ -445,6 +445,53 @@ namespace xmreg
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
for_all_output_amounts(std::function<bool(
|
||||||
|
public_key& output_pub_key,
|
||||||
|
uint64_t& amount)> f)
|
||||||
|
{
|
||||||
|
unsigned int flags = MDB_DUPSORT | MDB_DUPFIXED;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
lmdb::txn rtxn = lmdb::txn::begin(m_env, nullptr, MDB_RDONLY);
|
||||||
|
lmdb::dbi rdbi = lmdb::dbi::open(rtxn, "output_amounts", flags);
|
||||||
|
lmdb::cursor cr = lmdb::cursor::open(rtxn, rdbi);
|
||||||
|
|
||||||
|
lmdb::val key_to_find;
|
||||||
|
lmdb::val amount_val;
|
||||||
|
|
||||||
|
|
||||||
|
// process all values for the same key
|
||||||
|
while (cr.get(key_to_find, amount_val, MDB_NEXT))
|
||||||
|
{
|
||||||
|
public_key pub_key;
|
||||||
|
|
||||||
|
epee::string_tools::hex_to_pod(
|
||||||
|
string(key_to_find.data(), key_to_find.size()),
|
||||||
|
pub_key);
|
||||||
|
|
||||||
|
uint64_t xmr_amount = *(amount_val.data<uint64_t>());
|
||||||
|
|
||||||
|
//cout << key_val_to_str(key_to_find, tx_hash_val) << endl;
|
||||||
|
|
||||||
|
if (f(pub_key, xmr_amount) == false)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cr.close();
|
||||||
|
rtxn.abort();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (lmdb::error& e)
|
||||||
|
{
|
||||||
|
cerr << e.what() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
print_all(const string& db_name)
|
print_all(const string& db_name)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue