Commit graph

817 commits

Author SHA1 Message Date
moneromooo-monero
4c2a45288a db_lmdb: catch attempt to remove block from an empty blockchain
It would probably have thrown when not finding a block at
height 2^64-1, but better make things clear.
2015-01-04 19:39:43 -08:00
Thomas Winget
eaaaada797 Merge pull request #16 from moneromooo-monero/blockchain
db_lmdb: factor all the log+throw code paths
2015-01-04 19:39:42 -08:00
Thomas Winget
81c28c211c Merge pull request #15 from moneromooo-monero/blockchain
many const-correctness changes and code quality enhancements.  minor bugfix on block removal.
2015-01-04 19:39:42 -08:00
moneromooo-monero
3a3459d59b db_lmdb: factor all the log+throw code paths 2015-01-04 19:39:42 -08:00
Thomas Winget
53ce3c95d9 Merge pull request #14 from moneromooo-monero/blockchain
Blockchain

lots of const-correctness and more proper code, bug fix with syncing.
2015-01-04 19:39:42 -08:00
moneromooo-monero
3fcb8daf6e db_lmdb: factor the MDB_val setup code
It makes the code simpler, avoids possible copy/paste errors
(wrong sizeof, etc), and generally unclutters the calling code.
2015-01-04 19:39:42 -08:00
moneromooo-monero
198368b2e1 blockchain: fix wallet syncing from scratch
When the wallet syncs from the first block, it is fine to start
at the genesis block.
2015-01-04 19:39:42 -08:00
moneromooo-monero
609cf7fc92 blockchain_converter: a bit more user friendly output 2015-01-04 19:39:42 -08:00
moneromooo-monero
2b9f737872 blockchain_converter: only call data path function once 2015-01-04 19:39:42 -08:00
moneromooo-monero
1860658eec blockchain: do not append "testnet" to the data directory
It is already there (unless overridden via command line).
2015-01-04 19:39:42 -08:00
moneromooo-monero
1c578ad3f8 db_lmdb: remove block timestamp too when removing a block 2015-01-04 19:39:42 -08:00
moneromooo-monero
c93a186637 db_lmdb: do not cast const away 2015-01-04 19:39:42 -08:00
Thomas Winget
e285ee5aec Merge pull request #13 from moneromooo-monero/blockchain
Add lmdb to the cmake gunk, and use actual user directory for the blockchain location
2015-01-04 19:39:41 -08:00
moneromooo-monero
1d23db220a db_lmdb: do not keep a dangling pointer to stack objects 2015-01-04 19:39:41 -08:00
moneromooo-monero
29b5876ad1 db_lmdb: make cursor internal members private 2015-01-04 19:39:41 -08:00
moneromooo-monero
a3157d7b69 blockchain_storage: refactor genesis block creation
The existing assert is kept as it is stricter than the function's
internal assert.
2015-01-04 19:39:41 -08:00
moneromooo-monero
8e41b1e735 blockchain_storage: add consts where appropriate 2015-01-04 19:39:41 -08:00
moneromooo-monero
98bdadcad7 blockchain_converter: delete blockchain on succesful exit
While the dtor implementation does not actually do anything, other
paths do delete it, and the dtor might do someting later.
2015-01-04 19:39:41 -08:00
moneromooo-monero
256162fcd5 checkpoints: add consts where appropriate 2015-01-04 19:39:41 -08:00
moneromooo-monero
b7270ab60e blockchain: add consts where appropriate 2015-01-04 19:39:41 -08:00
moneromooo-monero
23f3cb4c0e blockchain_db: add consts where appropriate 2015-01-04 19:39:41 -08:00
moneromooo-monero
10fd6cab6c blockchain_db: factor some exception code
Ideally, the log would go in the exception's ctor, but
two log levels are used, so I'd need to specify the level
in the ctor, which isn't great as it's not really related
to the exception.
2015-01-04 19:39:41 -08:00
Thomas Winget
215e63b79f extraneous semicolon in Blockchain::complete_timestamps_vector
credit here:
https://bitcointalk.org/index.php?topic=583449.msg9562845#msg9562845
2015-01-04 19:39:40 -08:00
moneromooo-monero
11129b9ee4 blockchain_converter: use the actual blockchain location 2015-01-04 19:39:40 -08:00
Thomas Winget
8e1b7e2ad4 raised maximum mapsize for lmdb to ~16GB 2015-01-04 19:39:40 -08:00
moneromooo-monero
0886183568 build: add liblmdb to the cmake autodetection system
update for rebase (warptangent 2015-01-04)
  src/cryptonote_core/CMakeLists.txt (edit)
  - replace LMDB_LIBRARIES with LMDB_LIBRARY set from autodetection
