Commit Graph
100 Commits
Author SHA1 Message Date
moneromooo-monero cbdfa7576a mlog: fix default logging being not verbose enough 2017-02-04 12:43:19 +00:00
moneromooo-monero cd34fc655d Use easylogging++'s stack trace facility where possible
This avoids using libunwind, which often causes trouble.
2017-02-04 12:33:03 +00:00
moneromooo-monero c3d7a198bf mlog: probable fix for gmtime_r not being available on windows 2017-02-04 11:48:58 +00:00
moneromooo-monero 4f5b130de9 wallet_rpc_server: add address book RPC calls 2017-02-04 11:40:49 +00:00
moneromooo-monero 3471907160 simplewallet: cleanup
Remove empty static function which was refactored, as well as
leftover exception testing code.
2017-02-02 20:56:53 +00:00
moneromooo-monero a9a9b64b13 simplewallet: fix build (unqualified type not in current scope) 2017-02-02 20:56:31 +00:00
moneromooo-monero b5cb8861c7 core: fix integrated addresses breaking with auto zero change
Zero change is sent to a random address, which confuses the code
which determines which key to use to encrypt the payment id.
Ignore zero amounts for this purpose, so the payment id gets
encrypted with the real destination's key.
2017-02-02 20:53:12 +00:00
moneromooo-monero 8c8482ac98 wallet_rpc_server: fix short payment id validation in transfer 2017-01-29 16:10:20 +00:00
moneromooo-monero 2bf029be17 wallet2: fix corner case failing to send a second output
If a rct transaction can be made with just one input, a second
output will be added. This output will be the smallest amount
output available. However, if this output is a non rct output
with less available fake outs than requested, the transaction
will be rejected. We now check the histogram to only consider
outputs with enough available fake outs in the first place.
2017-01-28 15:07:15 +00:00
moneromooo-monero 9bd9906e8f Factor is_address_local code into a tools function 2017-01-28 14:57:47 +00:00
moneromooo-monero 69d2ad3967 wallet_rpc_server: fix logs going to the wrong file 2017-01-28 11:37:21 +00: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
moneromooo-monero ea6549e9da core_tests: decrease trace level from trace to debug
It had become very, very spammy
2017-01-28 09:43:32 +00:00
moneromooo-monero a39cd745c9 rpc: fix bc_dyn_stats not setting grace blocks
This caused a random value to be used, and the resulting
incorrect fee when it wasn't 0.
2017-01-23 19:28:00 +00:00
moneromooo-monero 1e8cc6764e mlog: allow using numerical level as default prefix
eg, 2,foo:ERROR,bar:INFO
2017-01-22 16:54:17 +00:00
moneromooo-monero 8028b5324e protocol: log received messages in a separate category
Makes it easier to log just what's going on on P2P
2017-01-22 16:54:10 +00:00
moneromooo-monero f098989396 core: cache tx hashes of failing semantics txes 2017-01-22 16:13:31 +00:00
moneromooo-monero 13dd102e94 mlog: fix default level/category mapping
It was not matching the LOG_PRINT_Lx mapping for 2/3/4
2017-01-22 15:20:55 +00:00
moneromooo-monero 20f7152769 wallet2: fix sending a rct tx with a single output available
This would have tried to send a second output to make the tx
look like the 2/2 ideal, but it would not fail to find one
because picking an output from preferred_inputs priority list
did not remove it from the unused tranfer/dust outputs, so
it would try to send the same output twice.

While there, I also added a check to avoid sending a second
input if it's related to the first. Better 1/2 than linking
inputs, I think.
2017-01-22 15:16:45 +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 4cdf0a35c9 p2p: always recreate a new peer id on startup
This prevents easy fingerprinting when you change IPs, and
will be a must when kovri gets used.
2017-01-22 11:37:55 +00:00
moneromooo-monero f9293b69d8 unit_tests: fix missing return after batch_start prototype change 2017-01-21 21:51:07 +00:00
moneromooo-monero f8b97aef34 p2p: show ban/unban logs by default again 2017-01-21 21:19:21 +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 6cc7d26140 ringct: reorder a bit to check quicker tests first 2017-01-21 20:29:22 +00:00
moneromooo-monero a854cec3ba Make stack trace show up in log file with default settings 2017-01-21 20:28:18 +00:00
moneromooo-monero 17246d051d wallet: print exception message on get_random_outs_error 2017-01-20 18:01:13 +00:00
moneromooo-monero 7c0c5c1724 easylogging++: detect DragonFly BSD as a UNIX 2017-01-20 00:33:13 +00:00
moneromooo-monero 87c658f83b wallet2_api: add API to set log categories 2017-01-16 21:14:44 +00:00
moneromooo-monero 5e61687fdf mlog: allow overriding log format
using the MONERO_LOG_FORMAT environment variable.

