Commit Graph
100 Commits
Author SHA1 Message Date
Thomas Winget 4e45fae9c3 Initial import of lmdb source 2015-01-18 16:18:15 -05:00
Thomas Winget 40e0b70075 Merge #22
Remove code previously made unused and marked unused
2015-01-14 17:41:46 -05:00
Thomas Winget d43782f041 Merge pull request #21 from warptangent/fix_block_reorg
Fixes and additions for block reorganization
2015-01-12 14:24:18 -05:00
Thomas Winget 030eab7a49 Merge pull request #20 from warptangent/fix_transfers
Fix transfers

Output indexing was being handled improperly.  These changes fix that.  Wallets (re-)created using this branch will need to be (re-)re-created in order to get correct output indices.
2015-01-09 20:04:47 -05:00
Thomas Winget 429a740562 throw inline functions need to keep exception type
As it is useful for functions calling BlockchainDB functions to know
whether an exception is expected (attempting to get a block that doesn't
    exist and counting it missing if not, to save time checking if it
    does, for example), the inline functions throw{0,1} need to keep the
exception type information.

Slight comment update due to copy/paste failure.
2015-01-09 07:29:05 -05:00
Thomas Winget 14555eefd5 Fixes segfault in Blockchain::handle_alternative_block
This commit should fix the segfault in
Blockchain::handle_alternative_block, and also updates a few comments
that were either incorrect or incomplete.
2015-01-09 05:56:51 -05:00
Thomas Winget 5086ca1db5 add BlockchainDB tests to new cmake 2015-01-07 00:48:45 -05:00
Thomas Wingetandwarptangent 7374b81b23 Merge pull request #19 from warptangent/fix_tx_output
Obtain tx hash and tx output index from amount and output offset
2015-01-04 19:39:44 -08:00
Thomas Wingetandwarptangent 4fa1a83f6e Merge pull request #18 from moneromooo-monero/blockchain
Blockchain
2015-01-04 19:39:43 -08:00
Thomas Wingetandwarptangent 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
Thomas Wingetandwarptangent c3fa07b44b update comments to reflect changed code 2015-01-04 19:39:43 -08:00
Thomas Wingetandwarptangent 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
Thomas Wingetandwarptangent 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 Wingetandwarptangent 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
Thomas Wingetandwarptangent 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
Thomas Wingetandwarptangent 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
Thomas Wingetandwarptangent 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
Thomas Wingetandwarptangent 8e1b7e2ad4 raised maximum mapsize for lmdb to ~16GB 2015-01-04 19:39:40 -08:00
Thomas Wingetandwarptangent 6c8b8acfe4 more blockchain height-related fixes, syncing other nodes code this time 2015-01-04 19:39:40 -08:00
Thomas Wingetandwarptangent 9455e0cd58 ~ didn't work, need hard path. debug print. 2015-01-04 19:39:40 -08:00
Thomas Wingetandwarptangent 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 Wingetandwarptangent 26a7db38eb add new checkpointing behavior to Blockchain class 2015-01-04 19:31:20 -08:00
Thomas Wingetandwarptangent 767aac274b Remove unused dependency 2015-01-04 19:31:20 -08:00
Thomas Wingetandwarptangent 006e106ae9 Store output pubkeys separately, bug fixes 2015-01-04 19:31:20 -08:00
Thomas Wingetandwarptangent 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 Wingetandwarptangent 71b18d7166 moar bug fixes, removed debug prints 2015-01-04 19:31:19 -08:00
Thomas Wingetandwarptangent 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 Wingetandwarptangent 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 Wingetandwarptangent 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 Wingetandwarptangent 90f402e258 minor fixes to Blockchain.cpp 2015-01-04 19:31:19 -08:00
Thomas Wingetandwarptangent 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 Wingetandwarptangent 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 Wingetandwarptangent e47e343a1c LMDB blockchain: remove outputs and spent keys 2015-01-04 19:01:10 -08:00
Thomas Wingetandwarptangent 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 Wingetandwarptangent 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 Wingetandwarptangent 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 Wingetandwarptangent b98b96489f Initial commit of lmdb BlockchainDB impl 2015-01-04 18:41:44 -08:00
Thomas Wingetandwarptangent 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 Wingetandwarptangent 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 Wingetandwarptangent 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 Wingetandwarptangent 1ffbeb2d2e stupid past me, fixing typos and shit... 2015-01-04 18:41:44 -08:00
Thomas Wingetandwarptangent 67515b8b19 missing typedef 2015-01-04 18:41:43 -08:00
Thomas Wingetandwarptangent aba548cbf7 import of BlockchainDB files
tried rebasing, tree-filter, and many other things.  at this point,
the history of these files previous to this can live on
in my bc2 branch, as I'm importing them as-is to here.
2015-01-04 18:41:43 -08:00
Thomas WingetandRiccardo Spagni d2287d3108 per kb fees not passing correct fee to transfer() 2014-11-06 22:09:23 -07:00
Thomas WingetandRiccardo Spagni dc67b12ea9 Should now properly do per-kb fee
I'm an idiot.
2014-11-06 22:09:14 -07:00
Thomas WingetandRiccardo Spagni 557e27fd21 per kb fees 2014-11-06 22:09:07 -07:00
Thomas Winget aeaa44fe86 fixed signed-unsigned issue from 166
Loss of entropy can be discussed at a later time, but is
not deemed a significant issue for now.
2014-10-02 19:12:12 -04:00
Thomas Winget c0bdd511c3 Daemon should now exit on conflicting checkpoints
If the "enforce DNS checkpoints" flag is not enabled, it should not exit
if DNS checkpoints conflict with the others, but should still print a
warning to the user.
2014-09-30 16:21:37 -04:00
Thomas Winget f0b4138f1f various changes to runtime checkpoint updating
json checkpoints will be checked every 10 minutes, dns every 60.

