ringdb: use the genesis block as a db name

This will avoid careless forkers polluting the shared database
even if they make their own chain. They'll then automatically
start using another subdb, and any key-reusing fork of those
forks will reuse their subdbs.
This commit is contained in:
moneromooo-monero
2018-03-04 13:30:40 +00:00
parent b09e5181cc
commit 504428ab4a
4 changed files with 10 additions and 6 deletions
+3 -1
View File
@@ -5454,8 +5454,10 @@ void wallet2::set_ring_database(const std::string &filename)
m_ring_database = filename;
MINFO("ringdb path set to " << filename);
m_ringdb.reset();
cryptonote::block b;
generate_genesis(b);
if (!m_ring_database.empty())
m_ringdb.reset(new tools::ringdb(m_ring_database));
m_ringdb.reset(new tools::ringdb(m_ring_database, epee::string_tools::pod_to_hex(get_block_hash(b))));
}
bool wallet2::add_rings(const crypto::chacha_key &key, const cryptonote::transaction_prefix &tx)