Default is:
%datetime{%Y-%M-%d %H:%m:%s.%g}\t%thread\t%level\t%logger\t%loc\t%msg

Field list in easylogging++ documentation.

Don't forget to escape as needed.
2017-01-16 19:43:00 +00:00
moneromooo-monero 5161f16f4a easylogging++: enforce recursive mutex
This fixes a hang when logging something which causes some other
logging code to be called
2017-01-16 19:41:17 +00:00
moneromooo-monero a480bf6b14 fixups in logging init calls, and add missing net context in a log 2017-01-16 10:45:59 +00:00
moneromooo-monero 693c190881 wallet: add a node RPC cache layer for simple RPC calls
Mostly getinfo and get_hard_fork_info, which are called
pretty often. This speeds up transfers as a bonus.
2017-01-16 08:59:15 +00:00
moneromooo-monero d86ae2bec6 wallet2: reuse fake outs when adjusting fee on transfer
This avoids indirectly leaking the real output to the daemon,
and is faster.

This will still happen for more complex cases, especially
when cancelling a tx and "re-rolling" it.
2017-01-16 08:59:08 +00:00
moneromooo-monero 64da0983d5 core: don't try to deserialize an empty extra to remove a field 2017-01-16 08:59:02 +00:00
moneromooo-monero e389bd9e60 Makefile: remove mistakenly added local custom target 2017-01-16 08:49:28 +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
moneromooo-monero dc98019b59 easylogging++: fix logging with static const header only data members 2017-01-16 00:18:21 +00:00
moneromooo-monero 3b46617bd9 easylogging++: add ELPP_DISABLE_CHECK_MACROS 2017-01-16 00:18:17 +00:00
moneromooo-monero 6fe39d9017 easylogging++: allow clipping a common filename prefix 2017-01-16 00:18:12 +00:00
moneromooo-monero 43abf6ff45 easylogging++: add file-only logs 2017-01-16 00:18:07 +00:00
moneromooo-monero c313bea450 eayslogging++: Fix bad memory access before opening any files 2017-01-16 00:18:02 +00:00
moneromooo-monero 0af5d16872 easylogging++: avoid creating directory/filename for the builtin default log file 2017-01-16 00:17:59 +00:00
moneromooo-monero 2836284798 easylogging++: allow setting thread names 2017-01-16 00:17:55 +00:00
moneromooo-monero ec71ce8d2d easylogging++: Print thread ID in a nicer way 2017-01-16 00:17:51 +00:00
moneromooo-monero 2a0bf7834c easylogging++: Add logging categories 2017-01-16 00:17:47 +00:00
moneromooo-monero c50bbbfedd easylogging++: import upstream 2017-01-16 00:17:40 +00:00
moneromooo-monero 6da9335a9e blockchain_import: fix build after tx_pool::add_tx changes 2017-01-15 21:52:56 +00:00
moneromooo-monero f5f4109f9a mnemonics: fix language detection with checksum word
If a checksum word is present, language detection would use
just the word prefixes. However, a set of word prefixes may
be found in more than one language, and so the wrong language
may be found first, which could then fail the checksum, since
the check may be done with a different unique prefix length
from the one it was created from.