json checkpoints always enforced, dns still with flag.

conflicting checkpoints is hard fail, but soft if dns enforce flag not
set and dns checkpoints are wonky.
2014-09-30 16:21:37 -04:00
Thomas Winget 7568f89c55 Fixed segfault with checkpoints loading
Bounds checking on blockchain_storage' m_blocks.size() when validating
against checkpoints.  Also moved initial json & DNS checkpoints load to
after blockchain init.
2014-09-30 16:21:37 -04:00
Thomas Winget b261d9207b DNS checkpoint updating added, and daemon flag to enforce them
The daemon should now check for updated checkpoints from
checkpoints.moneropulse.org as well as from the configured json file
every ~1hr (and on launch).

The daemon now has a flag to enable enforcing these checkpoints (rather
    than just printing a warning when they fail).

TODO: an easily configurable list of DNS servers to check for
checkpoints as opposed to the hard-coded "checkpoints.moneropulse.org"
2014-09-30 16:21:37 -04:00
Thomas Winget 30caebfce3 reload checkpoints file every ~hr and print if any fail
also some other minor bug squashing and code formatting
2014-09-30 16:21:37 -04:00
Thomas Winget 0e1449135d updated DNSResolver/things that use it for DNSSEC
Note: DNSResolver does not yet *use* DNSSEC, but rather this commit is
preparation for including DNSSEC validation.  The function in
src/wallet/wallet2.cpp that uses DNSResolver still needs its parameters
updated accordingly.
2014-09-30 16:21:37 -04:00
Thomas Winget 6f2c2e1c27 Adding an identical existing checkpoint should not error
For checkpoints being read at runtime to work correctly, the checkpoint
add code needs to not return false if a checkpoint is added that already
exists.  In this case, instead return false if the checkpoint is for a
height that already has a checkpoint and the hashes are different.
2014-09-30 16:17:26 -04:00
Thomas Winget 145dc19eeb Merge pull request #160 from tewinget/remove_ldns_dep
Remove ldns dependency
2014-09-24 23:50:51 -04:00
Thomas Winget fab95aef64 Remove LDNS dep and fix a bug in libunbound const correctness fix 2014-09-24 23:45:01 -04:00
Thomas Winget 2248124453 Removed ldns dependency
ldns dependency was only still around for constants defined in ldns/rr.h,
but those constants are RFC specified DNS constants, and to reduce deps
have been replicated in dns_utils.h instead of including ldns/rr.h.
2014-09-24 22:45:17 -04:00
Thomas Winget 738357459b libunbound has const correctness issues... 2014-09-24 20:05:34 -04:00
Thomas WingetandRiccardo Spagni 1e193d687d temp commit 2014-09-24 09:13:18 +02:00
Thomas WingetandRiccardo Spagni 1dece111cc Added function to check syntax of URL for DNS lookup
For now, simply checks for '.' character, but that will be easy to
change in the future if necessary/desired.
2014-09-23 22:59:57 +02:00
Thomas WingetandRiccardo Spagni 24f325a33d Fixed artifacts from cherry-picking devel->master 2014-09-23 22:59:47 +02:00
Thomas WingetandRiccardo Spagni 5bd343778f Fixed CMake search for libunbound
As it turns out, some of CMake's built-in modules for detecting headers
and libraries don't work if you have certain compiler flags set, such as
-Werror=old-style-definition, as they do "int main()" rather than
"int main(void)".  Having CMake search for libs before compiler flags
are set alleviates this issue, and I believe the underlying issue will
be fixed in future releases of CMake.
2014-09-23 22:58:31 +02:00
Thomas WingetandRiccardo Spagni c14c7e1683 change to allow (at least a bit) for multiple TXT records 2014-09-23 22:58:28 +02:00
Thomas WingetandRiccardo Spagni f437cb58bf Simplewallet should now resolve urls to addresses
Simplewallet should now do a DNS query on an address if it fails to
convert the given string to a binary representation of an address
(base58->binary).  It will prompt the user, telling of what the "url"
passed was, what monero address it translated to, and whether or not
DNSSEC validation was a success, and ask for a confirmation that these
are all acceptable.
2014-09-23 22:58:25 +02:00
Thomas WingetandRiccardo Spagni a5757a628f Monero addres from DNS TXT record implemented, tests pass
Still need to deal with DNSSEC and optional fields in the TXT record.
2014-09-23 22:58:21 +02:00
Thomas WingetandRiccardo Spagni 3fb0fc020f seed node DNS code updated to use DNSResolver
Also implemented rudimentary IPv6 support, but commented it out because
it's not widely supported by ISPs for now, and thus is not currently
supported by Monero.
2014-09-23 22:58:17 +02:00
Thomas WingetandRiccardo Spagni 9a3b18dbc2 Use the loop iterator, previous version of me. 2014-09-23 22:58:13 +02:00
Thomas WingetandRiccardo Spagni 578050e91d ipv4 and ipv6 resolution working
IPv4 and IPv6 name resolution working.
Unit tests written (and passing).
net_node.{h,inl} code modified to use DNS seeds.
2014-09-23 22:58:07 +02:00
Thomas WingetandRiccardo Spagni dea98df6b1 Updated CMake files -- added libunbound linker flag
CMake config file written, but was unable to test/get it working
properly because of a bug in CMake with functions related to
find_package.  Simple "-lunbound" flag used in its stead for now.  May
not build on non-Linux systems, not sure yet.
2014-09-23 22:58:02 +02:00
Thomas WingetandRiccardo Spagni 1ae6db25e6 Initial commit of DNS code 2014-09-23 22:57:57 +02:00
Thomas Wingetandfluffypony c05489938f override for get_block_longhash for block 202612 2014-09-06 21:56:18 +02:00
Thomas Wingetandfluffypony 9a16bb9936 added double-check for 202612 block id
if a new block has the same block id as 202612 but the wrong blobdata,
this will tell the caller that the block id is actually null_hash rather
than the 202612 block id.
2014-09-06 21:56:12 +02:00
Thomas Wingetandfluffypony 115f9523fa hex_to_pod needs the destination as an arg, as opposed to it returning the pod 2014-09-06 21:56:06 +02:00
Thomas Wingetandfluffypony a544603a7b Override for block hashing for block 202612
Since we need to fix tree_hash, but doing so would invalidate the block
id for block 202612, this fix should check to see if we're trying to get
the block id for 202612 (if its blob hash matches) and return the "old"
block id, for backwards compatibility.
2014-09-06 21:54:58 +02:00
Thomas Winget 7c0f150a29 Merge pull request #81 from tewinget/restore-fix
restored wallets will have timestamp set to June 8 2014.
2014-08-03 09:58:11 -04:00
Thomas Winget bdac624899 restored wallets will have timestamp set to June 8 2014. 2014-08-03 09:49:31 -04:00
Thomas Winget 55b92e3999 Merge pull request #68 from tewinget/daemon_rpc
daemon rpc get_connections call minor changes
2014-07-23 06:06:33 -04:00
Thomas Winget a99143444c Changed time_t to uint64_t for serialization
time_t is implementation-, architecture-, and apparently
compiler-dependent.  As an example, on my machine if I build a 64-bit
binary, sizeof(time_t) is 8, but for a 32-bit binary it's 4.  uint64_t
is therefore much more consistent for serialization, given that RPC
calls are potentially made between different machines.
2014-07-23 05:59:31 -04:00
Thomas Winget ad4061002c Missed serializing a get_connections RPC response parameter 2014-07-22 20:54:45 -04:00
Thomas Winget 1c33b6cbee Merge pull request #65 from tewinget/daemon_rpc
Added get_connections RPC call to daemon