2015-01-04 19:39:40 -08:00
Thomas Winget
6c8b8acfe4 more blockchain height-related fixes, syncing other nodes code this time 2015-01-04 19:39:40 -08:00
Thomas Winget
9455e0cd58 ~ didn't work, need hard path. debug print. 2015-01-04 19:39:40 -08:00
Thomas Winget
4af0918501
very, VERY primitive blockchain converter
hard-coded config folder, hard-coded BlockchainDB subclass.

Needs finessing, but should be testable this way.

update for rebase (warptangent 2015-01-04)
  fix conflicts with upstream CMakeLists.txt files

  src/CMakeLists.txt (edit original commit)
  src/blockchain_converter/CMakeLists.txt (add)
2015-01-04 19:38:56 -08:00
Thomas Winget
26a7db38eb add new checkpointing behavior to Blockchain class 2015-01-04 19:31:20 -08:00
Thomas Winget
767aac274b Remove unused dependency 2015-01-04 19:31:20 -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
71b18d7166 moar bug fixes, removed debug prints 2015-01-04 19:31:19 -08:00
Thomas Winget
0915913111 BlockchainLMDB seems to be working*!
* - Well, mostly.  Haven't let it sync too far just yet.  Currently
trying to figure out the best way to deal with LMDB/mmap virtual memory
pages.
2015-01-04 19:31:19 -08:00
Thomas Winget
1a546e3222 some bug fixes, but still needs work
There are quite a few debug prints in this commit that will need removed
later, but for posterity (in case someone wants to debug this while I'm
away), I left them in.

Currently errors when syncing on the first block that has a "real"
transaction.  Seems to not be able to validate the ring signature, but I
can't for the life of me figure out what's going wrong.
2015-01-04 19:31:19 -08:00
Thomas Winget
006afe2172 Minor bug fixes and debug prints
Blockchain and BlockchainLMDB classes now have a debug print at the
beginning of each function at log level 2.  These can be removed at any
time, but for now are quite useful.

Blockchain runs, and adds the genesis block just fine, but for some
reason isn't getting new blocks.
2015-01-04 19:31:19 -08:00
Thomas Winget
90f402e258 minor fixes to Blockchain.cpp 2015-01-04 19:31:19 -08:00
Thomas Winget
74a1a89e27
Integrate BlockchainDB into cryptonote_core
Probably needs more looking at -- lot of things were done...in a rushed
sort of way.  That said, it all builds and *should* be at least
testable.

update for rebase (warptangent 2015-01-04)
  fix conflicts with upstream CMakeLists.txt files

  src/CMakeLists.txt (remove edits from original commit)
  tests/CMakeLists.txt (remove edits from original commit)
  src/cryptonote_core/CMakeLists.txt (edit)
  - use blockchain db .cpp and .h files
  - add LMDB_LIBRARIES
2015-01-04 19:29:51 -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
e47e343a1c LMDB blockchain: remove outputs and spent keys 2015-01-04 19:01:10 -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
1240cf805b
BlockchainDB unit tests, lmdb linker flag
Some BlockchainDB unit testing fleshed out (and working), rudimentary
linker flag for lmdb in CMakeLists, but should probably be done
"correctly" at some point (find it on whatever system you're building on
and all that jazz).

update for rebase (warptangent 2015-01-04)
  fix conflicts with upstream CMakeLists.txt files

  tests/CMakeLists.txt (remove edits from original commit)
2015-01-04 19:00:31 -08:00
Thomas Winget
b98b96489f Initial commit of lmdb BlockchainDB impl 2015-01-04 18:41:44 -08:00
Thomas Winget
bc44bc19f4 Initial commit of BlockchainDB tests, other misc
miscellaneous changes to BlockchainDB/blockchain as well, namely
replacing instances of std::list with std::vector
2015-01-04 18:41:44 -08:00
Thomas Winget
90d6f8bf62 Adding libglim as an external library
libglim is an Apache-licensed C++ wrapper for lmdb, and rather than
rolling our own it seems prudent to use it.

Note: lmdb is not included in it, and unless something happens as did
with libunbound, should be installed via each OS' package manager or
equivalent.
2015-01-04 18:41:44 -08:00
Thomas Winget
07733f98c0 update new blockchain to build with new changes
Still need to add in the new checkpointing functionality, as well as
touch up a few things, but is okay for now.
2015-01-04 18:41:44 -08:00
Thomas Winget
1ffbeb2d2e stupid past me, fixing typos and shit... 2015-01-04 18:41:44 -08:00
Thomas Winget
67515b8b19 missing typedef 2015-01-04 18:41:43 -08:00