We now make a checksum test when we we detect a language from
prefixes only, to make sure we have the correct one.
2017-01-15 11:16:25 +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 d276a16526 wallet2: use at least two rct inputs if possible
If we'd make a rct tx with just one input, we try to add
a second one to match the 2/2 ideal. This means more txes
use that template (and are thus using a larger anonymity
set), and it coalesces outputs "for free". We use the
smallest amount outputs in priority for this, so we can
"clean" the wallet at the same time.
2017-01-14 21:43:01 +00:00
moneromooo-monero b3ca0c627a unit_tests: fix portable serialization tests hardcoded data path 2017-01-14 21:19:33 +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
moneromooo-monero 5b5017e267 rpc: add a command to get info about the current blockchain
About the tip of the main chain, and the last N blocks
2017-01-13 23:21:38 +00:00
moneromooo-monero c9f13c5e54 wallet2: fix tx reroll not updating fee is going up a kB step 2017-01-13 22:28:19 +00:00
moneromooo-monero 176b70a0d4 account: fix build error involving std::max and different types 2017-01-13 22:12:27 +00:00
moneromooo-monero 50b230d12c core: ensure block size limit is set from the start
It can now be queried by RPC, so it needs to be set before
it is otherwise needed for consensus, even if no blocks had
to be added (ie, exit and restart quickly).
2017-01-13 21:06:14 +00:00
moneromooo-monero a813ab50fe wallet2_api: add solo mining API 2017-01-09 10:12:55 +00:00
moneromooo-monero c21350823f simplewallet: add a show_transfer <txid> command 2017-01-08 13:57:24 +00:00
moneromooo-monero 19c4041df5 wallet_rpc_server: new RPC call to get a transfer by txid 2017-01-08 13:16:22 +00:00
moneromooo-monero 0478ac6848 blockchain: allow marking "tx not found" without an exception
This is a normal occurence in many cases, and there is no need
to spam the log with those when it is.
2017-01-07 20:52:17 +00:00
moneromooo-monero 1607cb7e0c tx_pool: better block template filling algorithm
Continue filling until we reach the block size limit, or the
resulting coinbase decreases.

Also remove old sanity check on block size, which is now not
wanted anymore.
2017-01-07 12:36:22 +00:00
moneromooo-monero 9731b4e54f rpc: add block size to GET_BLOCK_HEADER RPC
and print it in print_bc
2017-01-06 19:38:27 +00:00
moneromooo-monero 9188b3468c rpc: add current block size to the getinfo call 2017-01-06 19:30:10 +00:00
moneromooo-monero 21c5af5a8a wallet2_api: add an address book payment id lookup API 2017-01-01 16:06:34 +00:00
moneromooo-monero cebae0c510 wallet2: check the node returned the real output when requested 2016-12-27 09:38:10 +00:00
moneromooo-monero 591d83686e core: invalidate difficulty cache when resetting blockchain 2016-12-25 20:38:11 +00:00
moneromooo-monero c0a0fcaff0 wallet2_api: some new APIs to access daemon state 2016-12-25 12:31:50 +00:00
moneromooo-monero 37ed96e611 tx_pool: fix uninitialized "last failed" fields 2016-12-24 19:42:35 +00:00
moneromooo-monero 94b6feef24 rpc: fix mixup in tx_info serialization 2016-12-24 18:08:48 +00:00
moneromooo-monero 505116771e wallet2: fix large reorgs failing
If a reorg was large enough that a full 1000 block chunk
from the daemon was all known blocks, refresh would stop,
and no reorg would happen.
2016-12-24 16:04:37 +00:00
moneromooo-monero 0020ad7d99 cmake: link against liblzma when found, for libunwind
Some versions of libunwind need liblzma. If liblzma is found,
we link against it unconditionally. If the installed libunwind
didn't need it, this is a nop.

Tested and fine tuned by iDunk
2016-12-24 00:00:45 +00: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
moneromooo-monero c31e42e2bb simplewallet: bump output file format version
The serialization format changed, and while there is code
to load the older serialization format, an older monerod
will not be able to load a file saved by a new monerod,
even though both share the same version. This is not good,
and we prefer a version bump.
2016-12-20 19:02:51 +00:00
moneromooo-monero 1976eddd89 common: add missing #include <system_error> for std::error_code 2016-12-20 18:53:58 +00:00
moneromooo-monero 9e4b3724c7 simplewallet: add pending/pool/failed in the show_transfers help
reported by nioc
2016-12-17 19:51:09 +00:00
moneromooo-monero 9a2cd72257 wallet2_api: add an API to the OpenAlias resolver 2016-12-17 13:05:17 +00:00
moneromooo-monero 55fa0479a0 rpc: new function and RPC to get alternative chain info 2016-12-17 11:28:49 +00:00
moneromooo-monero dd144b14bc blockchain: fix reorganizations past a hard fork boundary
After popping blocks from the old chain, the hard fork object's
notion of the current version was not in line with the new height,
causing the first blocks from the new chain to be rejected due
to a false expection of a newer version.
2016-12-13 02:13:23 +00:00
moneromooo-monero 81c6bb9a40 thread_group: fix build on older GCC
vtnerd (original author) confirmed this is the Right Way.
2016-12-11 13:59:42 +00:00
moneromooo-monero c5c45ca660 wallet: bring forward use of the dynamic fee
It was 14 days after v4, it is now one day after it.

