Commit Graph
100 Commits
Author SHA1 Message Date
Thomas Winget 155475d971 Add IPv6 support
new cli options (RPC ones also apply to wallet):
  --p2p-bind-ipv6-address (default = "::")
  --p2p-bind-port-ipv6    (default same as ipv4 port for given nettype)
  --rpc-bind-ipv6-address (default = "::1")

  --p2p-use-ipv6          (default false)
  --rpc-use-ipv6          (default false)

  --p2p-require-ipv4      (default true, if ipv4 bind fails and this is
                           true, will not continue even if ipv6 bind
                           successful)
  --rpc-require-ipv4      (default true, description as above)

ipv6 addresses are to be specified as "[xx:xx:xx::xx:xx]:port" except
in the cases of the cli args for bind address.  For those the square
braces can be omitted.
2019-07-31 20:04:57 -04:00
Thomas Winget 0299cb77ca Fix various oversights/bugs in ZMQ RPC server code
- Add some RPC commands (and touch up a couple others)
- some bounds checking
- some better pointer management
- const correctness and error handling

-- Thanks @vtnerd for type help with serialization and CMake changes
2017-09-05 12:20:40 -04:00
Thomas Winget 77986023c3 json serialization for rpc-relevant monero types
Structured {de-,}serialization methods for (many new) types
which are used for requests or responses in the RPC.

New types include RPC requests and responses, and structs which compose
types within those.

# Conflicts:
#	src/cryptonote_core/blockchain.cpp
2017-09-05 12:20:27 -04:00
Thomas Winget 5c1e08fe80 Refactor some things into more composable (smaller) functions
This commit refactors some of the rpc-related functions in the
Blockchain class to be more composable.  This change was made
in order to make implementing the new zmq rpc easier without
trampling on the old rpc.

New functions:
  Blockchain::get_num_mature_outputs
  Blockchain::get_random_outputs
  Blockchain::get_output_key
  Blockchain::get_output_key_mask_unlocked

  Blockchain::find_blockchain_supplement (overload)

functions which previously had this functionality inline now call these
functions as necessary.
2017-09-05 12:17:32 -04:00
Thomas Winget 9ac2ad0744 DRY refactoring 2017-08-31 07:48:27 -04:00
Thomas Winget 78035d2b6c Fix fake 'network synchronized, begin using' messages 2016-08-23 22:52:25 -04:00
Thomas Winget f746c9d01b minor corrections/clarifications 2016-03-30 11:55:54 -04:00
Thomas Winget c6bb201a07 Transaction pool documentation (and some cleanup)
tx_pool.h doxygen documentation completed.
Many notes made on areas for improvement, be that functionality or
code clarity.
Commented code and unused code removed.
2016-03-24 20:03:02 -04:00
Thomas Winget bfd4a28c41 Update BlockchainDB documentation
BlockchainDB is now Doxygen-compliant and its documentation is
up-to-date with recent changes.
2016-03-24 03:40:04 -04:00
Thomas Winget 797357eefb Change Doxyfile, Blockchain not blockchain_storage
Changes the Doxyfile to expand preprocessor macros, but only the ones
defined in the Doxyfile.  This way we can specify that
BLOCKCHAIN_DB == DB_LMDB for the sake of documentation.
2016-03-24 03:40:01 -04:00
Thomas Winget c835215ea9 remove defunct code from cryptonote::core 2016-03-24 03:39:58 -04:00
Thomas Winget 50dba6d301 cryptonote::core doxygen documentation 2016-03-24 03:39:55 -04:00
Thomas Winget 8ac329df02 doxygen documentation for difficulty functions 2016-03-24 03:39:52 -04:00
Thomas Winget 540a76c5c2 Move checkpoint functions into checkpoints class
The functions in src/cryptonote_core/checkpoints_create.{h,cpp} should
be member functions of the checkpoints class, if nothing else for the
sake of keeping their documentation together.

This commit covers moving those functions to be member functions of the
checkpoints class as well as documenting those functions.
2016-03-24 03:39:41 -04:00
Thomas Winget 1b0c98e7e9 doxygen documentation for checkpoints.{h,cpp}
All functions in src/cryptonote_core/checkpoints.h are now documented in
doxygen style.

checkpoints.cpp has been reviewed, one function has been marked for
discussion on correctness.
2016-03-22 20:23:15 -04:00
Thomas Winget 89c24ac2be Remove unnecessary or defunct code 2016-03-22 20:23:06 -04:00
Thomas Winget ab0ed14a41 doxygen include private and static members
This can be easily reverted or removed before this branch is merged, so
I'm going ahead and committing these couple changes.
2016-03-22 17:31:09 -04:00
Thomas Winget 3a484497bc Updated documentation for blockchain.*
All functions are now documented in doxygen format.  Comments have been
updated to reflect the current state of the code.  Many areas for
improvement in clarity and design have been noted, as well as cruft to
be removed.  These changes are not reflected in this commit both to
allow time for comment and to keep commits organized by purpose.
2016-03-22 17:30:21 -04:00
Thomas Wingetandmoneromooo-monero 1642be242d minor bugfixes and refactoring
- Blockchain should store if it's running on testnet or not