Only consists of new functionality and doesn't break build, merging per request.
2014-07-18 19:35:45 -04:00
Thomas Winget 9f88b7ce6b Added get_connections RPC call to daemon 2014-07-18 19:33:03 -04:00
Thomas Winget c6ffd810af Merge pull request #56 from tewinget/master
transaction splitting
2014-07-06 13:13:06 -04:00
Thomas Winget 45bd182363 needed to remove REQUIRED from find_package(Threads) 2014-06-30 07:23:49 -04:00
Thomas Winget d433a696e5 wallet RPC converted to use new transaction semantics
wallet RPC now uses wallet2::create_transactions and wallet2::commit_tx instead
of wallet2::transfer.  This made it possible to add the RPC call /transfer_split, which
will split transactions automatically if they are too large.  The old call to
/transfer will return an error stating to use /transfer_split if multiple
transactions are needed to fulfill the request.
2014-06-30 07:16:50 -04:00
Thomas Winget 2011b50280 removed erroneous printing of newlines 2014-06-30 07:16:50 -04:00
Thomas Winget 7c7696a830 missed removing a debug print 2014-06-30 07:16:50 -04:00
Thomas Winget e5ab98a6f4 removed some debugging code (really stupid printf-style debuggng.. 2014-06-30 07:16:50 -04:00
tom 62109840d6 Transaction splitting *seems* to be working!!! 2014-06-30 07:16:50 -04:00
Thomas Winget 9bfe0b9b6c Added confirmation prompt if transactions are to be split 2014-06-30 07:16:50 -04:00
Thomas Winget 002ce963bf added back successful tx message. oops. 2014-06-30 07:16:50 -04:00
Thomas Winget 8166650ae0 up tx splits limit 5 -> 30 2014-06-30 07:16:50 -04:00
Thomas Winget 2e048a4679 final changes to get transaction splitting building. needs testing. 2014-06-30 07:16:50 -04:00
tom 79e59d155b working on dividing functions in prep for tx splitting 2014-06-30 07:16:50 -04:00
Thomas Winget fc1180bc6c Added comments to wallet functions 2014-06-30 07:16:50 -04:00
Thomas Winget 4c67dbb08e Merge pull request #55 from monero-project/revert-54-master
Revert "Do not fall over when refreshing balance fails"
2014-06-30 06:47:48 -04:00
Thomas Winget 55721da1fd Revert "Do not fall over when refreshing balance fails" 2014-06-30 06:45:20 -04:00
Thomas Winget a521046ff2 Fixed console handler not properly exiting on SIGINT and such 2014-06-13 00:09:09 -04:00
Thomas Winget c49cb04610 changed wallet mnemonic to use cout so it doesn't print to log 2014-06-12 19:39:02 -04:00
tom 205494f0d1 change hash for keygen from blake to keccak 2014-06-12 19:38:56 -04:00
tom 0c85229924 changed text a bit more 2014-06-12 19:38:29 -04:00