Commit graph

13 commits

Author SHA1 Message Date
Thomas Winget 5eab480cb1
Moved BlockchainDB into its own src/ subfolder
Ostensibly janitorial work, but should be more relevant later down the
line.  Things that depend on core cryptonote things (i.e.
    cryptonote_core) don't necessarily depend on BlockchainDB and thus
have no need to have BlockchainDB baked in with them.
2015-03-06 15:20:45 -05:00
warptangent 58ecc58be1
BlockchainLMDB: Add support for batch transactions 2015-02-23 00:33:37 -08:00
warptangent 8909d7d82e
Improve block and tx processing efficiency by less repeat hashing
BlockchainLMDB::add_block()
  BlockchainLMDB::add_transaction_data()

  BlockchainDB::add_transaction()
2015-02-23 00:33:37 -08:00
warptangent 4d0a94b20c
Complete implementation of transaction removal
Complete method BlockchainLMDB::remove_output()
  - use output index as the key for:
    m_output_indices, m_output_txs, m_output_keys
  - call new method BlockchainLMDB::remove_amount_output_index()

Add method to remove amount output index.
  - BlockchainLMDB::remove_amount_output_index()
  - for m_output_amounts

This also fixes the segfault when blockchain reorganization is
attempted.
2015-01-11 21:22:09 -08:00
warptangent d045dfa7ce
Fix transfers (without mixins)
Fix Blockchain::get_tx_outputs_gindexs() to return amount output
indices.

Implement BlockchainLMDB::get_tx_amount_output_indices() and call it
from the function instead of BlockchainLMDB::get_tx_output_indices()

Previously, Blockchain::get_tx_outputs_gindexs() was instead returning
global output indices, which are internal to LMDB databases.

Allows bitmonerod RPC /get_o_indexes.bin to return the amount output
indices as expected.

Allows simplewallet refresh to set correct amount output indices for
incoming transfers. simplewallet can now construct and send valid
transactions (currently only without mixins).

This is a fix that doesn't require altering the structure of the
current LMDB databases.

TODO:

This can be done more efficiently by adding another LMDB database
(key-value table).

It's not used during regular transaction validation by bitmonerod. I
think it's currently used only or mainly by simplewallet for just its
own incoming transactions. So the current behavior is not a primary
bottleneck.

Currently, it's using the "output_amounts" database, walking through a
given amount's list of values, comparing each one to a given global
output index. The iteration number of the match is the desired result:
the amount output index. This is done for each global output index of
the transaction.

A tx's amount output indices can be stored in various other ways
allowing for faster lookup. Since a tx is only written once, there are
no special future write requirements for its list of indices.
2015-01-09 16:34:12 -08:00
Thomas Winget c50cd95674 Fixes a bug with getting output metadata from BlockchainDB
Thanks to moneromooo-monero for spotting the bug.
2015-01-04 19:39:43 -08:00
moneromooo-monero 23f3cb4c0e blockchain_db: add consts where appropriate 2015-01-04 19:39:41 -08:00
Thomas Winget 006e106ae9 Store output pubkeys separately, bug fixes 2015-01-04 19:31:20 -08:00
Thomas Winget ab7951d99a Minor bugfixes, redundancy removal
Minor bugfixes in block removal

Storing outputs outside their transactions is largely unnecessary, and
thus has been removed.
2015-01-04 19:31:20 -08:00
Thomas Winget d8c570b588 All LMDB BlockchainDB implemented, not tested
All of the functionality for the LMDB implementation of BlockchainDB is
implemented, but only what is in tests/unit_tests/BlockchainDB.cpp has
been tested.  This is basically add a block, see if you can get the
block and a tx from the block.  More tests should be added at some
point.
2015-01-04 19:01:11 -08:00
Thomas Winget a0af217d9a Adding block data to LMDB BlockchainDB coded
Still needs testing (and need to write a few more unit tests), but
everything should be there.  Lots of unfortunate duplication,
but...well, I can't see a way around it using LMDB.

A couple of other minor changes in this commit, only slightly relevant.
2015-01-04 19:01:10 -08:00
Thomas Winget db00ce0173 Parts of LMDB impl of BlockchainDB done and working
The rest should just be tedious copypasta and modification.
2015-01-04 19:01:10 -08:00
Thomas Winget b98b96489f Initial commit of lmdb BlockchainDB impl 2015-01-04 18:41:44 -08:00