- moved loading compiled-in block hashes to its own function for clarity

- on handle_get_objects, should now correctly return false if a block's
transactions are missing

- replace instances of BOOST_FOREACH with C++11 for loops in Blockchain.
2016-02-02 18:58:39 +00:00
Thomas WingetandRiccardo Spagni ea08c768e2 open() flag O_DSYNC isn't on BSD, use O_SYNC
If the detected OS is FreeBSD, tell LMDB to compile with
MDB_DSYNC=O_SYNC instead of the default O_DSYNC, as BSD does not
implement this flag.
2015-07-16 11:22:39 +02:00
Thomas Winget d7df08d6ec properly decrement p2p socket count 2015-06-06 13:24:33 -04:00
Thomas Winget 01076ae700 Check if LMDB needs resize every 1000 blocks
(this was 10 for testing purposes)
2015-05-18 06:18:31 -04:00
Thomas Winget b0d849e0a4 null out batch txn pointer as needed (BlockchainLMDB) 2015-05-18 06:12:54 -04:00
Thomas Winget 7b7ef73c15 LMDB should now dynamically resize the mapsize
Some filesystems (*cough* NTFS *cough*) aren't good with sparse files,
so this makes LMDB dynamically resize its mapsize as needed.  Note: the
check interval is currently every 10 blocks (for testing) and will
probably need to change to 1000 or something.  Default mapsize set to
1GiB.

Blockchain conversion tools using batching will probably segfault, I'll
fix that in the next commit.
2015-05-16 22:05:54 -04:00
Thomas Winget ac79502308 Move mdb_txn_safe implementation to cpp file 2015-05-15 20:42:47 -04:00
Thomas Winget b1d92bcc37 Fixes changes to sort tx by fee per kb 2015-05-13 20:27:06 -04:00
Thomas Winget 385d7c0495 Sort txs by per-kb-fee for miners 2015-04-30 01:02:12 -04:00
Thomas Winget 1b2614ba83 When removing 'stuck' transactions, don't ignore the first tx in the pool 2015-04-30 00:23:00 -04:00
Thomas Winget b18368b635 Allow name@domain.tld for OpenAlias lookups 2015-04-29 21:31:34 -04:00
Thomas Winget 2717883dba DNS Checkpoint updating-related fixes/changes
Only one thread will be doing the updating.

Two valid responses must match, and the first two that match will be
used.
2015-04-22 04:36:39 -04:00
Thomas Winget bed2331904 Require BerkeleyDB to be installed (for now) if building non-static 2015-04-22 01:51:14 -04:00
Thomas Winget 5b01493047 Fixes start_mining in cli interactive mode 2015-04-10 04:08:04 -04:00
Thomas Winget ae08be5394 Disable DNS checkpoint updating on testnet 2015-04-08 18:07:46 -04:00
Thomas Winget a8bc7182ea Merge BlockchainDB into upstream 2015-04-07 17:56:18 -04:00
Thomas Winget 7292dea192 Merges PR #37
New/updated Makefile targets
2015-04-07 16:13:42 -04:00
Thomas Winget 9519526224 Only compile BerkeleyDB as an option in non-static 2015-04-07 15:02:20 -04:00
Thomas Winget c0de96f8bd Fixed DNS resolution bug in Windows
Due to a bug in unbound, we were passing a string containing a null
character to ub_ctx_resolvconf and ub_ctx_hosts rather than a NULL
pointer.  On *nix this wasn't causing headache, but on Windows this was
causing unbound to not correctly load DNS settings from the OS.

Note on the bug: in a Windows-specific code branch in the function
ub_ctx_hosts(), if the hosts file specified was a NULL pointer, a call
to getenv() was stored in a local char* and later freed.  This is
incorrect, as we do not own that data, and caused the program to crash.
2015-04-02 09:22:31 -04:00
Thomas Winget 94cb295db4 Merge upstream into blockchain 2015-03-29 09:58:18 -04:00
Thomas Winget e7391a4113 Merge BerkeleyDB blockchain db implementation 2015-03-29 09:03:30 -04:00
Thomas Winget a0590d29cd Restore daemon interactive mode
Daemon interactive mode is now working again.