luigi1111's suggestion
2016-12-10 15:39:26 +00:00
moneromooo-monero 19585d4914 mnemonics: fix misc STL containers leak
found by coverity
2016-12-10 12:51:36 +00:00
moneromooo-monero f6fcf0ef26 oaes_lib: fix a leak on OOM error path
found by coverity
2016-12-10 12:51:20 +00:00
moneromooo-monero 9b00d80f85 wallet2: pass by const ref where possible
Reported by kenshi84
2016-12-10 11:43:44 +00:00
moneromooo-monero f4a3ce15c1 Fix sending outputs from a tx with more than one pubkey
A bug in cold signing caused a spurious pubkey to be included
in transactions, so we need to ensure we use the correct one
when sending outputs from one of those.
2016-12-09 18:21:21 +00:00
moneromooo-monero dfbb85b6fe blockchain: fix setting non trovial alternate chain as invalid
The wrong iterator was being used.
Also preincrement iterators to avoid possibly invalidating them,
I'm not sure this is necessary, but let's be safe.
2016-12-08 22:26:27 +00:00
moneromooo-monero 0b91d82574 simplewallet: restore automatically setting trusted local daemon 2016-12-08 20:01:24 +00:00
moneromooo-monero 3b00527500 ringct: add sc_check calls in MLSAG_Ver for ss and cc
luigi1111's recommendation
2016-12-07 22:41:21 +00:00
moneromooo-monero 2f1732a7e5 ringct: guard against bad data exceptions in worker threads
If purported pubkeys aren't actually valid pubkeys, exceptions
will fly. These will terminate if thrown in a worker thread.
Guard against this.
2016-12-07 22:09:43 +00:00
moneromooo-monero 6c44f5c6eb wallet: send 0 change to a random address where necessary with rct
If a rct transaction would cause no change to be generated, a zero
change output is added, and sent to a randomly generated address.
This ensures that no transaction will be sent with just one output,
which could cause the receiver to be able to determine which of the
inputs in the sent rings is the real one.
This is very rare, since it requires the sum of outputs to be equal
to the sum of outputs plus the fee, which is now a function of the
last few blocks.
2016-12-07 21:05:50 +00:00
moneromooo-monero 73ac3b8e26 wallet2: avoid possible undefined behavior on empty string 2016-12-04 14:56:06 +00:00
moneromooo-monero 3f7d6fb57d Fix delayed exit when syncing 2016-12-04 12:27:45 +00:00
moneromooo-monero 7c0dd5e46c net_node: drop connections from banned IPs after looping through connections
This keeps the connections lock just for the time of looping
and adding connectoins to a list, and the dropping happens
after it. This should avoid lengthy delays waiting for the
connections lock.
2016-12-03 11:20:48 +00:00
moneromooo-monero 59443bf9df ringct: fix MGs serialization to JSON 2016-12-02 13:16:19 +00:00
moneromooo-monero 4adde0423b p2p: possibly fix crash in relay_blocks 2016-12-01 23:52:16 +00:00
moneromooo-monero 204b1bff62 blockchain: use high bound block reward on error where appropriate
If the block reward to use for the fee calculation can't be
calculated (should not happen in practice), use a high bound,
so we use a fee overestimate that will be accepted by the network.
2016-12-01 16:34:09 +00:00
moneromooo-monero 0e18f46522 db_lmdb: add info in an error message when we can't get an output
Will be useful to debug
2016-12-01 14:31:40 +00:00
moneromooo-monero c96f9b0255 db_lmdb: guard against going out of sync on unexpected db results
m_num_outputs keeps track of the number of outputs, which should
be the same as the size of both the output_txs and output_amounts
databases. If one goes out of sync, we need to throw to abort
whatever it is we were doing.
2016-12-01 14:29:35 +00:00
moneromooo-monero bef51e677e db_lmdb: minor pedantic tweaks
Add consts in a few places where it makes sense, avoid unnecessary
memory reallocation where we know the full size needed at the outset,
simplify and avoid memory copy.
2016-12-01 14:28:09 +00:00