Commit Graph

364 Commits

Author SHA1 Message Date
moneromooo-monero c6e200a8ab
core: add --db-salvage command line flag
Use to load the database when the primary meta page is corrupted
2017-08-12 19:04:44 +01:00
moneromooo-monero a1891ebea9
tests: fix tests build
Add get_fork_version and add_ideal_fork_version to core so
cryptonote_protocol does not have to need the Blockchain
class directly, as it's not in its dependencies, and add
those to the fake core classes in tests too.
2017-08-10 11:12:56 +01:00
Riccardo Spagni 62610a3a53
Merge pull request #2225
5d91b26c blockchain: skip checking tx semantics in embedded block hash range (moneromooo-monero)
2017-08-07 22:10:09 +02:00
moneromooo-monero 38756d00ff
core: new API to disable DNS checkpoint lookups 2017-08-07 14:31:06 +01:00
Riccardo Spagni 6db8a60a18
Merge pull request #2149
158c3ecf core: thread most of handle_incoming_tx (moneromooo-monero)
f57ee382 cryptonote_protocol: retry stale spans early (moneromooo-monero)
90df52e1 cryptonote_protocol: light cleanup (moneromooo-monero)
84e23156 cryptonote_protocol: avoid spurious SYNCHRONIZED OK messages (moneromooo-monero)
5be43fcd cryptonote_protocol_handler: sync speedup (moneromooo-monero)
2017-08-07 15:24:58 +02:00
Riccardo Spagni 9b3b7f050b
Merge pull request #2230
5dd722be core: add a message when loading checkpoints at init time (moneromooo-monero)
2017-08-07 15:12:42 +02:00
moneromooo-monero 158c3ecff3
core: thread most of handle_incoming_tx 2017-08-07 09:33:20 +01:00
moneromooo-monero 5dd722beaa
core: add a message when loading checkpoints at init time
This uses DNS, which can take a while, so it's useful to know
this is the culprit when loading pauses
2017-07-31 06:43:13 +01:00
moneromooo-monero 5d91b26c0f
blockchain: skip checking tx semantics in embedded block hash range
If the txes are bad, this'll be picked up by the block hash mismatch
since the tx merkle root is part of the block hash.
2017-07-30 09:48:00 +01:00
moneromooo-monero a5031a7d02
core: forbid duplicate ring members from v6
This avoids someone adding what amounts to mixin 0 rings in
practice, as there is no other good reason to allow this.
2017-07-22 12:33:12 +01:00
moneromooo-monero 0722aea3df
cryptonote_core: initialize checkpoint flag 2017-07-02 18:45:25 +01:00
Riccardo Spagni 3d397325bf
Merge pull request #2063
d17c0fc2 Don't copy blockchain for coinbase_tx_sum (Howard Chu)
2017-06-01 19:33:43 +02:00
Howard Chu 5414970dcd
Speedup print_pool_stats
Since we're just counting txs, there's no reason to deserialize all the blobs.
2017-06-01 17:34:03 +01:00
Howard Chu d17c0fc2d0
Don't copy blockchain for coinbase_tx_sum
Changed Blockchain::for_all_blocks() to for_blocks_range()
Operate on blockchain in-place instead of building a copy first.
2017-06-01 14:14:24 +01:00
Riccardo Spagni 907ce14b18
Merge pull request #2026
a5739201 Update sync time copy (xmr-eric)
2017-05-30 21:20:39 +02:00
Riccardo Spagni 545e2b003c
Merge pull request #1982
b52abd13 Move txpool to the database (moneromooo-monero)
2017-05-30 21:12:44 +02:00
moneromooo-monero b52abd1370
Move txpool to the database
Integration could go further (ie, return_tx_to_pool calls should
not be needed anymore, possibly other things).

