Commit Graph

34 Commits

Author SHA1 Message Date
moneromooo-monero
12adb4a3f3
core: move hardfork back to cryptonote_core
should fix a cross dependency betewen cryptonote_basic and
blockchain_db
2017-02-25 16:41:35 +00:00
kenshi84
8027ce0c75 extract some basic code from libcryptonote_core into libcryptonote_basic 2017-02-08 22:45:15 +09: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
moneromooo-monero
feb499aaae
core: check block version for alt chains too
This is incompatible with block version voting
2017-01-14 22:41:14 +00:00
moneromooo-monero
7e4e0021f4
daemon: print time to next fork 2016-08-12 20:32:23 +01:00
moneromooo-monero
b3801faafa
hardfork: fix off by one in rescaning fork state after restart
This code should die anyway.
2016-07-25 23:16:02 +01:00
moneromooo-monero
d7b681cd65
remove hf_starting_height db
It's not really needed, it used to be an optimization for when
that code was not using the db and needed to recalculate things
fast on startup.
2016-07-13 21:38:34 +01:00
Howard Chu
8cc7a36f0b read txn/cursor stuff
Could wrap more later.
2016-02-23 20:47:15 +00:00
moneromooo-monero
759383c52d
hardfork: add a default fork entry for v1 if none exist
To avoid special cases
2016-02-08 20:58:06 +00:00
moneromooo-monero
64a2aa3376
hardfork: allow passing chain height in get(height) for convenience 2016-02-01 20:06:55 +00:00
moneromooo-monero
601ad76a5e
hardfork: fix mixup in indexing variable in get_voting_info 2016-01-30 22:13:20 +00:00
moneromooo-monero
945ac788d4
hardfork: fix accepting v2 blocks too early 2016-01-15 11:54:35 +00:00
Riccardo Spagni
810a11267c
fixed copyrights with bad year references 2015-12-31 08:37:27 +02:00
Riccardo Spagni
aa6dd048d8
Merge pull request #570
fc34132 Remove assert from status command (hyc)
2015-12-30 09:37:25 +02:00
hyc
fc341325a7 Remove assert from status command
Crashes every time...
2015-12-27 08:44:18 +00:00
moneromooo-monero
50ee591152
hardfork: ensure current_fork_index can not become negative on rescan 2015-12-26 13:17:00 +00:00
moneromooo-monero
8ea7af1ba3
Allow the wallet to access hard fork information
And make it change behavior slightly when close/after first hard fork
2015-12-19 14:52:30 +00:00
moneromooo-monero
a74cc1bee2
hardfork: only accept major versions we know about 2015-12-14 09:17:07 +00:00
moneromooo-monero
d887c18e33
hardfork: fix more major/minor issues
Also add some more tests, and rename some instances of
"version" and "add" for clarity.

NOTE: the starting height values are sometimes wrong.
I suspect this is due to the hard fork reorg code being
buggy, since they're good when syncing after the fact.
However, they're not actually used by the consensus code,
so I'm ignoring this for now, but this needs debugging.
2015-11-24 20:47:12 +00:00
moneromooo-monero
3b47ca2d7d
hardfork: fix rescan on load 2015-11-23 21:12:55 +00:00
moneromooo-monero
edade8dc81
hardfork: fix actual/voting confusion 2015-11-23 14:04:33 +00:00
moneromooo-monero
2f254ff599
hardfork: add a get_ideal_version(uint64_t) function
It returns the ideal version for a given height, which is
based on the minimum height for a fork, disregarding votes
2015-11-10 09:45:51 +00:00
moneromooo-monero
4187e569d8
hardfork: allow per-fork voting thresholds
And setup the first fork to not vote
2015-11-08 13:04:41 +00:00
moneromooo-monero
6376627530
hardfork: switch voting to block minor version
Using major version would cause older daemons to reject those
blocks as they fail to deserialize blocks with a major version
which is not 1. There is no such restriction on the minor
version, so switching allows older daemons to coexist with
newer ones till the actual fork date, when most will hopefully
have updated already.

Also, for the same reason, we consider a vote for 0 to be a
vote for 1, since older daemons set minor version to 0.
2015-10-21 19:21:14 +01:00
moneromooo-monero
03bc6100de
hardfork: use DB transactions when reorganizing
It speeds up a lot, which can be significant when reorganizing
from the genesis block to create the hard fork data.
2015-10-17 00:11:13 +01:00
moneromooo-monero
439c4555e9
hardfork: simplify work done on reload
There is no need to fully recalculate and rewrite state, just
refill state from the DB.
2015-10-17 00:11:06 +01:00
moneromooo-monero
cec92c4fd3
hardfork: move an assert so it actually works
An unsigned quantity is always >= 0
2015-10-04 12:55:49 +01:00
moneromooo-monero
0a7421b607
hardfork: rescan speedup
Add a block height before which version 1 is assumed
Use DB transactions
2015-09-27 22:46:41 +01:00
moneromooo-monero
fec98b8952
hardfork: remove use of GNU extension for initializing object 2015-09-27 22:46:36 +01:00
moneromooo-monero
088bc56d79
hardfork: change window semantics to not count the newly added block
This allows knowing the hard fork a block must obey in order to be
added to the blockchain. The previous semantics would use that new
block's version vote to determine this hard fork, which made it
impossible to use the rules to validate transactions entering the
tx pool (and made it impossible to validate a block before adding
it to the blockchain).
2015-09-27 22:46:25 +01:00
moneromooo-monero
5b11a89a76
hardfork: most state now saved to the DB
There will be a delay on first load of an existing blockchain
as it gets reparsed for this state data.
2015-09-20 18:42:52 +01:00
moneromooo-monero
0a54c3a553
hardfork: remove the "parts are copyright cryptonote" notices
I coded the whole thing from scratch.
2015-09-20 10:05:15 +01:00
moneromooo-monero
e546f3724a
Add an RPC call and daemon command to get info on hard fork voting 2015-09-19 16:47:48 +01:00
moneromooo-monero
62b1f74116
New hardfork class
This keeps track of voting via block version, in order to decide
when to enable a particular fork's code.
2015-09-12 11:14:44 +01:00