Commit Graph
100 Commits
Author SHA1 Message Date
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
moneromooo-monero 3465c4ebc7 db_lmdb: set same packing format for output_data_t and pre_rct_output_data_t
For safety, though it seems to have been the case already.

Also add a comment about the necessary layout identity.
2016-12-01 14:26:18 +00:00
moneromooo-monero fcd178ef33 wallet_api: add a few daemon related getters
Blockchain height, version, Mining hash rate...
2016-11-29 10:54:38 +00:00
moneromooo-monero 8f6ec90c83 blockchain: reject invalid pubkeys from v4 2016-11-28 22:32:58 +00:00
moneromooo-monero 5783dd8c99 tests: add unit tests for uri parsing 2016-11-28 17:54:28 +00:00
moneromooo-monero 82ba2108e9 wallet: add API and RPC to create/parse monero: URIs 2016-11-28 17:54:22 +00:00
moneromooo-monero d9001b43ac epee: add functions to convert from URL format (ie, %XX values) 2016-11-28 17:54:16 +00:00
moneromooo-monero 8b0e04cb12 monero.supp: add a suppression for noisy boost cond var signalling 2016-11-28 09:52:59 +00:00
moneromooo-monero c3527dafd5 epee: signal cond var before unlocking
This is more canonical, and avoids some helgrind spam
2016-11-28 09:52:49 +00:00
moneromooo-monero 657a70e004 wallet: add a getter for the filename path 2016-11-26 14:19:57 +00:00
moneromooo-monero d6086f5b4e Improve daemon RPC version handling
Daemon RPC version is now composed of a major and minor number,
so that incompatible changes bump the major version, while
compatible changes can still bump the minor version without
causing clients to unnecessarily complain.
2016-11-26 12:56:44 +00:00
moneromooo-monero 17b6bd6d35 Fix DNS failures in offline mode preventing daemon startup 2016-11-23 23:14:49 +00:00
moneromooo-monero 6d76072612 simplewallet: remove double confirmation when submitting signed tx 2016-11-23 20:45:03 +00:00
moneromooo-monero 92dea04929 wallet2: fix wrong change being recorded for cold signed txes 2016-11-23 20:27:22 +00:00
moneromooo-monero 1d9e223944 rpc: do not include output indices for pool txes
Those aren't yet in the blockchain, so will not be found
(and aren't yet known, since it depends on where exactly the
tx will be mined in the next block or blocks)
2016-11-23 18:56:54 +00:00
moneromooo-monero e227d6e7ac rpc: bump version after RPC changes 2016-11-22 20:01:20 +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
moneromooo-monero e05907b3e7 rpc: add output indices to gettransactions
Someone apparently needs that to make a wallet but never asked.
If you read that and that's not what you wanted, the bugtracker
is at https://github.com/monero-project/monero/issues
2016-11-22 20:00:23 +00:00
moneromooo-monero ab7b56e0e2 tests: fix uninitialized data valgrind reports in levin tests 2016-11-20 17:51:17 +00:00
moneromooo-monero 73e8a76d86 tests: fix uninitialized data valgrind reports in serialization tests 2016-11-20 17:25:21 +00:00
moneromooo-monero 7abfc5474c wallet: fix exporting outputs and key images with txes with two pubkeys
This also needs to make sure to pick the correct one, in the case
where cold signing caused to tx keys to be included.
2016-11-19 09:36:40 +00:00
moneromooo-monero 5fc36f981c wallet2_api: fix history leak on destruction 2016-11-18 21:42:08 +00:00
moneromooo-monero 69b188c4b2 wallet2_api: fix payment ids from integrated addresses being ignored 2016-11-18 19:13:43 +00:00
moneromooo-monero 452aeca5cd epee: blind attempt to fix exit hang on windows
Thanks to duckduckgo and the internet.

This might even compile.
2016-11-17 22:10:03 +00:00
moneromooo-monero d01f5c7f1f wallet2: fix illegal memory access removing newlines from password 2016-11-17 20:43:58 +00:00
moneromooo-monero e6264a2c35 wallet2: fix decrypting a bit too much in authenticated mode 2016-11-17 20:31:00 +00:00
moneromooo-monero 4eb7347fdd wallet: return fee in transfer RPC 2016-11-16 18:56:45 +00:00
moneromooo-monero a0131c8be3 wallet: auto sync outputs and key images in cold signing files
When passing around unsigned and signed transactions, outputs
and key images are passed along (outputs are passed along unsigned
transactions from the hot wallet to the cold wallet, key images
are passed along with signed transations from the cold wallet
to the hot wallet), to allow more user friendly syncing between
hot and cold wallets.
2016-11-16 09:22:24 +00:00
moneromooo-monero f8066116dd wallet2: fill key image and pubkey maps when importing outputs 2016-11-16 09:22:18 +00:00
moneromooo-monero 5fe363cd22 wallet: cast indices to string in logs to be nice to CLANG 2016-11-16 09:22:13 +00:00
moneromooo-monero 11ae1873f8 wallet2: try all tx keys when scanning a new transaction
The vast majority of transactions will have just one tx pubkey,
but a bug with cold wallet signing caused two such keys to be
there, with the second one being the real one.
2016-11-16 09:22:05 +00:00
moneromooo-monero 072d646a45 wallet2: fill in key image map when importing key images 2016-11-15 21:20:08 +00:00