poolstate.bin is now obsolete.
2017-05-25 22:23:37 +01:00
xmr-eric a57392016b Update sync time copy 2017-05-10 14:34:18 -04:00
assylias bff90264b8
Add expected total reward to RPC "getblocktemplate".
Only works from V5 fork onward - returns 0 before that block.
2017-04-19 18:28:16 +01:00
moneromooo-monero 558cfc31ca
core, wallet: faster tx pool scanning
Includes a new RPC to get tx pool hashes fast.
2017-03-23 09:25:22 +00:00
moneromooo-monero a6f1d8fc4c
core: call {prepare|cleanup}_handle_incoming_blocks when adding a mined block
This ensures that a batch can't also be started/stopped out of
sync by another thread and us getting in the middle
2017-03-19 12:40:26 +00:00
moneromooo-monero 74b216a17f
core: don't try to re-relay an empty set of pool transactions 2017-03-12 14:57:58 +00:00
moneromooo-monero 02097c87eb
core: print the "new update found" message in cyan, for visibility 2017-03-05 16:59:36 +00:00
moneromooo-monero f6211322e5
core: make update download cancellable 2017-03-05 16:59:25 +00:00
moneromooo-monero 9effa55311
core: bound the amount of entries in bad tx semantics cache
This is to prevent unbounded memory use. Since I don't think there
is a container that has quick insert, quick lookup, and automatic
FIFO, I use two and swap every N, clearing the oldest one.
2017-02-23 20:34:11 +00:00
moneromooo-monero 5901331669
updates: remove testnet case
It need not be any different
2017-02-22 11:20:44 +00:00
moneromooo-monero 822577eb42
updates: we now have a user URL, and an automatic one
So the user can use https, while the automatic does not have to
2017-02-22 11:20:40 +00:00
moneromooo-monero 9f17b1a30f
updates: s/monerod/monero/ for the main download
Also print download success message as global log
2017-02-22 11:20:37 +00:00
Riccardo Spagni 1a4298685a
Merge pull request #1766
72deb484 updated fallback nodes (Riccardo Spagni)
33329f5b update version to 0.10.2 (Riccardo Spagni)
04a50a7e update checkpoints.dat (Riccardo Spagni)
c3599fa7 update copyright year, fix occasional lack of newline at line end (Riccardo Spagni)
2017-02-22 09:36:11 +02:00
moneromooo-monero 708758b737
core: do not download an update we already downloaded 2017-02-21 22:23:59 +00:00
Riccardo Spagni c3599fa7b9
update copyright year, fix occasional lack of newline at line end 2017-02-21 19:38:18 +02:00
moneromooo-monero 417b126fc4
Fix core_tests breaking on startup
You're wondering how this fixes core tests, aren't you...

It prevents the miner (initialized by cryptonote::core) from
breaking trying to access arguments that were not added.
Since the tests don't use the miner directly, it makes more
sense to have cryptonote_core add those, since it also uses
the miner.
2017-02-21 15:06:07 +00:00
moneromooo-monero e74b3ab5f7
core: add p2p bind port options from net_node
They're now used by core to determine the data directory to use
for the txpool directory.

This fixes an assert in the core tests, which don't use the RPC
server, which normally initializes the P2P code.
2017-02-21 09:35:23 +00:00
Riccardo Spagni 49efd3add9
Merge pull request #1727
0288310e blockchain_db: add "raw" blobdata getters for block and transaction (moneromooo-monero)
2017-02-21 11:27:15 +02:00
moneromooo-monero a5a0a3c894
core: updates can now be downloaded (and SHA256 hash checked) 2017-02-20 22:58:37 +00:00
moneromooo-monero d282cfcc46
core: test key images against validity domain 2017-02-20 22:58:25 +00:00
moneromooo-monero f640512c53
Optionally query moneropulse DNS records to check for updates
It just checks and prints a message if there is a new version
for now.
2017-02-20 22:58:16 +00:00
Howard Chu bed2d9f231
Get rid of directory lock
We don't need it any more. Fixes issue #1633
2017-02-18 22:22:24 +00:00
moneromooo-monero 0288310e3b
blockchain_db: add "raw" blobdata getters for block and transaction
This speeds up operations such as serving blocks to syncing peers
2017-02-13 21:11:37 +00:00
kenshi84 8027ce0c75 extract some basic code from libcryptonote_core into libcryptonote_basic 2017-02-08 22:45:15 +09:00
Riccardo Spagni fcb299b4ae
Merge pull request #1641
ca94d0a4 Separate data per P2P port (Miguel Herranz)
2017-02-02 22:41:28 +02:00
Riccardo Spagni c3eff820be
Merge pull request #1642
3ae79a59 core: set missing verifivation_failed flag when rejecting a tx (moneromooo-monero)
ea6549e9 core_tests: decrease trace level from trace to debug (moneromooo-monero)
2017-02-02 21:25:30 +02:00
Riccardo Spagni f9e60dcd55
Merge pull request #1617
0644eed7 Remove boost/foreach.cpp includes (Miguel Herranz)
36dd3e23 Replace BOOST_REVERSE_FOREACH with ranged for (Miguel Herranz)
629e3101 Replace BOOST_FOREACH with C++11 ranged for (Miguel Herranz)
2017-02-02 18:16:39 +02:00
Miguel Herranz ca94d0a43c Separate data per P2P port
poolstate.bin and p2pstate.bin are stored in .bitmonero/ if the default
P2P port is being used.