RPC mapped calls in daemon and wallet have both had connection_context
removed as an argument as that argument was not being used anywhere.
2015-03-27 08:01:30 -04:00
Thomas Winget 7b14d4a17f Steps toward multiple dbs available -- working
There will need to be some more refactoring for these changes to be
considered complete/correct, but for now it's working.

new daemon cli argument "--db-type", works for LMDB and BerkeleyDB.

A good deal of refactoring is also present in this commit, namely
Blockchain no longer instantiates BlockchainDB, but rather is passed a
pointer to an already-instantiated BlockchainDB on init().
2015-03-25 12:09:44 -04:00
Thomas Winget 874f48bc82 update berkeleydb branch to blockchain branch 2015-03-25 07:30:23 -04:00
Thomas Winget 5c0bc0050c Merge upstream updates into blockchain branch 2015-03-25 05:56:36 -04:00
Thomas Winget a96134113e Merges #36 2015-03-25 05:49:29 -04:00
Thomas Winget e6740ee103 Enforce DNSSEC for checkpoint updates 2015-03-24 06:59:38 -04:00
Thomas Winget dbf46a721a DNSSEC added (hardcoded key)
DNSSEC is now implemented with the hardcoded key from unbound.
This will need to be not hardcoded in the future, but is okay for now.

Unit tests updated for DNSSEC (as well as for the fact that, contrary to
previous assumption, example.com does not have a static IP address).
2015-03-24 06:34:15 -04:00
Thomas Winget 8855a32044 Merge upstream to daemonize changes
Preparation for PR
2015-03-24 02:47:15 -04:00
Thomas Winget 51e3579a80 Fixed bug in static linking boost on MINGW
There was a workaround for linking to boost at all on MINGW, but
unfortunately this workaround would not correctly link to boost
statically.  This workaround for that workaround works around the issue
that that workaround had.
2015-03-22 06:25:53 -04:00
Thomas Winget f78bb00943 Hopefully fixes build on Windows for real this time 2015-03-20 16:56:55 -04:00
Thomas Winget 2b0583b2c6 Hopefully fixes build on Windows 2015-03-20 16:40:54 -04:00
Thomas Winget ead7fad552 BerkeleyDB implementation of BlockchainDB seems to be working! 2015-03-17 22:12:09 -04:00
Thomas Winget 8e3347f310 Pull blockchain changes into berkeleydb branch 2015-03-17 19:52:53 -04:00
Thomas Winget 38c54b79fd Merges PR #35 2015-03-17 19:07:09 -04:00
Thomas Winget bd9da6d5a5 Merges #33
Because of some github fuckery I had to manually cherry-pick/rebase
fluffypony's 32- and 64-bit lmdb changes, hence this isn't actually a
merge commit.
2015-03-17 18:58:09 -04:00
Thomas Winget 6e9e8ab620 Move db_drivers/ to external/
Also change LMDB Cmake variables to CACHE rather than upgrading them
through several parent scopes.
2015-03-17 18:55:24 -04:00
Thomas Winget 11e815761f Revert "Moved db_drivers/ into external/ for consistency"
This reverts commit b21335642e.
2015-03-17 18:03:11 -04:00
Thomas Winget daf2a8f6cb Revert "Build fixed, goofed up some CMake"
This reverts commit 8b82f3c57f.
2015-03-17 18:01:25 -04:00
Thomas Winget e146027acd BlockchainBDB passes unit tests 2015-03-17 17:18:45 -04:00
Thomas Winget 43477b7dac BerkeleyDB Blockchain building, not working yet
Everything except actually *using* BlockchainBDB is wired up, but the db
itself is not yet working.  Some error about user mem not large enough.
I think I know what this error means, but I can't determine the cause.

Notes: BerkeleyDB does not allow 0-indexing in its recno type databases,
  so block numbers *in the database* will be 1-indexed.  Modifications
  to indexing have been made as needed.
2015-03-16 09:14:51 -04:00
Thomas Winget cade0da8f1 CMake wiring, minor cleanup, minor test addition
Make Cmake things aware of BerkeleyDB and BlockchainBDB

Make the BlockchainDB unit tests aware of BlockchainBDB
2015-03-16 04:17:53 -04:00
Thomas Winget 1bc89398b4 BerkeleyDB BlockchainDB impl copy/paste/modify
LMDB implementation code copy/paste/modified into the Berkeley DB
implementation.  Need to test if it builds, then if it works, and so on,
but the code is all there.
2015-03-16 04:17:48 -04:00
Thomas Winget 5112dc37d7 Try to not pollute cryptonote namespace 2015-03-16 04:17:44 -04:00
Thomas Winget edef0bb771 Initial commit of BDB BlockchainDB implementation
Basically verbatim copy of LMDB implementation, but with the guts ripped
out and includes changed, etc.
2015-03-16 04:17:32 -04:00
Thomas Winget eee3ee7073 BlockchainDB implementations have names now
In order to make things more general, BlockchainDB now has get_db_name()
which should return a string with the "name" of that type of db.
This "name" will be the subfolder name that holds that db type's files
within the monero folder.

