Commit Graph

9476 Commits

Author SHA1 Message Date
Thomas Winget
4fa1a83f6e Merge pull request #18 from moneromooo-monero/blockchain
Blockchain
2015-01-04 19:39:43 -08:00
warptangent
c5c100c69b Obtain tx hash and tx output index from amount and output offset
Fixes problem of obtaining incorrect outputs used for tx input.

Reverts to earlier intended behavior that was fixed in previous
commit's split of get_output_tx_and_index into two functions.
2015-01-04 19:39:43 -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
ad8200a573 db_lmdb: fix global index calculation off by 1
This finally fixes raw tx being accepted by the daemon.
2015-01-04 19:39:43 -08:00
Thomas Winget
c3fa07b44b update comments to reflect changed code 2015-01-04 19:39:43 -08:00
moneromooo-monero
57b80c541e db_lmdb: remove redundant checks 2015-01-04 19:39:43 -08:00
Thomas Winget
5baf9d9eb3 Merge pull request #17 from moneromooo-monero/blockchain
db_lmdb: catch attempt to remove block from an empty blockchain
db_lmdb: do not give the group database write permissions
2015-01-04 19:39:43 -08:00
moneromooo-monero
1362846dd7 blockchain_converter: add --testnet for converting testnet blockchain 2015-01-04 19:39:43 -08:00
moneromooo-monero
59d2b0ed1c db_lmdb: do not give the group database write permissions 2015-01-04 19:39:43 -08:00
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