If another port is used both files are stored in
.bitmonero/PORTNUMBER/.
2017-01-28 14:16:06 +01:00
moneromooo-monero 3ae79a59e4
core: set missing verifivation_failed flag when rejecting a tx
This fixes two core rct tests
2017-01-28 09:43:41 +00:00
NanoAkron 98357db400
Update log messages to reflect fact we no longer need to type `exit` to save database before quitting 2017-01-23 01:21:26 +00:00
Miguel Herranz 0644eed772 Remove boost/foreach.cpp includes 2017-01-22 23:31:34 +01:00
Miguel Herranz 629e3101ab Replace BOOST_FOREACH with C++11 ranged for 2017-01-22 21:38:10 +01:00
Riccardo Spagni 9c06a7fd04
Merge pull request #1615
f0989893 core: cache tx hashes of failing semantics txes (moneromooo-monero)
2017-01-22 11:51:53 -05:00
Riccardo Spagni a3de797e57
Merge pull request #1610
b70ab128 rpc: fix orphan_status when getting blocks (moneromooo-monero)
2017-01-22 11:48:39 -05:00
moneromooo-monero f098989396
core: cache tx hashes of failing semantics txes 2017-01-22 16:13:31 +00:00
moneromooo-monero b70ab128fc
rpc: fix orphan_status when getting blocks
It was always set to false, even for orphan blocks
2017-01-22 12:20:55 +00:00
moneromooo-monero 7c3f79cb9f
core: early out in handle_incoming_tx if already in pool or blockchain 2017-01-21 20:30:10 +00:00
moneromooo-monero 5833d66f65
Change logging to easylogging++
This replaces the epee and data_loggers logging systems with
a single one, and also adds filename:line and explicit severity
levels. Categories may be defined, and logging severity set
by category (or set of categories). epee style 0-4 log level
maps to a sensible severity configuration. Log files now also
rotate when reaching 100 MB.

To select which logs to output, use the MONERO_LOGS environment
variable, with a comma separated list of categories (globs are
supported), with their requested severity level after a colon.
If a log matches more than one such setting, the last one in
the configuration string applies. A few examples:

This one is (mostly) silent, only outputting fatal errors:

MONERO_LOGS=*:FATAL

This one is very verbose:

MONERO_LOGS=*:TRACE

This one is totally silent (logwise):

MONERO_LOGS=""