Small bugfix: blockchain_converter was not correctly appending this in
the prior hard-coded-string implementation of the subfolder data
directory concept.
2015-03-13 21:39:27 -04:00
Thomas Winget 5d2a2b7e69 Fixed includes in BlockchainDB unit tests 2015-03-10 15:17:46 -04:00
Thomas Winget 8b82f3c57f Build fixed, goofed up some CMake
Forgot that CMake vars set to PARENT_SCOPE will still vanish if that
parent scope goes...out of scope.  LMDB vars elevated one more scope to
compensate for moving db_drivers/ into external/
2015-03-10 12:51:23 -04:00
Thomas Winget b21335642e Moved db_drivers/ into external/ for consistency 2015-03-09 15:48:46 -04:00
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
Thomas Winget 9dab105e2e DNS checkpoint loading for testnet should now be correct 2015-03-01 03:36:46 -05:00
Thomas Winget 52f9629bd7 sending commands to forked daemon works on testnet now 2015-03-01 02:35:33 -05:00
Thomas Winget 76289d0e3b Fix tests building -- function signatures changed 2015-03-01 02:21:19 -05:00
Thomas Winget db53e1956a revert stop_daemon method to use correct exit
This was changed because sometimes the daemon does not complete its exit
routine with this method, but as it does correctly wind most things down
even if it gets stuck I've changed it back.
2015-02-24 00:54:50 -05:00
Thomas Winget 96cbecffd7 RPC calls for background daemon added in
The RPC calls the daemon executable uses to talk to the running daemon
instance have mostly been added back in.  Rate limiting has not been
added in upstream, but is on its way in a separate effort, so those
calls are still NOPed out.
2015-02-24 00:44:36 -05:00
Thomas Winget 9193d6fb5b Daemonize changes pulled in -- daemon builds
many RPC functions added by the daemonize changes
(and related changes on the upstream dev branch that were not merged)
were commented out (apart from return).  Other than that, this *should*
work...at any rate, it builds, and that's something.
2015-02-24 00:05:19 -05:00
Thomas Winget 0ad0784f46 Changed log level of debug message -- too spammy 2015-02-23 18:28:20 -05:00
Thomas Winget b5796da0fa Merge #32
Add support to BlockchainDB and BlockchainLMDB for batch transactions.

Add profiling to block and tx processing and DB operations.

Improve block and tx processing efficiency by less repeat hashing.

Move LMDB storage to "lmdb" subfolder.
 - Upon startup, if old LMDB files are detected, abort with a message for the user to move them to subfolder or delete them.

Update and fix log statements and formatting.
2015-02-23 18:24:59 -05:00
Thomas Winget b7d112f601 Merge pull request #31 from warptangent/fix/fix_get_tail_id
Fix Blockchain::get_tail_id() to set parameter to last block number instead of height
2015-02-22 18:06:44 -05:00
Thomas Winget 6f1c4b4c2c Bounds error, should fix #27 2015-02-20 21:09:32 -05:00
Thomas Winget fc62af5cf8 Merge remote-tracking branch 'monero-project/master' into blockchain 2015-02-05 08:51:19 -05:00
Thomas Winget d1f40506fa Merge PR #26
Usage:

default is lmdb for blockchain branch:
$ make release

same as:
$ DATABASE=lmdb make release

for original in-memory implementation:
$ DATABASE=memory make release

COMMITS:

  - Add compile-time support for both db implementations: in-memory and LMDB

NOTE:
  The default should be changed to lmdb when this is merged upstream
  unless we're 100% sure the LMDB implementation is ready.
2015-02-03 05:18:12 -05:00
Thomas Winget a4f5344024 Merge PR 25 into blockchain 2015-02-02 01:25:57 -05:00
Thomas Winget eeb0634f60 Merge remote-tracking branch 'origin/pr/24' into blockchain 2015-02-01 06:05:16 -05:00
Thomas Winget 9d52378029 Merge to keep up with upstream
Merge 'monero-project/master' with blockchain
2015-01-21 11:26:53 -05:00
Thomas Winget acd4c369e4 Should fix std::min issues related to size_t 2015-01-19 17:39:38 -05:00
Thomas Winget 34883599bc Add in-source lmdb to build process
Working on Linux, needs verified for other platforms but should be fine.
2015-01-18 18:30:31 -05:00
Thomas Winget 4e45fae9c3 Initial import of lmdb source 2015-01-18 16:18:15 -05:00
Thomas Winget 5149286c0b Merge #216
Fix seed node threaded DNS lookup
2015-01-14 20:39:57 -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