This one outputs all errors and warnings, except for the
"verify" category, which prints just fatal errors (the verify
category is used for logs about incoming transactions and
blocks, and it is expected that some/many will fail to verify,
hence we don't want the spam):

MONERO_LOGS=*:WARNING,verify:FATAL

Log levels are, in decreasing order of priority:
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE

Subcategories may be added using prefixes and globs. This
example will output net.p2p logs at the TRACE level, but all
other net* logs only at INFO:

MONERO_LOGS=*:ERROR,net*:INFO,net.p2p:TRACE

Logs which are intended for the user (which Monero was using
a lot through epee, but really isn't a nice way to go things)
should use the "global" category. There are a few helper macros
for using this category, eg: MGINFO("this shows up by default")
or MGINFO_RED("this is red"), to try to keep a similar look
and feel for now.

Existing epee log macros still exist, and map to the new log
levels, but since they're used as a "user facing" UI element
as much as a logging system, they often don't map well to log
severities (ie, a log level 0 log may be an error, or may be
something we want the user to see, such as an important info).
In those cases, I tried to use the new macros. In other cases,
I left the existing macros in. When modifying logs, it is
probably best to switch to the new macros with explicit levels.

The --log-level options and set_log commands now also accept
category settings, in addition to the epee style log levels.
2017-01-16 00:25:46 +00:00
Riccardo Spagni 1207d8ad0d
Merge pull request #1576
ba3968f6 rct: split rct checks between semantics and other (moneromooo-monero)
2017-01-15 14:56:39 -05:00
Riccardo Spagni 10c6afd316
Merge pull request #1571
81c384e4 fix do_not_relay not preventing relaying on a timer (moneromooo-monero)
2017-01-15 14:50:10 -05:00
Riccardo Spagni 65e33b1bc5
Merge pull request #1506
3ff54bdd Check for correct thread before ending batch transaction (Howard Chu)
eaf8470b Must wait for previous batch to finish before starting new one (Howard Chu)
c903c554 Don't cache block height, always get from DB (Howard Chu)
eb1fb601 Tweak default db-sync-mode to fast:async:1 (Howard Chu)
0693cff9 Use batch transactions when syncing (Howard Chu)
2017-01-15 14:43:12 -05:00
Howard Chu eb1fb6011a
Tweak default db-sync-mode to fast:async:1
fsync the DB asynchronously, to allow block download/verification
to proceed while syncing. Sync after every batch. Note that
"fastest" still defaults to fastest:async:1000.
2017-01-14 22:43:06 +00:00
moneromooo-monero ba3968f6ce
rct: split rct checks between semantics and other
Semantics can be checked early
2017-01-14 21:17:32 +00:00
moneromooo-monero 81c384e408
fix do_not_relay not preventing relaying on a timer
Also print its value when printing pool
2017-01-14 13:07:05 +00:00
Riccardo Spagni 0b6031adbf
Merge pull request #1543
19be7225 Add start_time to get_info methods and show uptime (Miguel Herranz)
2017-01-13 14:35:21 -05:00
Miguel Herranz 19be7225cc Add start_time to get_info methods and show uptime 2017-01-12 00:15:21 +01:00
Miguel Herranz aff28178e6 Remove db-auto-remove-logs 2017-01-10 11:49:45 +01:00
Miguel Herranz 1229c68587 Remove berkeley from db_type initialization 2017-01-10 11:46:12 +01:00
moneromooo-monero 12abe86ac0
core: fix recalculation of emission/fees
It was counting things many, many times
2016-12-21 11:19:04 +00:00
Riccardo Spagni f2ea2afb77
Merge pull request #1398
f4772bae Fix a few minor typos (Pierre Boyer)
2016-12-04 22:28:22 +02:00
Pierre Boyer f4772bae81 Fix a few minor typos 2016-12-04 14:13:54 +01:00
moneromooo-monero 3f7d6fb57d
Fix delayed exit when syncing 2016-12-04 12:27:45 +00:00
moneromooo-monero 2c0173c722
Add a get_outs (fully text based) version of get_outs.bin 2016-11-22 20:00:40 +00:00
Dion Ahmetaj d61bd8187e add lightweight block propagation ("fluffy blocks")
Added a new command to the P2P protocol definitions to allow querying for support flags.

Implemented handling of new support flags command in net_node. Changed for_each callback template to include support flags. Updated print_connections command to show peer support flags.

Added p2p constant for signaling fluffy block support.

Added get_pool_transaction function to cryptnote_core.

Added new commands to cryptonote protocol for relaying fluffy blocks.

Implemented handling of fluffy block command in cryptonote protocol.

Enabled fluffy block support in node initial configuration.

Implemented get_testnet function in cryptonote_core.

Made it so that fluffy blocks only run on testnet.
2016-11-09 14:24:27 -05:00
moneromooo-monero 1e163666f3
core: notify the txpool when transactions are relayed 2016-10-23 00:32:49 +01:00
Dion Ahmetaj a6bc1103fd patched parameter type bug that was causing failure on 32 bit 2016-10-14 10:37:10 -04:00
Dion Ahmetaj 7db29d6903 print_coinbase_tx_sum now breaks output into fee and emission components 2016-10-10 19:55:18 -04:00
Dion Ahmetaj dd6c44327b changed params from start/end index to height/count 2016-10-10 17:19:36 -04:00
Dion Ahmetaj 412da63622 added print_coinbase_tx_sum option 2016-10-10 15:45:51 -04:00
Riccardo Spagni d60826c0b9
Merge pull request #1133
cec090f Revert "Fix fake 'network synchronized, begin using' messages" (moneromooo-monero)
2016-10-04 12:08:33 +02:00
Riccardo Spagni e34ef4de6c
Merge pull request #1171
6390673 Removed all code related to fast_exit (NanoAkron)
2016-10-04 11:41:41 +02:00
NanoAkron 8ed0d72b12
Moved logging to target functions rather than caller 2016-10-03 22:11:00 +01:00
NanoAkron 6390673137 Removed all code related to fast_exit 2016-10-03 02:06:55 +01:00
NanoAkron 442bfd1600 Added messages at log level 2 to reflect deactivation procedure 2016-10-02 23:00:41 +01:00
moneromooo-monero cec090fc8a
Revert "Fix fake 'network synchronized, begin using' messages"
This reverts commit 78035d2b6c.

The patch doesn't work, and causes constant SYNCHRONIZED OK spam.
2016-09-25 19:08:35 +01:00
moneromooo-monero 5e3e362c85
core: make the sync chunk block count overridable 2016-09-24 17:00:19 +01:00
Riccardo Spagni 011e42f337
fix nigglies, as pointed out by moneromooo-monero 2016-09-03 22:36:09 +02:00
Riccardo Spagni df63e0704a
fix remaining bitmonero and simplewallet bits 2016-09-03 22:03:44 +02:00
Howard Chu b8c03a5f10
Remove blocks_per_sync limits
The code used to cap at 5000 blocks per sync. It also treated 0 as 1.
Remove these checks; if specified as 0 do no periodic syncs at all.
Then the user is responsible for syncing in some external process.
2016-08-31 00:00:19 +01:00
Riccardo Spagni f5b802e684
Merge pull request #999
dc411ea Change default db-sync-mode to fast, not fastest (Howard Chu)
2016-08-28 22:50:18 +02:00
moneromooo-monero cf33e1a52a
rct: do not serialize public keys in outPk
They can be reconstructed from vout
2016-08-28 21:29:43 +01:00
moneromooo-monero f5465d8246
Condition v2 txes on v3 hard fork 2016-08-28 21:29:04 +01:00
moneromooo-monero dc4aad7eb5
add rct to the protocol
It is not yet constrained to a fork, so don't use on the real network
or you'll be orphaned or rejected.
2016-08-28 21:28:37 +01:00
moneromooo-monero 4258dab4d6
core: new /getrandom_rctouts.bin binary RPC call
to get random ringct outputs to mix with
2016-08-28 21:28:16 +01:00
moneromooo-monero 9e82b694da
remove original Cryptonote blockchain_storage blockchain format 2016-08-28 21:27:32 +01:00
Howard Chu dc411ea3b7 Change default db-sync-mode to fast, not fastest 2016-08-28 16:20:22 +01:00
Thomas Winget 78035d2b6c
Fix fake 'network synchronized, begin using' messages 2016-08-23 22:52:25 -04:00
moneromooo-monero 11dc091464
Fake outs set is now decided by the wallet
This plugs a privacy leak from the wallet to the daemon,
as the daemon could previously see what input is included
as a transaction input, which the daemon hadn't previously
supplied. Now, the wallet requests a particular set of
outputs, including the real one.

This can result in transactions that can't be accepted if
the wallet happens to select too many outputs with non standard
unlock times. The daemon could know this and select another
output, but the wallet is blind to it. It's currently very
unlikely since I don't think anything uses non default
unlock times. The wallet requests more outputs than necessary
so it can use spares if any of the returns outputs are still
locked. If there are not enough spares to reach the desired
mixin, the transaction will fail.
2016-08-11 14:35:27 +01:00
moneromooo-monero 24b3e9007a
Convey tx verification failure reasons to the RPC client
This allows appropriate action to be taken, like displaying
the reason to the user.

Do just that in simplewallet, which should help a lot in
determining why users fail to send.

Also make it so a tx which is accepted but not relayed is
seen as a success rather than a failure.
2016-03-27 12:37:18 +01:00
Riccardo Spagni 0d30b65785 Merge pull request #749
bfd4a28 Update BlockchainDB documentation (Thomas Winget)
797357e Change Doxyfile, Blockchain not blockchain_storage (Thomas Winget)
c835215 remove defunct code from cryptonote::core (Thomas Winget)
50dba6d cryptonote::core doxygen documentation (Thomas Winget)
8ac329d doxygen documentation for difficulty functions (Thomas Winget)
540a76c Move checkpoint functions into checkpoints class (Thomas Winget)
1b0c98e doxygen documentation for checkpoints.{h,cpp} (Thomas Winget)
89c24ac Remove unnecessary or defunct code (Thomas Winget)
ab0ed14 doxygen include private and static members (Thomas Winget)
3a48449 Updated documentation for blockchain.* (Thomas Winget)
2016-03-25 09:12:25 +02:00
Riccardo Spagni 01e0a69c17 Revert "Merge pull request #749"
This reverts commit 7fa63a82a1, reversing
changes made to cb6be986c3.
2016-03-25 08:42:42 +02: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 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
moneromooo-monero f7301c3563
Revert "Print stack trace upon exceptions"
Ain't nobody got time for link/cmake skullduggery.

This reverts commit fff238ec94.
2016-03-21 10:12:23 +00:00
moneromooo-monero fff238ec94
Print stack trace upon exceptions
Useful for debugging users' logs
2016-03-19 21:48:36 +00:00
moneromooo-monero 889217381f
core: print "update needed" hard fork notifications in red 2016-02-17 22:57:14 +00:00
moneromooo-monero a333c42cde
core_tests: add tests for hard fork behaviors (MRL-0004)
We also replace the --fakechain option with an optional structure
containing details about configuration for the core/blockchain,
for test purposes. This seems more future friendly.
2016-02-08 18:52:00 +00:00
moneromooo-monero 05bfb51d3e
core: move the db lock to the data directory
Locking just one db turns out to not have been a good idea, since
the pool and p2p state fdles have to be used anyway.

Also ensure the directory exists before tring to lock.
2016-02-04 18:09:45 +00:00
moneromooo-monero 8b3539bc11
core: prevent the database from being used by multiple daemons
A boost lock is used to determine whether more than one process
wants to access the database. The boost file_lock doesn't seem
to like locking directories, so we use an arbitrary file in it.
This allows to still run two daemons if they have different
database directories (ie, LMDB/BDB, different data directories).
2016-01-31 12:58:08 +00:00
moneromooo-monero 3b1d7e03fc
Fix V1/V2 use of hard fork related parameters
Some of it uses hardcoded height, which will need some thinking
for next (voted upon) fork.
2016-01-29 17:21:11 +00:00
Riccardo Spagni b98d88c17e
Merge pull request #587
1e07110 Nicer looking exit when blockchain.bin is found (moneromooo-monero)
2015-12-31 22:34:57 +02:00
moneromooo-monero 1e07110a7a
Nicer looking exit when blockchain.bin is found
Do not print the exception message, and write the important bit
in red, since people will only read the last line otherwise.
2015-12-31 17:09:00 +00:00
moneromooo-monero 40f97ce83d
core: do not use the persistent pool state for tests
Fixes intermittent test failures when the pool contains
unexpected transactions that were brought in from the
live pool.
2015-12-31 14:24:06 +00:00
Riccardo Spagni de03926850
updated copyright year 2015-12-31 08:39:56 +02:00
moneromooo-monero 09533557b5
blockchain_db: inform user about new format if blockchain.bin is found 2015-12-28 23:03:46 +00:00
warptangent 725acc7f17
Replace tabs with two spaces for consistency with rest of codebase
Remove trailing whitespace in same files.
2015-12-15 06:22:06 -08:00
moneromooo-monero 10da0a0b7c
add a --fakechain argument for tests
The core tests use the blockchain, and reset it to be able
to add test data to it. This does not play nice with the
databases, since those will save that data without an explicit
save call.
We add a fakechain flag that the tests will set, which tells
the core and blockchain code to use a separate database, as
well as skip a few things like checkpoints and fixup, which
only make sense for real data.
2015-12-13 11:38:37 +00:00
moneromooo-monero 336b37580f
Register daemon command line arguments to core if they're used in core
This fixes coretests, which does not register daemon specific arguments,
but uses core, which uses those arguments. Also gets rid of an unwanted
dependency on daemon code from core.
2015-12-08 23:06:29 +00:00
moneromooo-monero 932994c0cb
Relay transactions when they linger too long in the pool
The last relayed time of a transaction is maintained, and
transactions will be relayed again if they are still in the
pool after a certain amount of time, which increases with
the transaction's age. All such transactions are resent,
whether or not they originated on the local node.
2015-11-21 00:56:21 +00:00
moneromooo-monero a7177610b3
core: add consts where appropriate 2015-09-19 16:47:35 +01:00
moneromooo-monero 8ffc508cef
core: moan when we think an update is needed to get latest hard fork info 2015-09-13 18:09:57 +01:00
moneromooo-monero 83bbea4c7f
Add a is_key_image_spent daemon command and RPC call 2015-08-11 10:52:41 +01:00
NoodleDoodleNoodleDoodleNoodleDoodleNoo 94ea3e8ed2 Removed on_idle() calls to Blockchain::store_blockchain() for lmdb.
Added option to cache tx-input verification results.
2015-07-15 23:20:25 -07:00
NoodleDoodleNoodleDoodleNoodleDoodleNoo e5d2680094 ** CHANGES ARE EXPERIMENTAL (FOR TESTING ONLY)
Bockchain:
1. Optim: Multi-thread long-hash computation when encountering groups of blocks.
2. Optim: Cache verified txs and return result from cache instead of re-checking whenever possible.
3. Optim: Preload output-keys when encoutering groups of blocks. Sort by amount and global-index before bulk querying database and multi-thread when possible.
4. Optim: Disable double spend check on block verification, double spend is already detected when trying to add blocks.
5. Optim: Multi-thread signature computation whenever possible.
6. Patch: Disable locking (recursive mutex) on called functions from check_tx_inputs which causes slowdowns (only seems to happen on ubuntu/VMs??? Reason: TBD)
7. Optim: Removed looped full-tx hash computation when retrieving transactions from pool (???).
8. Optim: Cache difficulty/timestamps (735 blocks) for next-difficulty calculations so that only 2 db reads per new block is needed when a new block arrives (instead of 1470 reads).

Berkeley-DB:
1. Fix: 32-bit data errors causing wrong output global indices and failure to send blocks to peers (etc).
2. Fix: Unable to pop blocks on reorganize due to transaction errors.
3. Patch: Large number of transaction aborts when running multi-threaded bulk queries.
4. Patch: Insufficient locks error when running full sync.
5. Patch: Incorrect db stats when returning from an immediate exit from "pop block" operation.
6. Optim: Add bulk queries to get output global indices.
7. Optim: Modified output_keys table to store public_key+unlock_time+height for single transaction lookup (vs 3)
8. Optim: Used output_keys table retrieve public_keys instead of going through output_amounts->output_txs+output_indices->txs->output:public_key
9. Optim: Added thread-safe buffers used when multi-threading bulk queries.
10. Optim: Added support for nosync/write_nosync options for improved performance (*see --db-sync-mode option for details)
11. Mod: Added checkpoint thread and auto-remove-logs option.
12. *Now usable on 32-bit systems like RPI2.

LMDB:
1. Optim: Added custom comparison for 256-bit key tables (minor speed-up, TBD: get actual effect)
2. Optim: Modified output_keys table to store public_key+unlock_time+height for single transaction lookup (vs 3)
3. Optim: Used output_keys table retrieve public_keys instead of going through output_amounts->output_txs+output_indices->txs->output:public_key
4. Optim: Added support for sync/writemap options for improved performance (*see --db-sync-mode option for details)
5. Mod: Auto resize to +1GB instead of multiplier x1.5

ETC:
1. Minor optimizations for slow-hash for ARM (RPI2). Incomplete.
2. Fix: 32-bit saturation bug when computing next difficulty on large blocks.

[PENDING ISSUES]
1. Berkely db has a very slow "pop-block" operation. This is very noticeable on the RPI2 as it sometimes takes > 10 MINUTES to pop a block during reorganization.
   This does not happen very often however, most reorgs seem to take a few seconds but it possibly depends on the number of outputs present. TBD.
2. Berkeley db, possible bug "unable to allocate memory". TBD.

[NEW OPTIONS] (*Currently all enabled for testing purposes)
1. --fast-block-sync arg=[0:1] (default: 1)
	a. 0 = Compute long hash per block (may take a while depending on CPU)
	b. 1 = Skip long-hash and verify blocks based on embedded known good block hashes (faster, minimal CPU dependence)
2. --db-sync-mode arg=[[safe|fast|fastest]:[sync|async]:[nblocks_per_sync]] (default: fastest:async:1000)
	a. safe = fdatasync/fsync (or equivalent) per stored block. Very slow, but safest option to protect against power-out/crash conditions.
	b. fast/fastest = Enables asynchronous fdatasync/fsync (or equivalent). Useful for battery operated devices or STABLE systems with UPS and/or systems with battery backed write cache/solid state cache.
	Fast    - Write meta-data but defer data flush.
	Fastest - Defer meta-data and data flush.
	Sync    - Flush data after nblocks_per_sync and wait.
	Async   - Flush data after nblocks_per_sync but do not wait for the operation to finish.
3. --prep-blocks-threads arg=[n] (default: 4 or system max threads, whichever is lower)
        Max number of threads to use when computing long-hash in groups.
4. --show-time-stats arg=[0:1] (default: 1)
	Show benchmark related time stats.
5. --db-auto-remove-logs arg=[0:1] (default: 1)
	For berkeley-db only. Auto remove logs if enabled.

**Note: lmdb and berkeley-db have changes to the tables and are not compatible with official git head version.
	At the moment, you need a full resync to use this optimized version.

[PERFORMANCE COMPARISON]
**Some figures are approximations only.
Using a baseline machine of an i7-2600K+SSD+(with full pow computation):
1. The optimized lmdb/blockhain core can process blocks up to 585K for ~1.25 hours + download time, so it usually takes 2.5 hours to sync the full chain.
2. The current head with memory can process blocks up to 585K for ~4.2 hours + download time, so it usually takes 5.5 hours to sync the full chain.
3. The current head with lmdb can process blocks up to 585K for ~32 hours + download time and usually takes 36 hours to sync the full chain.

Averate procesing times (with full pow computation):
lmdb-optimized:
1. tx_ave = 2.5 ms / tx
2. block_ave = 5.87 ms / block
memory-official-repo:
1. tx_ave = 8.85 ms / tx
2. block_ave = 19.68 ms / block
lmdb-official-repo (0f4a036437)
1. tx_ave = 47.8 ms / tx
2. block_ave = 64.2 ms / block

**Note: The following data denotes processing times only (does not include p2p download time)
lmdb-optimized processing times (with full pow computation):
1. Desktop,  Quad-core / 8-threads 2600k  (8Mb) - 1.25 hours processing time (--db-sync-mode=fastest:async:1000).
2. Laptop,   Dual-core / 4-threads U4200  (3Mb) - 4.90 hours processing time (--db-sync-mode=fastest:async:1000).
3. Embedded, Quad-core / 4-threads Z3735F (2x1Mb) - 12.0 hours processing time (--db-sync-mode=fastest:async:1000).

lmdb-optimized processing times (with per-block-checkpoint)
1. Desktop,  Quad-core / 8-threads 2600k  (8Mb) - 10 minutes processing time (--db-sync-mode=fastest:async:1000).

berkeley-db optimized processing times (with full pow computation)
1. Desktop, Quad-core / 8-threads 2600k  (8Mb) - 1.8 hours processing time (--db-sync-mode=fastest:async:1000).
2. RPI2. Improved from estimated 3 months(???) into 2.5 days (*Need 2AMP supply + Clock:1Ghz + [usb+ssd] to achieve this speed) (--db-sync-mode=fastest:async:1000).

berkeley-db optimized processing times (with per-block-checkpoint)
1. RPI2. 12-15 hours (*Need 2AMP supply + Clock:1Ghz + [usb+ssd] to achieve this speed) (--db-sync-mode=fastest:async:1000).
2015-07-15 23:20:16 -07:00
warptangent 71af04669c
Update log statements
Use filesystem path conversion to string() instead of c_str().
Windows may otherwise output an address.
2015-05-08 14:12:06 -07:00
Riccardo Spagni 8005a0c7a1
Merge pull request #269
641d824 Keep memory pool consistent when stuck tx removed (warptangent)
b76857f Add mempool output to daemon via command and RPC (warptangent)
2015-05-06 08:09:31 +02:00
warptangent b76857f9d9
Add mempool output to daemon via command and RPC
This is for the "print_pool" command and "get_transaction_pool" RPC
method.

Add mempool's spent key images to the results.
2015-04-23 07:04:36 -07: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 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 9519526224
Only compile BerkeleyDB as an option in non-static 2015-04-07 15:02:20 -04:00
rfree2monero c511abf005 remerged; commands JSON. logging upgrade. doxygen 2015-04-01 19:00:45 +02:00
rfree2monero 3cbdf198f1 Merge remote-tracking branch 'monero-official/master' into network-1.6-work1 2015-04-01 18:24:45 +02: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 5c0bc0050c
Merge upstream updates into blockchain branch 2015-03-25 05:56:36 -04: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
rfree2monero ae2a50659f 2014 network limit 1.2 +utils +toc -doc -drmonero
new update of the pr with network limits

more debug options:
discarding downloaded blocks all or after given height.
trying to trigger the locking errors.

debug levels polished/tuned to sane values.
debug/logging improved.

warning: this pr should be correct code, but it could make
an existing (in master version) locking error appear more often.

it's a race on the list (map) of peers, e.g. between closing/deleting
them versus working on them in net-limit sleep in sending chunk.

the bug is not in this code/this pr, but in the master version.

the locking problem of master will be fixed in other pr.

problem is ub, and in practice is seems to usually cause program abort
(tested on debian stable with updated gcc). see --help for option
to add sleep to trigger the error faster.
2015-02-20 22:28:03 +01:00
rfree2monero 5ce4256e3d 2014 network limit 1.1 +utils +toc -doc -drmonero
Update of the PR with network limits

works very well for all speeds
(but remember that low download speed can stop upload
because we then slow down downloading of blockchain
requests too)

more debug options

fixed pedantic warnings in our code
should work again on Mac OS X and FreeBSD
fixed warning about size_t
tested on Debian, Ubuntu, Windows(testing now)

TCP options and ToS (QoS) flag
FIXED peer number limit
FIXED some spikes in ingress/download
FIXED problems when other up and down limit
2015-02-20 22:13:00 +01:00
warptangent 84fe5fbd65
Add compile-time support for both db implementations: in-memory and LMDB
Usage:

default is lmdb for blockchain branch:
$ make release

same as:
$ DATABASE=lmdb make release

for original in-memory implementation:
$ DATABASE=memory make release
2015-02-02 11:53:09 -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
Riccardo Spagni f4b69d553a
year updated in license 2015-01-02 18:52:46 +02: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
Riccardo Spagni 59a8366bb1 Revert "low risk, potentially varint overflow bug patched thanks to BBR"
This reverts commit 4e2b2b942d.
2014-09-25 08:24:42 +02:00
Riccardo Spagni 4e2b2b942d low risk, potentially varint overflow bug patched thanks to BBR 2014-09-24 22:17:33 -04:00
Zachary Michaels d03308734b
Separate testnet address prefix 2014-09-15 15:54:59 +02:00
Zachary Michaels 018e251cc0
Separate testnet default data dir 2014-09-15 15:54:19 +02:00
Zachary Michaels 07470fd400
Add testnet flag
Source: cryptonotefoundation
2014-09-15 15:53:01 +02:00
iamsmooth bb2b606e91 fix incorrect error message (obvious cut and paste bug from upstream) 2014-09-13 08:04:05 +00:00
fluffypony cf5a8b1d6c moved non-critical warnings and errors to log level 1 2014-09-09 11:32:00 +02:00
Riccardo Spagni ba99a86333 Merge pull request #73 from jakoblind/refresh_height
Optional height parameter for wallet refresh
2014-08-02 11:13:26 +02:00
Riccardo Spagni d1b0ee7ecd Merge pull request #64 from mikezackles/bytecoin_tx_pool_tmp
tx pool fixes, courtesy of Bytecoin
2014-08-01 17:31:15 +02:00
Jakob Lind e4273f2415 #36 simplewallet refresh include optional height param
height param is used optionally in refresh command 

TODO: This should also be the default behaviour 
when generating a new wallet.
2014-08-01 10:17:50 +02:00
fluffypony 6fc995fe5d License updated to BSD 3-clause 2014-07-23 15:03:52 +02:00
Zachary Michaels 4d25350a82 Use const where appropriate in tx_pool 2014-07-17 16:31:31 -04:00
Zachary Michaels a633c11cbb Remove unused function 2014-07-01 14:57:27 -04:00
Zachary Michaels b3092d4e00 Comment unused functions in cryptonote_core 2014-07-01 14:57:26 -04:00
fluffypony 3bc16dc0e6 proper tx_pool handling from CryptoZoidberg / BBR 2014-06-15 09:48:13 +02:00
mydesktop 75fc3e90b1 Fix for orphan fix (check blocksize) 2014-06-11 17:32:53 -04:00
Neozaru 7fea5645e2 'getinfo' daemon HTTP-RPC returns 'target_height' for progress estimations 2014-06-04 22:50:13 +02:00
mydesktop 3a3a817678 0.8.8update 2014-05-25 13:06:40 -04:00
Antonio Juarez 8efa1313f3 some fixes 2014-03-20 11:46:11 +00:00
Antonio Juarez 296ae46ed8 moved all stuff to github 2014-03-03 22:07:58 +00:00