Compare commits

...

2541 Commits

Author SHA1 Message Date
moneromooo-monero
5675d48bd4 Update to 0.11.0.1 2017-10-22 14:39:48 +01:00
ston1th
44a2b23b98 added fix for #2699
added logging info for WRITEMAP

WRITEMAP loggin info - better version
2017-10-22 14:27:54 +01:00
moneromooo-monero
2a32a25fa0 simplewallet: add get/set for refresh-from-height 2017-10-22 11:20:26 +01:00
landergate
c23bddeb17 wallet2: Missing underflow check on low heights
Lack of it results in `m_refresh_from_block_height` being < 0 (18446744...) on low heights, which blocks `process_new_blockchain_entry` and never process coins on heights less than blocks_per_month.
Follow-up to #2258
2017-10-22 11:20:14 +01:00
moneromooo-monero
bb11c91412 core: fix failure to sync when a tx is already in the pool 2017-10-22 11:19:53 +01:00
moneromooo-monero
5fd259d1d4 Source updates are in a source subdirectory
rather than in the same directory as the prebuilt versions
2017-10-22 11:19:37 +01:00
moneromooo-monero
f4c56980ae blockchain: fix crash checking pre-validated txids 2017-10-22 11:19:20 +01:00
moneromooo-monero
ca1e2fec78 db_lmdb: fix use of uninitialized key in for_blocks_range 2017-10-22 11:19:01 +01:00
Riccardo Spagni
15b0ff2c32 Merge pull request #2448
8133a642 p2p: init hashes after deserializing a network address (moneromooo-monero)
2017-09-25 17:58:43 +02:00
moneromooo-monero
8133a64260 p2p: init hashes after deserializing a network address
Fixes multiple connections to the same address
2017-09-14 17:51:37 +01:00
Riccardo Spagni
373ce4ab09 Merge pull request #2437
3deef401 core: guard against exceptions in tx verification worker threads (moneromooo-monero)
2017-09-12 13:12:28 +02:00
Riccardo Spagni
60a293df79 Merge pull request #2433
67bdf65c rpc: get_txpool_backlog is now unrestricted (moneromooo-monero)
2017-09-12 13:12:10 +02:00
Riccardo Spagni
3fd08bd37e Merge pull request #2423
bbb07f88 ITS#8728 fix MDB_VL32 freeing overflow page (Howard Chu)
2017-09-12 13:10:43 +02:00
moneromooo-monero
3deef4018e core: guard against exceptions in tx verification worker threads 2017-09-12 12:07:45 +01:00
moneromooo-monero
67bdf65cbf rpc: get_txpool_backlog is now unrestricted 2017-09-11 14:39:48 +01:00
Howard Chu
bbb07f8847 ITS#8728 fix MDB_VL32 freeing overflow page
Fix #2420
2017-09-09 15:14:22 +01:00
Riccardo Spagni
fda88c8d28 Merge pull request #2406
64ab224c update checkpoint hashes (Riccardo Spagni)
2017-09-06 23:39:21 +02:00
Riccardo Spagni
64ab224c0e update checkpoint hashes 2017-09-06 17:34:14 +02:00
Riccardo Spagni
d0328d05b1 Merge pull request #2403
12b86e44 update hardcoded checkpoints (Riccardo Spagni)
21d0a40c update checkpoints.dat (Riccardo Spagni)
2017-09-06 09:52:45 +02:00
Riccardo Spagni
12b86e4402 update hardcoded checkpoints 2017-09-06 09:11:22 +02:00
Riccardo Spagni
21d0a40cff update checkpoints.dat 2017-09-06 09:08:43 +02:00
Riccardo Spagni
2f7358ef75 Merge pull request #2397
c6375a14 tx_pool: catch exceptions in LockedTXN dtor (moneromooo-monero)
2017-09-04 17:04:58 +02:00
Riccardo Spagni
da3930ccbb Merge pull request #2393
585e6b35 Add a --fluffy-blocks option to relay blocks as fluffy blocks (moneromooo-monero)
2017-09-04 17:04:45 +02:00
Riccardo Spagni
33485154d6 Merge pull request #2391
d685d5d9 Use latest height for fork date estimate (Howard Chu)
2017-09-04 17:04:02 +02:00
moneromooo-monero
c6375a14af tx_pool: catch exceptions in LockedTXN dtor
This might prevent some calls to terminate when the LockedTXN
dtor is called as part of stack unwinding caused by another
exception in the first place.
2017-09-04 10:18:07 +01:00
moneromooo-monero
585e6b35e6 Add a --fluffy-blocks option to relay blocks as fluffy blocks
Defaults to off, but fluffy blocks are forced enabled on testnet
2017-09-03 11:15:57 +01:00
Howard Chu
d685d5d987 Use latest height for fork date estimate 2017-09-02 11:49:31 +01:00
Riccardo Spagni
87d332df1a Merge pull request #2385
2289ead5 blockchain_import: warn for chunks over 500000, not 100000 (moneromooo-monero)
2f9a5528 blockchain_import: properly cleanup core/db on exit (moneromooo-monero)
8d6967be blockchain_import: do not error out on truncated files (moneromooo-monero)
2017-09-02 11:35:12 +02:00
Riccardo Spagni
6d78c6d2e4 Merge pull request #2383
c65062ad Fix miniupnpc CVE-2017-8798 (MaxXor)
2017-09-02 11:34:53 +02:00
Riccardo Spagni
677f1d43db Merge pull request #2375
ff1cdf30 tx_pool: wrap tx meta updates in a LockedTXN (moneromooo-monero)
2017-09-02 11:34:40 +02:00
Riccardo Spagni
7369d746fd Merge pull request #2373
a3662bae cryptonote_protocol: error handling on cleanup_handle_incoming_blocks (moneromooo-monero)
cf4aa653 Fix blockchain_import wedge on exception in cleanup_handle_incoming_blocks (moneromooo-monero)
0ffad5a3 core: guard against exceptions in handle_incoming_{block,tx} (moneromooo-monero)
2017-09-02 11:34:25 +02:00
Riccardo Spagni
aa680bf3c6 Merge pull request #2365
bf724327 cryptonote_protocol: remove old spans when received as old blocks (moneromooo-monero)
2017-09-02 11:34:06 +02:00
Riccardo Spagni
9b74395c4b Merge pull request #2363
31b1c6c1 simplewallet: new "fee" command to display fee information (moneromooo-monero)
2017-09-02 11:33:51 +02:00
Riccardo Spagni
e83666d9aa Merge pull request #2358
0c6c3eb3 Silence stupid fallthru warning in gcc 7 (Howard Chu)
2017-09-02 11:33:38 +02:00
moneromooo-monero
2289ead568 blockchain_import: warn for chunks over 500000, not 100000
We have a lot of 350000 byte blocks now.
2017-09-01 22:50:15 +01:00
moneromooo-monero
2f9a5528a7 blockchain_import: properly cleanup core/db on exit 2017-09-01 12:01:36 +01:00
moneromooo-monero
8d6967be39 blockchain_import: do not error out on truncated files
This will happen often when downloading from a live file
2017-09-01 12:01:33 +01:00
MaxXor
c65062ad5e Fix miniupnpc CVE-2017-8798 2017-09-01 09:38:31 +02:00
moneromooo-monero
ff1cdf30d7 tx_pool: wrap tx meta updates in a LockedTXN 2017-08-29 16:47:33 +01:00
moneromooo-monero
31b1c6c10d simplewallet: new "fee" command to display fee information
including expected transaction backlog at different priorities
2017-08-29 16:27:20 +01:00
moneromooo-monero
a3662baefb cryptonote_protocol: error handling on cleanup_handle_incoming_blocks 2017-08-29 16:10:53 +01:00
moneromooo-monero
cf4aa65316 Fix blockchain_import wedge on exception in cleanup_handle_incoming_blocks 2017-08-29 15:45:08 +01:00
moneromooo-monero
0ffad5a359 core: guard against exceptions in handle_incoming_{block,tx}
When one happens, cleanup must be called or the incoming tx
lock will stay locked
2017-08-29 13:03:54 +01:00
moneromooo-monero
bf72432734 cryptonote_protocol: remove old spans when received as old blocks
fixes getting those in a loop
2017-08-28 00:54:23 +01:00
Riccardo Spagni
d8f402ad8f Merge pull request #2343
c656dd0e Fix refresh counter display (Howard Chu)
c088d38a Simplify readline support (Howard Chu)
2017-08-26 23:45:50 +02:00
Riccardo Spagni
e75e41d07d Merge pull request #2319
c22d22e2 Cleanup test impact of adding safesyncmode() method (Howard Chu)
9a859844 Toggle SAFE syncmode on and off automatically (Howard Chu)
2017-08-26 23:45:38 +02:00
Riccardo Spagni
52af8c1582 Merge pull request #2318
3dd34a49 Cleanup test impact of moving blockchain_db_types() (Howard Chu)
80344740 More DB support cleanup (Howard Chu)
4c7f8ac0 DB cleanup (Howard Chu)
2017-08-26 23:45:25 +02:00
Riccardo Spagni
97864d454f Merge pull request #2356
4bd9e247 wallet: new option to check/confirm txpool backlog when sending (moneromooo-monero)
0c61be37 rpc: add a new RPC to get current txpool backlog (sizes and fees) (moneromooo-monero)
2017-08-26 23:34:10 +02:00
Riccardo Spagni
19cdd10750 Merge pull request #2354
aeb30c83 daemon: fix backlog estimating at max block size (moneromooo-monero)
2017-08-26 23:33:55 +02:00
Riccardo Spagni
8ee10e707b Merge pull request #2352
2d8a6a6f blockchain: cap memory size of retrieved blocks (moneromooo-monero)
20bedf32 rpc: decrease memory usage a bit in getblocks.bin (moneromooo-monero)
2017-08-26 23:33:40 +02:00
Riccardo Spagni
fd1faac2e0 Merge pull request #2350
fa65da25 http_client: add getters for host and port (moneromooo-monero)
2017-08-26 23:33:07 +02:00
moneromooo-monero
2d8a6a6f0c blockchain: cap memory size of retrieved blocks
It helps keep memory usage down when a wallet refreshes through
a string of large blocks
2017-08-26 20:54:38 +01:00
moneromooo-monero
20bedf320e rpc: decrease memory usage a bit in getblocks.bin 2017-08-26 20:54:35 +01:00
moneromooo-monero
4bd9e247a2 wallet: new option to check/confirm txpool backlog when sending 2017-08-26 17:18:14 +01:00
moneromooo-monero
0c61be37d4 rpc: add a new RPC to get current txpool backlog (sizes and fees) 2017-08-26 17:18:11 +01:00
moneromooo-monero
aeb30c8381 daemon: fix backlog estimating at max block size
Block size will pretty much never be fully used, unless all txes
are using max fee.
2017-08-26 17:14:04 +01:00
moneromooo-monero
fa65da25c9 http_client: add getters for host and port 2017-08-25 23:28:07 +01:00
Riccardo Spagni
0fe4b0282a Merge pull request #2339
df0cffed cryptonote_protocol: warn if we see a higher top version we expect (moneromooo-monero)
317ab21a cryptonote_protocol: less strict check on top version on connect (moneromooo-monero)
cc81a371 cryptonote_protocol: update target height when syncing too (moneromooo-monero)
e2ad372b cryptonote_protocol: simplify and remove unnecessary casts (moneromooo-monero)
727e67ca cryptonote_protocol: print peer top height along with its version (moneromooo-monero)
b5345ef4 crypto: use malloc instead of alloca (moneromooo-monero)
80794b31 thread_group: set thread size to THREAD_STACK_SIZE (moneromooo-monero)
5524bc31 print peer id in 0 padded hex for consistency (moneromooo-monero)
8f8cc09b contrib: add sync_info to rlwrap command set (moneromooo-monero)
70b8c6d7 cryptonote_protocol: misc fixes to the new sync algorithm (moneromooo-monero)
2017-08-25 00:24:52 +02:00
Riccardo Spagni
0debbb20a0 Merge pull request #2337
6707f0af daemon: print estimated tx backlog in print_pool_stats (moneromooo-monero)
2017-08-25 00:24:38 +02:00
Riccardo Spagni
12a77ba868 Merge pull request #2336
2392c4c4 rpc_client: print destination host/port when failing to connect (moneromooo-monero)
2017-08-25 00:24:25 +02:00
Riccardo Spagni
b09e170344 Merge pull request #2331
ea15e72d tx_pool: fix crash in stats (Howard Chu)
2017-08-25 00:24:10 +02:00
Riccardo Spagni
2cafbb701a Merge pull request #2335
2147859a core: add mainnet v6 fork height at 1400000 (moneromooo-monero)
2017-08-25 00:23:50 +02:00
moneromooo-monero
6707f0afce daemon: print estimated tx backlog in print_pool_stats 2017-08-23 21:33:13 +01:00
moneromooo-monero
2392c4c41e rpc_client: print destination host/port when failing to connect 2017-08-23 21:31:44 +01:00
moneromooo-monero
2147859ac9 core: add mainnet v6 fork height at 1400000 2017-08-23 21:09:26 +01:00
Howard Chu
ea15e72d73 tx_pool: fix crash in stats
if tx receive_time == now. supersedes #2322
2017-08-23 14:22:25 +01:00
moneromooo-monero
df0cffede0 cryptonote_protocol: warn if we see a higher top version we expect 2017-08-23 13:38:18 +01:00
moneromooo-monero
317ab21a03 cryptonote_protocol: less strict check on top version on connect
This allows peers who synced past a fork on the wrong height
to reorg to the right chain after they updated their software
to include the new version.
2017-08-23 13:38:15 +01:00
moneromooo-monero
cc81a37155 cryptonote_protocol: update target height when syncing too 2017-08-23 13:38:13 +01:00
moneromooo-monero
e2ad372b87 cryptonote_protocol: simplify and remove unnecessary casts 2017-08-23 13:38:10 +01:00
moneromooo-monero
727e67cada cryptonote_protocol: print peer top height along with its version 2017-08-23 13:38:06 +01:00
moneromooo-monero
b5345ef4f0 crypto: use malloc instead of alloca 2017-08-23 13:38:03 +01:00
moneromooo-monero
80794b3114 thread_group: set thread size to THREAD_STACK_SIZE 2017-08-23 13:38:00 +01:00
moneromooo-monero
5524bc3151 print peer id in 0 padded hex for consistency 2017-08-23 13:37:56 +01:00
Howard Chu
3dd34a49ef Cleanup test impact of moving blockchain_db_types() 2017-08-22 15:11:28 +01:00
Howard Chu
c22d22e2db Cleanup test impact of adding safesyncmode() method 2017-08-22 15:11:09 +01:00
moneromooo-monero
8f8cc09ba1 contrib: add sync_info to rlwrap command set 2017-08-22 11:40:41 +01:00
Howard Chu
c656dd0ede Fix refresh counter display
Suspend readline when refreshing
2017-08-22 08:30:04 +01:00
Howard Chu
c088d38a57 Simplify readline support
And don't use std::mutex
2017-08-22 08:30:04 +01:00
moneromooo-monero
70b8c6d77a cryptonote_protocol: misc fixes to the new sync algorithm
Fix sync wedge corner case:
It could happen if a connection went into standby mode, while
it was the one which had requested the next span, and that span
was still waiting for the data, and that peer is not on the
main chain. Other peers can then start asking for that data
again and again, but never get it as only that forked peer does.

And various other fixes
2017-08-21 21:57:19 +01:00
Howard Chu
0c6c3eb3f2 Silence stupid fallthru warning in gcc 7 2017-08-21 10:16:10 +01:00
Howard Chu
9a859844f4 Toggle SAFE syncmode on and off automatically
If monerod is started with default sync mode, set it to SAFE after
synchronization completes. Set it back to FAST if synchronization
restarts (e.g. because another peer has a longer blockchain).

If monerod is started with an explicit sync mode, none of this
automation takes effect.
2017-08-20 16:30:28 +01:00
Howard Chu
80344740bd More DB support cleanup
Hide DB types from db_types.h - no reason to recompile dependencies
when DB types change.

Also remove lingering in-memory DB references, they've been
obsolete since 9e82b694da
2017-08-20 13:57:36 +01:00
Howard Chu
4c7f8ac04f DB cleanup
Hide LMDB-specific stuff behind blockchain_db.h. Nobody besides blockchain_db.cpp
should ever be including DB-specific headers any more.
2017-08-19 18:11:38 +01:00
Riccardo Spagni
4466b6d1b0 Merge pull request #2303
5a283078 cryptonote_protocol: large block sync size before v4 (moneromooo-monero)
7b747607 cryptonote_protocol: kick idle synchronizing peers (moneromooo-monero)
2017-08-17 21:39:44 +02:00
Riccardo Spagni
0d15fab49a Merge pull request #2301
1249a2a5 Construct on first use for completion_commands (Jethro Grassie)
67dd4933 Add sync lock on stop (Jethro Grassie)
2017-08-17 21:36:36 +02:00
Riccardo Spagni
4859a00134 Merge pull request #2300
42b34b35 Consistently print peer id in hex and on 16 chars (moneromooo-monero)
2017-08-17 21:36:15 +02:00
Riccardo Spagni
1d32a5a445 Merge pull request #2291
b59cd074 befor -> before (Nano Akron)
2017-08-17 21:35:48 +02:00
Riccardo Spagni
4b2cc123ff Merge pull request #2287
827afcb7 protocol: pass blockchain cumulative difficulty when syncing (moneromooo-monero)
2017-08-17 21:35:02 +02:00
moneromooo-monero
5a283078ec cryptonote_protocol: large block sync size before v4 2017-08-17 13:11:52 +01:00
moneromooo-monero
7b74760756 cryptonote_protocol: kick idle synchronizing peers
In case they dropped off downloading for any reason, they'll get
sent to download again.
2017-08-16 22:24:50 +01:00
Jethro Grassie
1249a2a550 Construct on first use for completion_commands 2017-08-16 09:34:32 -04:00
Jethro Grassie
67dd4933e6 Add sync lock on stop
Also added and moved two free's hoping to fix leaks.
2017-08-16 08:58:12 -04:00
moneromooo-monero
42b34b3545 Consistently print peer id in hex and on 16 chars 2017-08-16 10:56:55 +01:00
Nano Akron
b59cd0745b befor -> before
Really unique yet consistent spelling mistake
2017-08-15 23:23:26 +01:00
moneromooo-monero
827afcb7ea protocol: pass blockchain cumulative difficulty when syncing
Not used yet.
2017-08-15 21:03:37 +01:00
Riccardo Spagni
d0a610183a Merge pull request #2297
78ecb2ad update major version number (Riccardo Spagni)
2017-08-15 21:12:25 +02:00
Riccardo Spagni
78ecb2ad0b update major version number 2017-08-15 21:04:37 +02:00
Riccardo Spagni
3ff67323b7 Merge pull request #2288
c6e200a8 core: add --db-salvage command line flag (moneromooo-monero)
2017-08-15 20:57:26 +02:00
Riccardo Spagni
061930d6b4 Merge pull request #2293
dee41efa simplewallet: mnemonic language command-line arg (Eugene Otto)
2017-08-15 20:57:09 +02:00
Riccardo Spagni
124cbe3cf3 Merge pull request #2292
cb2d5ac7 mnemonics: new Esperanto word list (moneromooo-monero)
2017-08-15 20:56:49 +02:00
Riccardo Spagni
9e6bcbc014 Merge pull request #2286
8655ba04 wallet_rpc_server: adjust small ring sizes to 5 for v6 (moneromooo-monero)
2017-08-15 20:55:30 +02:00
Riccardo Spagni
fa0c168947 Merge pull request #2285
9c6eb75c ITS#8704 add MDB_PREVSNAPSHOT flag to mdb_env_open (Howard Chu)
2017-08-15 20:55:15 +02:00
Riccardo Spagni
7b14a96c03 Merge pull request #2283
d1f204d6 miner: set thread name before logging (moneromooo-monero)
2017-08-15 20:54:53 +02:00
Riccardo Spagni
4bfb58328d Merge pull request #2282
7fdc178a p2p: fix random peer index being too large (moneromooo-monero)
2017-08-15 20:54:38 +02:00
Riccardo Spagni
e457cc7891 Merge pull request #2281
e499ff33 simplewallet: factor out message_writer (moneromooo-monero)
7ed5ab47 scoped_message_writer: pause readline to match simplewallet (moneromooo-monero)
2017-08-15 20:54:21 +02:00
Riccardo Spagni
a861cbb465 Merge pull request #2279
359517c7 wallet_rpc_server: fix possible privacy leak in on_import_key_images() (Jaquee)
20495b27 simplewallet: fix possible privacy leak in import_key_images() (Jaquee)
2017-08-15 20:53:58 +02:00
Riccardo Spagni
53dde37ceb Merge pull request #2276
a1891ebe tests: fix tests build (moneromooo-monero)
2017-08-15 20:53:41 +02:00
Riccardo Spagni
f980b2ca89 Merge pull request #2277
6ce769c1 p2p: get net log spam down a bit (moneromooo-monero)
2017-08-15 20:53:27 +02:00
Riccardo Spagni
86cf8cac86 Merge pull request #2275
88e83f94 cryptonote_protocol_handler: log versions as unsigned ints (moneromooo-monero)
2017-08-15 20:53:08 +02:00
Riccardo Spagni
74522c7e84 Merge pull request #2236
cb2d5110 Tweak net logs so we get more info on why networking can't start (moneromooo-monero)
2017-08-15 20:52:44 +02:00
Riccardo Spagni
fa73d6cbf1 Merge pull request #2274
7591c528 p2p: fallback on seed nodes if we can't make a connection (moneromooo-monero)
2017-08-15 20:52:04 +02:00
Riccardo Spagni
1d093eff67 Merge pull request #2273
0e8d60c0 cryptonote_protocol: fix recv/send idle time before handshake (moneromooo-monero)
2017-08-15 20:51:50 +02:00
Riccardo Spagni
e0df740bc9 Merge pull request #2272
f90bbe2a cryptonote_protocol: keep target in sync with dropped connections (moneromooo-monero)
2017-08-15 20:51:35 +02:00
Riccardo Spagni
b6fc7f283f Merge pull request #2270
1307e3cc WalletAPI: add getDefaultDataDir() (Jaquee)
2017-08-15 20:51:11 +02:00
Riccardo Spagni
1b54bcdc08 Merge pull request #2266
7007bd14 Change default block sync size from 200 to 20 (moneromooo-monero)
2017-08-15 20:50:44 +02:00
Riccardo Spagni
973cc7ffdf Merge pull request #2264
980e476c cryptonote_basic: fix silly CLANG warning about not emitting function (moneromooo-monero)
2017-08-15 20:50:27 +02:00
Riccardo Spagni
9721b37bd5 Merge pull request #2258
74597bd1 wallet2: improve refresh height determination (moneromooo-monero)
2017-08-15 20:49:56 +02:00
Riccardo Spagni
718941bee0 Merge pull request #2256
042b86c4 simplewallet: do not ask wallet filename twice when restoring (moneromooo-monero)
2017-08-15 20:49:26 +02:00
moneromooo-monero
cb2d5110ff Tweak net logs so we get more info on why networking can't start
This should prevent "silent" failures to start
2017-08-15 19:49:25 +01:00
Riccardo Spagni
85211cda22 Merge pull request #2255
8bbed275 simplewallet: Be explicit about secret keys (Erik de Castro Lopo)
2017-08-15 20:49:10 +02:00
Riccardo Spagni
170526dc02 Merge pull request #2253
51ebedb8 epee: remove a couple unused locals (moneromooo-monero)
2017-08-15 20:48:45 +02:00
Riccardo Spagni
085ef96768 Merge pull request #2252
9707998a wallet2: clear some missing containers in clear() (moneromooo-monero)
2017-08-15 20:48:31 +02:00
Riccardo Spagni
79479a3614 Merge pull request #2250
f4f7eeba blockchain: log more info when we reject an orphan (moneromooo-monero)
2017-08-15 20:48:08 +02:00
Riccardo Spagni
5ee3798da3 Merge pull request #2248
71e28760 debug_utilities: only build for debug builds (moneromooo-monero)
55e150ff debug_utilities: new object-sizes debug tool (moneromooo-monero)
fbaf5375 cn_deserialize: move to new debug_utilities subdirectory (moneromooo-monero)
2017-08-15 20:47:49 +02:00
Riccardo Spagni
12c70fedc0 Merge pull request #2246
d732c73e blockchain: remove a few unused variables (moneromooo-monero)
2017-08-15 20:47:32 +02:00
Riccardo Spagni
e5a1628c88 Merge pull request #2245
c8640a3d difficulty: fix misleading comment (Guillaume LE VAILLANT)
2017-08-15 20:46:48 +02:00
Riccardo Spagni
6f60613ffb Merge pull request #2240
b7d6ec83 simplewallet: add (out of sync) or (no daemon) markers in the prompt (moneromooo-monero)
fa23a500 wallet2: add a is_synced function (moneromooo-monero)
f1307bbd node_rpc_proxy: add a proxy for target height (moneromooo-monero)
2017-08-15 20:46:31 +02:00
Riccardo Spagni
4c24eb050b Merge pull request #2238
ad4649ac Enable verifying wallet password with having to load wallet. (m2049r)
2017-08-15 20:46:09 +02:00
Riccardo Spagni
1cf4665d2a Merge pull request #2237
5d4ef719 core: speed up output index unique set calculation (moneromooo-monero)
19d7f568 perf_timer: allow profiling more granular than millisecond (moneromooo-monero)
bda8c598 epee: add nanosecond timer and pause/restart profiling macros (moneromooo-monero)
2017-08-15 20:45:47 +02:00
Riccardo Spagni
d64b9c1c9e Merge pull request #2233
67ce4910 wallet2: store testnet bool in keys file (Jaquee)
2017-08-15 20:45:19 +02:00
Riccardo Spagni
da2c662cf2 Merge pull request #2232
87b5ede9 miner: fix ignoring battery from command line (moneromooo-monero)
2017-08-15 20:45:02 +02:00
Riccardo Spagni
68ccc10b29 Merge pull request #2205
c97d1bd3 wallet: return unlock_time in get_transfers (moneromooo-monero)
2017-08-15 20:44:44 +02:00
Riccardo Spagni
c1f651175a Merge pull request #2295
35e01a6e cryptonote_protocol: fix "holes" in block download schedule (moneromooo-monero)
3da1edfd cryptonote_protocol: fix out of order addition (moneromooo-monero)
6edb1b3e block_queue: do not add empty spans (moneromooo-monero)
2017-08-15 20:42:47 +02:00
moneromooo-monero
35e01a6e50 cryptonote_protocol: fix "holes" in block download schedule 2017-08-15 17:49:06 +01:00
moneromooo-monero
3da1edfde5 cryptonote_protocol: fix out of order addition
This was broken by the reorg fix, since we now have to add blocks
regardless of their starting height. We now check whether we know
the parent for the first block in the next span, or whether it was
requested. If neither, it's an orphan. If it is not known, but was
requested, we wait to get that block.
2017-08-15 16:54:08 +01:00
moneromooo-monero
6edb1b3e46 block_queue: do not add empty spans 2017-08-15 11:38:59 +01:00
moneromooo-monero
cb2d5ac788 mnemonics: new Esperanto word list
Word list authored by: Engelberg, ProkhorZ
Sources:
  Baza Radikaro Oficiala
  Reta Vortaro (http://www.reta-vortaro.de/revo/)
  Esperanto Panorama - Esperanto-English Dictionary (http://www.esperanto-panorama.net/vortaro/eoen.htm)
  ESPDIC - Paul Denisowski (http://www.denisowski.org/Esperanto/ESPDIC/espdic.txt)
2017-08-14 17:46:46 +01:00
Eugene Otto
dee41efa20 simplewallet: mnemonic language command-line arg
Add `--mnemonic-language` command-line arg so it's possible to generate a wallet
without interacting with the CLI.
2017-08-13 20:00:25 -07:00
Riccardo Spagni
70495665f9 Merge pull request #2284
2ec15a69 daemon: print peers' top height in sync_info (moneromooo-monero)
08abb670 protocol: fix reorgs while syncing (moneromooo-monero)
2017-08-13 15:59:30 +02:00
moneromooo-monero
2ec15a6931 daemon: print peers' top height in sync_info 2017-08-12 20:36:31 +01:00
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
8655ba04ba wallet_rpc_server: adjust small ring sizes to 5 for v6 2017-08-12 12:59:06 +01:00
Howard Chu
9c6eb75c65 ITS#8704 add MDB_PREVSNAPSHOT flag to mdb_env_open
used to open the previous snapshot, in case the latest one
is corrupted
2017-08-12 12:21:25 +01:00
moneromooo-monero
88e83f9427 cryptonote_protocol_handler: log versions as unsigned ints
They're interpreted as characters otherwise
2017-08-12 11:57:05 +01:00
moneromooo-monero
08abb670e1 protocol: fix reorgs while syncing 2017-08-12 11:22:42 +01:00
moneromooo-monero
d1f204d640 miner: set thread name before logging 2017-08-12 09:07:40 +01:00
moneromooo-monero
7fdc178abb p2p: fix random peer index being too large 2017-08-11 14:29:55 +01:00
moneromooo-monero
e499ff3322 simplewallet: factor out message_writer 2017-08-11 13:38:42 +01:00
moneromooo-monero
7ed5ab47ea scoped_message_writer: pause readline to match simplewallet 2017-08-11 13:38:18 +01:00
Jaquee
359517c7f5 wallet_rpc_server: fix possible privacy leak in on_import_key_images() 2017-08-11 11:18:21 +02:00
Jaquee
20495b27e8 simplewallet: fix possible privacy leak in import_key_images() 2017-08-11 11:16:30 +02:00
moneromooo-monero
6ce769c123 p2p: get net log spam down a bit 2017-08-10 14:30:42 +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
moneromooo-monero
7591c528d0 p2p: fallback on seed nodes if we can't make a connection
This avoids failing to connect to the network in case all
known peers are unavailable (which can happen if the peer
list is small).
2017-08-09 22:55:25 +01:00
moneromooo-monero
0e8d60c06c cryptonote_protocol: fix recv/send idle time before handshake 2017-08-09 21:22:05 +01:00
moneromooo-monero
f90bbe2a5c cryptonote_protocol: keep target in sync with dropped connections
When a node is dropped, we stop considering its claimed blockchain
height as a factor in the target height calculation. This prevents
a runaway chain from being still thought to be the target even if
the nodes carrying it are dropped.
2017-08-09 20:49:24 +01:00
Riccardo Spagni
181a008aa3 Merge pull request #2271
3ff5ce63 connection_context: initialize state (moneromooo-monero)
2017-08-09 20:23:17 +02:00
moneromooo-monero
3ff5ce63c5 connection_context: initialize state
Why this was initialized properly before I have no idea, but
it is not anymore. Fix it, which fixes syncing in release mode.
2017-08-09 19:01:27 +01:00
Riccardo Spagni
f43d59d8b3 Merge pull request #2269
635929ea protocol: add checks for top block hard fork version (moneromooo-monero)
7482253a epee: fixup KV_SERIALIZE_OPT to work in more cases (moneromooo-monero)
2017-08-09 14:58:11 +02:00
Jaquee
1307e3cc12 WalletAPI: add getDefaultDataDir() 2017-08-09 12:38:29 +02:00
moneromooo-monero
635929eaca protocol: add checks for top block hard fork version
We won't even talk to a peer which claims a wrong version
for its top block. This will avoid syncing to known bad
peers in the first place.
Also add IP fails when failing to verify a block.
2017-08-09 10:28:41 +01:00
moneromooo-monero
7482253a6d epee: fixup KV_SERIALIZE_OPT to work in more cases 2017-08-09 09:30:22 +01:00
Riccardo Spagni
b3d595582a Merge pull request #2267
e49f6d43 net_node: fix m_in_timedsync initialization (moneromooo-monero)
2017-08-09 09:21:22 +02:00
moneromooo-monero
e49f6d439d net_node: fix m_in_timedsync initialization
This fixes nodes not being able to connect to nodes which use
recent code. While there, init peer_id too.
2017-08-08 17:23:02 +01:00
moneromooo-monero
7007bd1489 Change default block sync size from 200 to 20
With the new sync algorithm, the network overhead will be masked
as the thread adding blocks isn't interrupted by network calls
anymore. This should reduce memory usage a lot during sync.
2017-08-08 11:05:11 +01:00
moneromooo-monero
980e476c89 cryptonote_basic: fix silly CLANG warning about not emitting function 2017-08-08 00:33:52 +01:00
Riccardo Spagni
bfd2532ea5 Merge pull request #2247
a839a6fa Wallet API: add tx unlock time (Jaquee)
2017-08-07 23:34:06 +02:00
Riccardo Spagni
86226754a9 Merge pull request #2263
49ffb156 cmake: do not use GREATER_EQUAL, it's too new (moneromooo-monero)
2017-08-07 22:53:39 +02:00
Riccardo Spagni
bff9fb9c8b Merge pull request #2231
61770ec2 change mixin to ring size in user visible places (moneromooo-monero)
2017-08-07 22:53:15 +02:00
moneromooo-monero
49ffb156f0 cmake: do not use GREATER_EQUAL, it's too new 2017-08-07 21:37:13 +01:00
moneromooo-monero
61770ec2da change mixin to ring size in user visible places 2017-08-07 21:12:27 +01:00
Riccardo Spagni
14f479bb9c Merge pull request #2262
7f7d42f8 core: fix invalid memory access creating tx (moneromooo-monero)
2017-08-07 22:11:45 +02: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
Riccardo Spagni
f09156eb65 Merge pull request #2224
04bd1925 cmake: Update detection of external miniupnpc (Erik de Castro Lopo)
2017-08-07 22:09:42 +02:00
moneromooo-monero
7f7d42f890 core: fix invalid memory access creating tx 2017-08-07 21:09:19 +01:00
Riccardo Spagni
a796cb341e Merge pull request #2207
c93b7692 blockchain_import: much faster when verifying with cryptonote::core (moneromooo-monero)
38756d00 core: new API to disable DNS checkpoint lookups (moneromooo-monero)
2017-08-07 21:40:32 +02:00
Riccardo Spagni
3db039828e Merge pull request #2254
e31aac80 walletAPI: add getRefreshFromBlockHeight() (Jaquee)
48c0cb1b wallet api: pause refresh while commiting tx (Jaquee)
f233c01c CMakeLists.txt - ios/xcode fix (Jaquee)
2017-08-07 16:01:40 +02:00
Riccardo Spagni
9fc78023e2 Merge pull request #2259
569b9b2b updates: add "misc_log_ex.h" for logs (moneromooo-monero)
74628941 dns_utils: add <functional> for std::function (moneromooo-monero)
2017-08-07 16:01:22 +02:00
moneromooo-monero
569b9b2b50 updates: add "misc_log_ex.h" for logs 2017-08-07 14:42:08 +01:00
moneromooo-monero
74628941d5 dns_utils: add <functional> for std::function 2017-08-07 14:35:41 +01:00
moneromooo-monero
c93b7692b4 blockchain_import: much faster when verifying with cryptonote::core
Quick test with the first 56569 blocks from mainnet

version verify  batch   time
old     0       200     1:16
new     0       200     0:57
old     0       5000    0:53
new     0       5000    0:51
old     1       200     est > 1h
new     1       200     10:21
old     1       5000    est > 1h
new     1       5000    8:27
2017-08-07 14:32:49 +01:00
moneromooo-monero
38756d00ff core: new API to disable DNS checkpoint lookups 2017-08-07 14:31:06 +01:00
Riccardo Spagni
c63e9633b5 Merge pull request #2218
02f13d6c Fix handling of strings & simplify summation of spendkeys (JollyMort)
40fc9d7b Add option to join multisig wallet pieces together (JollyMort)
2017-08-07 15:28:17 +02:00
Riccardo Spagni
0bab692eee Merge pull request #2194
380009e5 README: give credit where credit is due (moneromooo-monero)
2017-08-07 15:26:26 +02:00
Riccardo Spagni
b76ba219d9 Merge pull request #2189
335fc8ab mlog: fix crash accessing stale data when rotating logs (moneromooo-monero)
2017-08-07 15:25:46 +02: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
a4151bed58 Merge pull request #2138
044c5b55 Readme: add android docker build instruction (MoroccanMalinois)
82836be4 Utils: Add dockerfile for android NDK build (MoroccanMalinois)
2017-08-07 15:21:01 +02:00
Riccardo Spagni
0dc892a538 Merge pull request #2126
98cb3fee italian translation (erciccione)
ff07cdc9 updates monero_fr.ts (erciccione)
f675fedc updates monero.ts (erciccione)
2017-08-07 15:18:04 +02:00
Riccardo Spagni
05c44db23b Merge pull request #2244
328bebbe daemon: some more include cleanup (moneromooo-monero)
2017-08-07 15:14:12 +02:00
Riccardo Spagni
dc2747439c Merge pull request #2243
4d873046 blockchain: add testnet v6 fork height at 971400 (moneromooo-monero)
2017-08-07 15:13:59 +02:00
Riccardo Spagni
b1af32b48d Merge pull request #2242
1c9196b0 cryptonote_protocol: fix days behind calc on testnet (moneromooo-monero)
2017-08-07 15:13:45 +02:00
Riccardo Spagni
15e895399c Merge pull request #2239
600353e2 fix wallet callback signatures (m2049r)
2017-08-07 15:13:30 +02:00
Riccardo Spagni
ea46a5527a Merge pull request #2234
214fd81e some include cleanup (moneromooo-monero)
2017-08-07 15:13:07 +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
Riccardo Spagni
5cc53c7e49 Merge pull request #2226
14ec6ed8 tx_pool: remove obsolete unused m_config_folder field (moneromooo-monero)
2017-08-07 15:12:29 +02:00
Riccardo Spagni
1ea75abd72 Merge pull request #2223
d37e8f88 daemon: add average seconds per block in bc_dyn_stats (moneromooo-monero)
2017-08-07 15:12:15 +02:00
Riccardo Spagni
a2dd125b1e Merge pull request #2222
878205f1 core: fix lock ordering bug at init time (moneromooo-monero)
2017-08-07 15:11:51 +02:00
Riccardo Spagni
9b0daf49db Merge pull request #2220
c6ba7d11 p2p: move m_in_timedsync from connection_context to p2p_connection_context (moneromooo-monero)
2017-08-07 15:11:37 +02:00
Riccardo Spagni
43c6e452fa Merge pull request #2219
04ebfbfe p2p: close connections when exiting (moneromooo-monero)
9a10148c p2p: fix thread leak (moneromooo-monero)
2017-08-07 15:11:20 +02:00
Riccardo Spagni
8048de268a Merge pull request #2216
d8becf2e blockchain: fix cryptonight buffer leak on exit (moneromooo-monero)
91aa90fc blockchain: ensure all blocks get their longhash precalculated (moneromooo-monero)
ff4bcaed blockchain: pass correct height to get_block_longhash (moneromooo-monero)
2017-08-07 15:11:04 +02:00
Riccardo Spagni
a6ea26e7fa Merge pull request #2215
06aea2cf move get_proof_of_trust_hash from util.h to p2p_protocol_defs.h (moneromooo-monero)
2017-08-07 15:10:42 +02:00
Riccardo Spagni
a963da9001 Merge pull request #2214
41f935dd network_throttle: remove unneeded heap allocations (moneromooo-monero)
2017-08-07 15:10:27 +02:00
Riccardo Spagni
1e2d6f898e Merge pull request #2211
525975ac wallet-cli: Minor improvement to help output (Erik de Castro Lopo)
2017-08-07 15:10:13 +02:00
Riccardo Spagni
f5be5b7e7b Merge pull request #2210
cb0b5594 Move OpenAlias console input back from libs (moneromooo-monero)
2017-08-07 15:09:45 +02:00
Riccardo Spagni
61ac6983f2 Merge pull request #2206
340feede core: randomly shuffle outputs (moneromooo-monero)
2017-08-07 15:09:31 +02:00
Riccardo Spagni
24dd5e87af Merge pull request #2203
0c57df97 wallet2: fix temporarily missing incoming tx when being mined (moneromooo-monero)
2017-08-07 15:09:17 +02:00
Riccardo Spagni
5a04301b32 Merge pull request #2201
dc0b312f wallet_rpc_server: optionally return tx blobs on transfer calls (moneromooo-monero)
5eb79983 epee: add a KV_SERIALIZE variant for optional parameters (moneromooo-monero)
2017-08-07 15:09:03 +02:00
Riccardo Spagni
58621e3f65 Merge pull request #2200
f1b76c84 cryptonote_protocol: Set send_idle_time in connection_info correctly (rbrunner7)
2017-08-07 15:08:49 +02:00
Riccardo Spagni
0f36efbded Merge pull request #2198
53af9768 blockchain: one off warning when seeing a block with unknown version (moneromooo-monero)
2017-08-07 15:08:31 +02:00
Riccardo Spagni
5ef8b76b32 Merge pull request #2197
d75cff1a Fix readline prompt when command does not output (Jethro Grassie)
2017-08-07 15:08:17 +02:00
Riccardo Spagni
52b33b5284 Merge pull request #2196
16a55347 simplewallet: show payment ids on sign_transfer (moneromooo-monero)
2017-08-07 15:08:00 +02:00
Riccardo Spagni
b6ae718456 Merge pull request #2195
599436a4 mlog: default to msgwriter logs only for log level 1 (moneromooo-monero)
58f3fc68 Make msgwriter logs go to file only (moneromooo-monero)
2017-08-07 15:07:46 +02:00
Riccardo Spagni
8494ffbc37 Merge pull request #2191
23909bb0 Make successful transfer log message more informative (JollyMort)
2017-08-07 15:07:33 +02:00
Riccardo Spagni
cf308cfb20 Merge pull request #2188
a5031a7d core: forbid duplicate ring members from v6 (moneromooo-monero)
2017-08-07 15:07:16 +02:00
Riccardo Spagni
64ebeb5aa5 Merge pull request #2182
2fac03e6 Update monerod systemd service file (Erik de Castro Lopo)
51efb217 daemon: Add ability to write a PID file (Erik de Castro Lopo)
2017-08-07 15:06:59 +02:00
Riccardo Spagni
6244c782de Merge pull request #2151
13a8d64f epee: don't send the body of the response to a HEAD HTTP request (Guillaume LE VAILLANT)
2017-08-07 15:06:45 +02:00
Riccardo Spagni
04591af7fd Merge pull request #2153
35d68b2c Fix spelling errors (Erik de Castro Lopo)
2017-08-07 14:49:15 +02:00
Riccardo Spagni
f6ee93e214 Merge pull request #2148
125f823b Add on_get_alt_blocks_hashes RPC call (moneroexamples)
2017-08-07 14:48:38 +02:00
Riccardo Spagni
ce52d94cb7 Merge pull request #2147
94717021 fix on_battery_power for linux (Ryan Mehta)
2017-08-07 14:47:43 +02:00
Riccardo Spagni
54b15447d4 Merge pull request #2141
94dd5cb4 Makefile: Add debug-static-all target (Erik de Castro Lopo)
2017-08-07 14:46:56 +02:00
Riccardo Spagni
159a6e9669 Merge pull request #2132
464afd4d Ensure DNSResolver destructor runs on exit (Howard Chu)
2017-08-07 14:46:26 +02:00
moneromooo-monero
4d87304683 blockchain: add testnet v6 fork height at 971400 2017-08-07 11:34:59 +01:00
moneromooo-monero
158c3ecff3 core: thread most of handle_incoming_tx 2017-08-07 09:33:20 +01:00
moneromooo-monero
f57ee382b8 cryptonote_protocol: retry stale spans early
Connections can be dropped by the net_node layer,
unbeknownst to cryptonote_protocol, which would then
not flush any spans scheduled to that connection,
which would cause it to be only downloaded again
once it becomes the next span (possibly after a small
delay if it had been requested less than 5 seconds
ago).
2017-08-07 09:33:17 +01:00
moneromooo-monero
90df52e12f cryptonote_protocol: light cleanup 2017-08-07 09:33:14 +01:00
moneromooo-monero
84e23156ac cryptonote_protocol: avoid spurious SYNCHRONIZED OK messages 2017-08-07 09:33:09 +01:00
moneromooo-monero
5be43fcdba cryptonote_protocol_handler: sync speedup
A block queue is now placed between block download and
block processing. Blocks are now requested only from one
peer (unless starved).

Includes a new sync_info coommand.
2017-08-07 09:33:04 +01:00
moneromooo-monero
74597bd15a wallet2: improve refresh height determination
As reported by jaquee, the calculation could underflow for very
low heights.
Additionally, we now use the target height too.
2017-08-06 16:56:51 +01:00
moneromooo-monero
042b86c473 simplewallet: do not ask wallet filename twice when restoring
It's annoying and pointless (especially as it's the only thing
where the user is asked twice)
2017-08-06 12:28:00 +01:00
Erik de Castro Lopo
8bbed27573 simplewallet: Be explicit about secret keys
Previously, the wallet just asked for "Spend key" and "View key" but
now it specifies that these should be the secret versions of these
keys.
2017-08-06 08:37:18 +10:00
moneromooo-monero
51ebedb803 epee: remove a couple unused locals 2017-08-05 18:42:53 +01:00
Jaquee
e31aac80e5 walletAPI: add getRefreshFromBlockHeight() 2017-08-05 19:23:55 +02:00
Jaquee
48c0cb1ba6 wallet api: pause refresh while commiting tx 2017-08-05 19:21:23 +02:00
Jaquee
f233c01c8f CMakeLists.txt - ios/xcode fix 2017-08-05 19:21:10 +02:00
moneromooo-monero
9707998a08 wallet2: clear some missing containers in clear() 2017-08-05 18:09:31 +01:00
Jaquee
67ce4910bc wallet2: store testnet bool in keys file 2017-08-05 17:23:47 +02:00
moneromooo-monero
0c57df9770 wallet2: fix temporarily missing incoming tx when being mined
When scanning the txpool without having first updated the
blockchain, the tx would be seen as neither in the txpool
nor the chain, and removed, so it'd only reappear once the
chain is refreshed, and the tx seen in a block.
2017-08-05 12:36:03 +01:00
moneromooo-monero
f4f7eeba80 blockchain: log more info when we reject an orphan
We want to know what happened when a block is wrongly rejected
2017-08-04 23:26:55 +01:00
moneromooo-monero
16a5534704 simplewallet: show payment ids on sign_transfer
Integrated addresses are shown when an encrypted payment id is used
2017-08-04 19:36:02 +01:00
moneromooo-monero
71e2876033 debug_utilities: only build for debug builds 2017-08-04 14:45:43 +01:00
moneromooo-monero
55e150ff8a debug_utilities: new object-sizes debug tool
It prints the size of various interesting types, to make it
easier to match leaks to possible leaked object types
2017-08-04 14:45:38 +01:00
Jaquee
a839a6fa8a Wallet API: add tx unlock time 2017-08-03 21:37:45 +02:00
moneromooo-monero
fbaf5375c3 cn_deserialize: move to new debug_utilities subdirectory 2017-08-03 16:20:40 +01:00
moneromooo-monero
d732c73e71 blockchain: remove a few unused variables 2017-08-03 11:26:55 +01:00
m2049r
ad4649ac81 Enable verifying wallet password with having to load wallet. 2017-08-03 01:45:45 +02:00
Guillaume LE VAILLANT
c8640a3d74 difficulty: fix misleading comment 2017-08-02 23:59:48 +02:00
moneromooo-monero
328bebbe4b daemon: some more include cleanup 2017-08-02 22:43:38 +01:00
moneromooo-monero
1c9196b0c5 cryptonote_protocol: fix days behind calc on testnet 2017-08-02 22:34:02 +01:00
moneromooo-monero
b7d6ec8364 simplewallet: add (out of sync) or (no daemon) markers in the prompt
Should help people who don't realize why they haven't seen their
monero yet.
2017-08-02 14:44:42 +01:00
moneromooo-monero
fa23a5006d wallet2: add a is_synced function 2017-08-02 14:44:19 +01:00
moneromooo-monero
f1307bbd7b node_rpc_proxy: add a proxy for target height 2017-08-02 14:43:47 +01:00
moneromooo-monero
c97d1bd3d4 wallet: return unlock_time in get_transfers
also show it in simplewallet's show_transfer
2017-08-02 10:15:27 +01:00
m2049r
600353e2b2 fix wallet callback signatures 2017-08-02 01:23:53 +02:00
moneromooo-monero
41f935ddb2 network_throttle: remove unneeded heap allocations
This will keep leak traces less noisy, as those were one off
allocations that were technically leaking.
2017-08-01 18:47:05 +01:00
moneromooo-monero
c6ba7d110f p2p: move m_in_timedsync from connection_context to p2p_connection_context
It's got no place in the base class as it's P2P specific field
2017-08-01 18:41:57 +01:00
moneromooo-monero
5d4ef719b9 core: speed up output index unique set calculation
A sort+uniq step was done for every tx in a 200 block chunk,
causing a lot of repeated scanning as the size of the offset
map got larger with every added tx. We now do the step only
once at the end of the loop.
Doing it this way potentially uses more memory, but testing
shows that it's currently only about 2% more.
2017-08-01 14:06:12 +01:00
moneromooo-monero
19d7f568ce perf_timer: allow profiling more granular than millisecond 2017-08-01 14:05:20 +01:00
moneromooo-monero
bda8c5983b epee: add nanosecond timer and pause/restart profiling macros
Nanosecond timer precision won't work on Windows, but we don't
care since I'm using that just for profiling incremental code
paths, but a Windows coder is welcome to add it if there's a way.
2017-08-01 14:03:18 +01:00
moneromooo-monero
214fd81e93 some include cleanup 2017-07-31 16:36:52 +01:00
moneromooo-monero
87b5ede908 miner: fix ignoring battery from command line 2017-07-31 08:36:57 +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
14ec6ed80d tx_pool: remove obsolete unused m_config_folder field 2017-07-30 12:03:43 +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
Erik de Castro Lopo
04bd19257d cmake: Update detection of external miniupnpc
The version of miniupnpc in external/ uses API version 16, but the
code also seems to work for API version 10. Also remove detection
of older unsupported versions.
2017-07-30 16:28:30 +10:00
Erik de Castro Lopo
94dd5cb4a0 Makefile: Add debug-static-all target
Also make debug-all target statically link all internal libraries.
2017-07-30 09:19:39 +10:00
moneromooo-monero
d37e8f8868 daemon: add average seconds per block in bc_dyn_stats 2017-07-29 18:43:50 +01:00
moneromooo-monero
878205f143 core: fix lock ordering bug at init time 2017-07-29 12:54:02 +01:00
JollyMort
02f13d6cdf Fix handling of strings & simplify summation of spendkeys 2017-07-29 13:49:12 +02:00
moneromooo-monero
04ebfbfefa p2p: close connections when exiting
This ensures they don't leak if they were in the middle of an
async operation.
2017-07-29 10:04:36 +01:00
JollyMort
40fc9d7b68 Add option to join multisig wallet pieces together
Asks user for all the data required to merge secret keys from multisig wallets into one master wallet, which then gets full control of the multisig wallet. The resulting wallet will be the same as any other regular wallet.
2017-07-29 02:36:21 +02:00
moneromooo-monero
9a10148c01 p2p: fix thread leak 2017-07-28 22:23:05 +01:00
moneromooo-monero
d8becf2ee1 blockchain: fix cryptonight buffer leak on exit 2017-07-28 10:19:17 +01:00
moneromooo-monero
91aa90fc79 blockchain: ensure all blocks get their longhash precalculated
If the number of blocks to check was not a multiple of the
number of preparation threads, the last few blocks would
not be included in the threaded long hash calculation.
Those would still get calculated when the block gets added
to the chain, however, so this was only a tiny performance
hit, rather than a security bug.
2017-07-27 18:18:49 +01:00
moneromooo-monero
ff4bcaed81 blockchain: pass correct height to get_block_longhash 2017-07-27 18:18:20 +01:00
moneromooo-monero
06aea2cf0a move get_proof_of_trust_hash from util.h to p2p_protocol_defs.h
This avoids having to include p2p_protocol_defs.h in util.h,
as util.h is used a lot, and p2p_protocol_defs.h includes
a lot of other things that most users don't need.
2017-07-27 15:46:47 +01:00
Erik de Castro Lopo
525975acc4 wallet-cli: Minor improvement to help output 2017-07-27 20:36:28 +10:00
moneromooo-monero
cb0b559451 Move OpenAlias console input back from libs
Library code should definitely not ask for console input unless
it's clearly an input function. Delegating the user interaction
part to the caller means it can now be used by a GUI, or have a
decision algorithm better adapted to a particular caller.
2017-07-27 11:30:13 +01:00
moneromooo-monero
dc0b312f8a wallet_rpc_server: optionally return tx blobs on transfer calls
also add do_not_relay flag to them, so it now becomes possible
to create a tx without sending it yet
2017-07-26 10:33:04 +01:00
moneromooo-monero
340feedee2 core: randomly shuffle outputs
They used to be sorted by amount, which was fine before rct,
but is now suboptimal, since amounts are not known anymore.
In particular, it would give a recipient knowledge of whether
change was higher or lower than the amount received.
2017-07-25 18:57:57 +01:00
moneromooo-monero
5eb79983be epee: add a KV_SERIALIZE variant for optional parameters 2017-07-24 21:02:30 +01:00
rbrunner7
f1b76c8424 cryptonote_protocol: Set send_idle_time in connection_info correctly 2017-07-24 18:58:39 +02:00
moneromooo-monero
53af9768ce blockchain: one off warning when seeing a block with unknown version 2017-07-24 15:25:46 +01:00
Jethro Grassie
d75cff1a0e Fix readline prompt when command does not output 2017-07-24 09:54:27 -04:00
moneromooo-monero
599436a452 mlog: default to msgwriter logs only for log level 1
There might be privacy issues doing it by default
2017-07-24 10:34:52 +01:00
moneromooo-monero
58f3fc68e4 Make msgwriter logs go to file only
This was the case for monero-wallet-cli already, but not for
monerod, which was making it pretty spammy as it was duplicating
intended output. Since my original intent was to ensure logs
included command output for debugging, this achieves both.
2017-07-24 10:34:47 +01:00
moneromooo-monero
380009e541 README: give credit where credit is due 2017-07-24 09:30:56 +01:00
JollyMort
23909bb04d Make successful transfer log message more informative
"Payment successfully sent" can be misleading if the TX isn't confirmed and drops from TX-pool.
2017-07-22 23:35:53 +02:00
moneromooo-monero
335fc8ab23 mlog: fix crash accessing stale data when rotating logs 2017-07-22 19:15:44 +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
Erik de Castro Lopo
2fac03e682 Update monerod systemd service file
Make monerod use a PID file and let systemd know where that file is.
2017-07-22 08:34:56 +10:00
Erik de Castro Lopo
51efb21713 daemon: Add ability to write a PID file
The PID file will only be written if the daemon is called with the
`--detach` command line argument and a `--pidfile /some/file/path`
argument.
2017-07-22 08:34:56 +10:00
erciccione
98cb3fee75 italian translation 2017-07-19 12:58:27 +01:00
erciccione
ff07cdc9c8 updates monero_fr.ts 2017-07-19 12:58:23 +01:00
erciccione
f675fedc49 updates monero.ts 2017-07-19 12:58:20 +01:00
Riccardo Spagni
ab594cfee9 Merge pull request #2159
6955976b Add various readline related fixes (Jethro Grassie)
2017-07-19 11:52:27 +02:00
Riccardo Spagni
e050853ed3 Merge pull request #2157
6a23cd07 Add notification on stop (Jethro Grassie)
2017-07-19 11:52:11 +02:00
Riccardo Spagni
4014f31a73 Merge pull request #2173
a02d7458 mlog: make MONERO_LOGS env var understand N,logs type spec (moneromooo-monero)
2017-07-19 11:51:50 +02:00
Riccardo Spagni
c0f155d3a0 Merge pull request #2170
c3bb6bec daemon: fix status in command line mode if using restricted rpc (moneromooo-monero)
2017-07-19 11:51:35 +02:00
Riccardo Spagni
630cc0f9ca Merge pull request #2169
f5f985c0 miner: fix background mining options parsing (moneromooo-monero)
2017-07-19 11:51:09 +02:00
Riccardo Spagni
fed3430b70 Merge pull request #2166
33d17c37 Don't hardcode /tmp (Howard Chu)
2017-07-19 11:50:38 +02:00
Riccardo Spagni
921ebdce45 Merge pull request #2165
8db68a57 Fix #2164 histogram output (Howard Chu)
2017-07-19 11:50:14 +02:00
Riccardo Spagni
27c0c742ca Merge pull request #2154
97069380 mlog: add msgwriter:INFO to log 0 and 1 defaults (moneromooo-monero)
2017-07-19 11:49:59 +02:00
Riccardo Spagni
42fc89b672 Merge pull request #2142
02d66db4 tx_pool: initialize padding in txpool meta structure (moneromooo-monero)
0722aea3 cryptonote_core: initialize checkpoint flag (moneromooo-monero)
2017-07-19 11:49:42 +02:00
Riccardo Spagni
bdc9cae3e3 Merge pull request #2140
d765cd91 epee: Remove unused variable (Erik de Castro Lopo)
2017-07-19 11:49:26 +02:00
Riccardo Spagni
999d4d83e9 Merge pull request #2135
5cea3552 simplewallet: lock idle scope when sweeping (moneromooo-monero)
2017-07-19 11:49:09 +02:00
Riccardo Spagni
f584a2de92 Merge pull request #2131
a04faf56 abstract_tcp_server2: guard against accessing lock on a destroyed object (moneromooo-monero)
2017-07-19 11:48:51 +02:00
moneromooo-monero
a02d745844 mlog: make MONERO_LOGS env var understand N,logs type spec 2017-07-15 10:23:24 +01:00
MoroccanMalinois
044c5b5572 Readme: add android docker build instruction 2017-07-13 15:55:11 +00:00
MoroccanMalinois
82836be47e Utils: Add dockerfile for android NDK build 2017-07-13 15:54:56 +00:00
moneromooo-monero
c3bb6becd9 daemon: fix status in command line mode if using restricted rpc 2017-07-13 10:17:57 +01:00
moneromooo-monero
f5f985c018 miner: fix background mining options parsing
They were set as uint8_t, which boost was apparently treating
as a character type, rather than a numeric type
2017-07-12 11:22:50 +01:00
Howard Chu
33d17c37e8 Don't hardcode /tmp 2017-07-11 12:38:51 +01:00
Howard Chu
8db68a57f5 Fix #2164 histogram output
When there are more than 50txs, the timestamp for the last
bin was printed incorrectly. Subtracting "now" was omitted by mistake
in 3fc22e7b78
2017-07-10 15:51:03 +01:00
Jethro Grassie
6955976b2d Add various readline related fixes
- Add missing unbind key
- Fix colored messages
- Add command completion
- Preserve last command input
- Fix cursor position issues
- Fix trailing whitespace in commands
- Synchronize set_prompt
2017-07-09 09:50:04 -04:00
Jethro Grassie
6a23cd07aa Add notification on stop 2017-07-07 07:59:07 -04:00
Ryan Mehta
94717021ef fix on_battery_power for linux
fix ac/battery linux
2017-07-06 10:03:55 -07:00
moneromooo-monero
9706938016 mlog: add msgwriter:INFO to log 0 and 1 defaults
This ensures command output gets logged by default
2017-07-06 13:18:04 +01:00
Guillaume LE VAILLANT
13a8d64fe6 epee: don't send the body of the response to a HEAD HTTP request
According to the HTTP spec: "The HEAD method is identical to GET
except that the server MUST NOT return a message-body in the
response".
2017-07-05 15:39:50 +02:00
Erik de Castro Lopo
35d68b2c6d Fix spelling errors 2017-07-05 17:53:16 +10:00
moneroexamples
125f823bda Add on_get_alt_blocks_hashes RPC call 2017-07-04 12:32:44 +08:00
Riccardo Spagni
605ad09a3e Merge pull request #2130
a0d2c745 Fix issue #2119 SEGV (Howard Chu)
2017-07-03 12:51:00 +02:00
Riccardo Spagni
f9522fd0e2 Merge pull request #2127
44bfe604 enable monero build on ppc64le architecture (Roberto Oliveira)
2017-07-03 12:31:22 +02:00
Riccardo Spagni
218f1a1d69 Merge pull request #2125
f98bf48b Minor cleanup: tab vs. space + logs messages (binaryFate)
2017-07-03 12:30:46 +02:00
Riccardo Spagni
44e4bbd15c Merge pull request #2124
3b599d2b wallet2: get current height from the daemon on creation (moneromooo-monero)
d3bb72ff wallet2: fix infinite loop on future refresh height (moneromooo-monero)
32754784 wallet: fix refresh_from_height setting on new wallet (moneromooo-monero)
2017-07-03 12:30:16 +02:00
Riccardo Spagni
cde5103b7a Merge pull request #2123
eb71ebbe Formatting README.i18n.md as Markdown. (Jonathan Cross)
2017-07-03 12:29:45 +02:00
Riccardo Spagni
5689851f85 Merge pull request #2122
a282c575 Fix #2071: remove declaration of unused variable "it" in epee (binaryFate)
2017-07-03 12:29:26 +02:00
Riccardo Spagni
645c898e2d Merge pull request #2121
5a09d79c Fix #2120: return per-tx amount in transfer_split RPC call. (binaryFate)
2017-07-03 12:28:56 +02:00
Riccardo Spagni
8609ed86c4 Merge pull request #2116
841231e5 Add fuzz testing using american fuzzy lop (moneromooo-monero)
2017-07-03 12:28:33 +02:00
Riccardo Spagni
b66420e54d Merge pull request #2114
b592cb3f Fix on_transfer RPC incorrect logging info (Mike C)
2017-07-03 12:27:52 +02:00
Riccardo Spagni
7995dcff94 Merge pull request #2112
76043b17 monero-wallet-cli: hang on exit in readline code (#2117) (moneromooo-monero)
a73a42a6 monero-wallet-cli: hang on exit in readline code (#2117) (moneromooo-monero)
be9d4f04 Fix multiline wallet cli output with readline (Jethro Grassie)
2017-07-03 12:27:14 +02:00
Riccardo Spagni
bbdbccfba0 Merge pull request #2110
7d2c89b6 Add french translation (Guillaume LE VAILLANT)
3255887f simplewallet: typo fixes (Guillaume LE VAILLANT)
2017-07-03 12:26:02 +02:00
Riccardo Spagni
c577bc8762 Merge pull request #2107
bdab3436 Fix mismatch of parameter name between header file and implementation for set_user_options() (Julien Klepatch)
2017-07-03 12:24:16 +02:00
Riccardo Spagni
9e1ded69dd Merge pull request #2106
bb708ab8 electrum-words: fix seed mistakenly thought to be old style (moneromooo-monero)
2017-07-03 12:23:39 +02:00
Riccardo Spagni
40dc53c6e2 Merge pull request #2098
fdccf7e6 Add readline improvements (Jethro Grassie)
2017-07-03 12:22:03 +02:00
Riccardo Spagni
6426cc8f54 Merge pull request #2128
8f96cfc2 Remove typeid use in network_address (moneromooo-monero)
2017-07-03 12:20:58 +02:00
moneromooo-monero
02d66db4b4 tx_pool: initialize padding in txpool meta structure 2017-07-02 18:45:29 +01:00
moneromooo-monero
0722aea3df cryptonote_core: initialize checkpoint flag 2017-07-02 18:45:25 +01:00
Erik de Castro Lopo
d765cd91df epee: Remove unused variable 2017-07-02 17:47:02 +10:00
Howard Chu
a0d2c745c7 Fix issue #2119 SEGV
Due to bad refactoring in PR #2073.
timeout_handler() doesn't work as a virtual function.
2017-07-01 23:35:16 +01:00
moneromooo-monero
5cea355232 simplewallet: lock idle scope when sweeping
This ensures the chain and related structures can't change
while we're using them
2017-06-30 09:33:37 +01:00
Howard Chu
464afd4d2d Ensure DNSResolver destructor runs on exit
Plugs a noisy but benign memory leak
2017-06-28 22:21:06 +01:00
moneromooo-monero
76043b17fd monero-wallet-cli: hang on exit in readline code (#2117)
readline_buffer: move a local to local scope

Also limit the select fd limit to what we use

Signed-off-by: Jethro Grassie <jtg@xtrabass.com>
2017-06-28 07:54:29 -04:00
moneromooo-monero
a73a42a6b0 monero-wallet-cli: hang on exit in readline code (#2117)
readline_buffer: fix start/stop threads being starved by process

process could run for quite some time re-acquiring the process
lock, leaving start/stop starving. Yielding after unlock in
process is much better but doesn't seem to be enough to reliably
yield, so we sleep for a millisecond, which should be transparent
for user input anyway.

Signed-off-by: Jethro Grassie <jtg@xtrabass.com>
2017-06-28 07:54:20 -04:00
moneromooo-monero
a04faf56dc abstract_tcp_server2: guard against accessing lock on a destroyed object 2017-06-28 10:34:34 +01:00
moneromooo-monero
8f96cfc20a Remove typeid use in network_address
Since I had to add an ID to the derived classes anyway,
this can be used instead. This removes an apparently
pointless warning from CLANG too.
2017-06-28 09:11:24 +01:00
Roberto Oliveira
44bfe6048b enable monero build on ppc64le architecture
Fix wrong flags for ppc64le:
-maes - not avaiable
-march - changed by -mcpu that does the same for powerpc
2017-06-27 17:06:19 +00:00
binaryFate
a282c5756c Fix #2071: remove declaration of unused variable "it" in epee 2017-06-26 12:32:01 +02:00
binaryFate
f98bf48b1d Minor cleanup: tab vs. space + logs messages 2017-06-26 12:30:14 +02:00
binaryFate
5a09d79caf Fix #2120: return per-tx amount in transfer_split RPC call. 2017-06-26 12:22:12 +02:00
moneromooo-monero
3b599d2b7e wallet2: get current height from the daemon on creation
Use current time to estimate current height only if the daemon
cannot be queried.
2017-06-26 08:11:14 +01:00
moneromooo-monero
d3bb72fff1 wallet2: fix infinite loop on future refresh height
If the refresh height is in the future, the current code will
loop till the actual height reaches this. Fix it by bailing out
if we receive only three hashes, which is what we set in the
call parameters.
2017-06-26 06:58:37 +01:00
moneromooo-monero
32754784db wallet: fix refresh_from_height setting on new wallet
The previous patch was based on a wrong premise (that the
daemon height was 0 because the daemon calling code wasn't
yet initialized). In fact, current height approximation
was not setup for testnet. Fix this.
2017-06-26 06:58:31 +01:00
Jonathan Cross
eb71ebbecd Formatting README.i18n.md as Markdown. 2017-06-26 00:24:37 +02:00
Jethro Grassie
be9d4f0411 Fix multiline wallet cli output with readline
monero-wallet-cli commands which have multine output sometimes causes
issues with the readline support. This patch fixes show_transfers,
payments and incoming_transfers.
2017-06-25 10:48:02 -04:00
moneromooo-monero
841231e5bd Add fuzz testing using american fuzzy lop
Existing tests: block, transaction, signature, cold outputs,
cold transaction.

Data for these is in tests/data/fuzz.

A convenience shell script is in contrib/fuzz_testing/fuzz.sh, eg:

contrib/fuzz_testing/fuzz.sh signature

The fuzzer will run indefinitely, ^C to stop.

Fuzzing is currently supported for GCC only. I can't get CLANG
to build Monero here as it dies on some system headers, so if
someone wants to make it work on both, that'd be great.
In particular, the __AFL_LOOP construct should be made to work
so that a given run can fuzz multiple inputs, as the C++ load
time is substantial.
2017-06-24 16:46:18 +01:00
Jethro Grassie
fdccf7e6c3 Add readline improvements
Color prompt now working and no reprompting on exit command.
2017-06-24 07:34:56 -04:00
Riccardo Spagni
0c6ea4f8a6 Merge pull request #2111
8261ba69 readline_buffer: fix busy wait (moneromooo-monero)
2017-06-24 12:48:37 +02:00
Riccardo Spagni
a0b494aa71 Merge pull request #2103
21b939e1 readline: fix invalid memory access (moneromooo-monero)
5f8f2905 readline_buffer: add a couple const (moneromooo-monero)
2017-06-24 12:48:13 +02:00
Riccardo Spagni
57ea25017a Merge pull request #2095
f4e3dca1 unit_tests: fix build failures after network_address changes (moneromooo-monero)
2017-06-24 12:44:07 +02:00
Riccardo Spagni
50d8f73f06 Merge pull request #2091
e4da88a2 Fixed typo in rpc/core_rpc_server.cpp (Julien Klepatch)
2017-06-24 12:43:28 +02:00
Riccardo Spagni
389cd6c466 Merge pull request #2089
a85b5759 Upgrade unbound library (Erik de Castro Lopo)
2017-06-24 12:42:29 +02:00
Riccardo Spagni
f31b89012d Merge pull request #2073
07c4276c Don't issue a new timedsync while one is already in progress (Howard Chu)
cf3a376c Don't timeout a slow operation that's making progress (Howard Chu)
340830de Fix PR#2039 (Howard Chu)
2017-06-24 12:41:09 +02:00
Riccardo Spagni
f09f18fc64 Merge pull request #2069
11de4d59 Converting README.i18n to Markdown (Jonathan Cross)
2017-06-24 12:40:15 +02:00
Riccardo Spagni
05365e1726 Merge pull request #1992
d5f1cef7 simplewallet: removed unneeded LOCK_IDLE_SCOPE() from check_tx_key() (stoffu)
8df918f8 simplewallet: replace assert(m_wallet) with error out (stoffu)
8da82256 crypto: moved boost::lock_guard into a smaller scope (stoffu)
c9e0e944 Signature proving payment to destination by only revealing key derivation, not the actual tx secret key (stoffu)
2017-06-24 12:38:16 +02:00
Mike C
b592cb3f0a Fix on_transfer RPC incorrect logging info 2017-06-23 11:54:10 -04:00
moneromooo-monero
8261ba69e6 readline_buffer: fix busy wait
It'd eat up a core constantly, due to spending its time jumping
back and forth between userland and kernel. We now wait for up
to a millisecond in kernel, which will be transparent to the user
and drop to idle most of the time.
2017-06-23 13:21:50 +01:00
Guillaume LE VAILLANT
7d2c89b6c7 Add french translation 2017-06-23 14:04:56 +02:00
Guillaume LE VAILLANT
3255887f5e simplewallet: typo fixes 2017-06-23 14:04:44 +02:00
Julien Klepatch
bdab3436d3 Fix mismatch of parameter name between header file and implementation for set_user_options() 2017-06-23 05:16:11 +08:00
moneromooo-monero
bb708ab8c3 electrum-words: fix seed mistakenly thought to be old style
It'd see "empty" words due to extraneous spaces
2017-06-22 16:47:07 +01:00
stoffu
d5f1cef73c simplewallet: removed unneeded LOCK_IDLE_SCOPE() from check_tx_key() 2017-06-22 18:11:20 +09:00
stoffu
8df918f8c7 simplewallet: replace assert(m_wallet) with error out 2017-06-22 18:11:18 +09:00
stoffu
8da82256d4 crypto: moved boost::lock_guard into a smaller scope 2017-06-22 18:11:15 +09:00
stoffu
c9e0e944e9 Signature proving payment to destination by only revealing key derivation, not the actual tx secret key 2017-06-22 18:11:13 +09:00
Riccardo Spagni
038e6cd33e Merge pull request #2094
007937e2 net_utils_base: added missing template keyword (kenshi84)
2017-06-21 21:57:03 +02:00
moneromooo-monero
21b939e1e6 readline: fix invalid memory access
m_cout_buf was not initialized
2017-06-21 17:33:47 +01:00
moneromooo-monero
5f8f290505 readline_buffer: add a couple const 2017-06-21 17:33:30 +01:00
moneromooo-monero
f4e3dca113 unit_tests: fix build failures after network_address changes 2017-06-19 11:26:02 +01:00
kenshi84
007937e217 net_utils_base: added missing template keyword 2017-06-19 08:11:28 +09:00
Riccardo Spagni
ae8841f2ab Merge pull request #2087
4e13ab30 wallet_api: fix missing transaction parameter in callback (moneromooo-monero)
2017-06-18 17:36:55 +02:00
Riccardo Spagni
78f965a9e2 Merge pull request #2082
235df7f4 blockchain_db: add a txpool tx getter which returns existence (moneromooo-monero)
2017-06-18 17:36:12 +02:00
Riccardo Spagni
91e1a7e3e2 Merge pull request #2081
b2319a03 simplewallet: new command to generate a random payment id (moneromooo-monero)
2017-06-18 17:34:41 +02:00
Riccardo Spagni
973daf853b Merge pull request #2079
c3bec61d core_tests: fix tests failing due to new txpool code requitring batch transactions (moneromooo-monero)
2017-06-18 17:33:57 +02:00
Riccardo Spagni
f973a2f81a Merge pull request #2078
1dd52415 Fix #1991 asm multiply again (Howard Chu)
2017-06-18 17:32:03 +02:00
Riccardo Spagni
fb7d6db051 Merge pull request #2076
ac0714dc add simplewallet --generate-new-wallet arg checks (Michael Shick)
2017-06-18 17:27:52 +02:00
Riccardo Spagni
ae5f7c71d7 Merge pull request #2074
e1f3dfcc Add readline support to cli (jethro)
2017-06-18 17:26:08 +02:00
Riccardo Spagni
88b7cb9bda Merge pull request #2070
71f8249a Prevent crash if performing certain actions before wallet is initialized (Robby Weinberg)
2017-06-18 16:43:35 +02:00
Riccardo Spagni
ace1440b65 Merge pull request #2066
3fc22e7b Add histogram to poolstats (Howard Chu)
d09620b0 Fix PR#2039 (Howard Chu)
2017-06-18 16:41:42 +02:00
Riccardo Spagni
a0174ad534 Merge pull request #2064
6fc2dc39 cryptonote_protocol_handler: fix crash in debug log (moneromooo-monero)
2017-06-18 16:40:52 +02:00
jethro
e1f3dfccc8 Add readline support to cli
This PR adds readline support to the daemon and monero-wallet-cli. Only
GNU readline is supported (e.g. not libedit) and there are cmake checks
to ensure this.

There is a cmake variable, Readline_ROOT_DIR that can specify a
directory to find readline, otherwise some default paths are searched.

There is also a cmake option, USE_READLINE, that defaults to ON. If set
to ON, if readline is not found, the build continues but without
readline support.

One negative side effect of using readline is that the color prompt in
the wallet-cli now has no color and just uses terminal default. I know
how to fix this but it's quite a big change so will tackle another time.
2017-06-18 10:08:37 -04:00
Riccardo Spagni
421a6d0340 Merge pull request #2055
1b75ad91 Add OSX background mining (jethro)
2017-06-18 14:24:48 +02:00
Riccardo Spagni
a237f90c5b Merge pull request #2052
072102cf abstracted nework addresses (moneromooo-monero)
2017-06-18 14:23:59 +02:00
Julien Klepatch
e4da88a223 Fixed typo in rpc/core_rpc_server.cpp 2017-06-18 16:12:54 +08:00
Erik de Castro Lopo
a85b5759f3 Upgrade unbound library
These files were pulled from the 1.6.3 release tarball.

This new version builds against OpenSSL version 1.1 which will be
the default in the new Debian Stable which is due to be released
RealSoonNow (tm).
2017-06-17 23:04:00 +10:00
Howard Chu
07c4276cbe Don't issue a new timedsync while one is already in progress
A timedsync is issued every minute on a connection, but the input
tineout is 2 minutes. This means a new sync request could be issued
while a slow sync request was already in progress. The additional
request will further clog the network on a slow connection, and
cause a premature timeout.
2017-06-15 16:54:03 +01:00
Howard Chu
cf3a376cb5 Don't timeout a slow operation that's making progress
If we got at least MIN_BYTES_WANTED (default 512) during any network
poll, reset the timeout to allow more time for data to arrive.
2017-06-15 16:54:03 +01:00
Howard Chu
340830de5b Fix PR#2039
Missed a crypto -> cncrypto rename
2017-06-15 16:54:03 +01:00
moneromooo-monero
4e13ab306a wallet_api: fix missing transaction parameter in callback
It was unused, so harmless

Reported by erikd on IRC
2017-06-13 19:34:51 +01:00
moneromooo-monero
235df7f484 blockchain_db: add a txpool tx getter which returns existence
Avoids exception spam for the "nope, not found" case
2017-06-11 15:36:48 +01:00
moneromooo-monero
b2319a03a6 simplewallet: new command to generate a random payment id
This is trivial, but often requested, and possibly hard to do
in Windows. That makes it more user friendly.
2017-06-10 10:08:55 +01:00
moneromooo-monero
c3bec61da2 core_tests: fix tests failing due to new txpool code requitring batch transactions 2017-06-09 20:49:59 +01:00
Howard Chu
1dd524151d Fix #1991 asm multiply again
Tweak temp variables and constraints. Was working before if not inlined
but newer gcc tends to inline it.
2017-06-08 21:46:40 +01:00
jethro
1b75ad91aa Add OSX background mining
Implements miner::get_system_times, miner::get_process_time and
miner::on_battery_power for OSX so that background mining works on OSX.
2017-06-08 09:26:09 -04:00
Michael Shick
ac0714dcd7 add simplewallet --generate-new-wallet arg checks
Add fail-fast paths that reduce frustration around the misuse of
--wallet-file combined with --restore-deterministic-wallet.  Flow now
gives more descriptive errors and avoids having users type in their
whole seed before the failure condition is noticed.
2017-06-07 07:46:59 -07:00
Howard Chu
3fc22e7b78 Add histogram to poolstats 2017-06-04 22:48:14 +01:00
Howard Chu
d09620b0e2 Fix PR#2039
Missed a crypto -> cncrypto rename
2017-06-04 22:48:13 +01:00
Jonathan Cross
11de4d59ea Converting README.i18n to Markdown 2017-06-04 13:44:45 +02:00
Robby Weinberg
71f8249a08 Prevent crash if performing certain actions before wallet is initialized 2017-06-03 19:56:51 -05:00
moneromooo-monero
6fc2dc3927 cryptonote_protocol_handler: fix crash in debug log 2017-06-01 19:42:33 +01:00
Riccardo Spagni
e3da0ca828 Merge pull request #2059
fa489a26 Fix PR#2039 (Howard Chu)
2017-06-01 19:43:54 +02:00
Riccardo Spagni
ea286d1a14 Merge pull request #2058
6bcd3b2d fix get_upper_transaction rename (schnerchi)
2017-06-01 19:42:37 +02: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
Riccardo Spagni
4a60e9e66e Merge pull request #2062
31417d57 tx_pool: add missing blockchain lock in add_tx (moneromooo-monero)
2017-06-01 19:33:17 +02:00
Riccardo Spagni
fbfad8ee1b Merge pull request #2061
5414970d Speedup print_pool_stats (Howard Chu)
2017-06-01 19:32:37 +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
moneromooo-monero
31417d57da tx_pool: add missing blockchain lock in add_tx 2017-05-31 22:55:13 +01:00
Howard Chu
fa489a26ef Fix PR#2039
Missed a crypto -> cncrypto rename
2017-05-31 15:34:31 +01:00
schnerchi
6bcd3b2df1 fix get_upper_transaction rename 2017-05-31 12:26:42 +02:00
Riccardo Spagni
8fbbefb8db Merge pull request #2053
05f3dcf7 simplewallet: fix refresh height for new wallets (moneromooo-monero)
2017-05-30 21:28:40 +02:00
Riccardo Spagni
2f724e5849 Merge pull request #2054
977c2186 easylogging++: log timestamps in GMT for privacy (moneromooo-monero)
2017-05-30 21:26:30 +02:00
Riccardo Spagni
f5e65452ce Merge pull request #2042
740bc24c Wallet API: Set seed lang when recovering form keys (Jaquee)
2017-05-30 21:24:45 +02:00
Riccardo Spagni
a4c13ea092 Merge pull request #2039
4b932ff3 changed crypto to cncrypto so it generated libcncrypto (Gentian)
2017-05-30 21:24:11 +02:00
Riccardo Spagni
4284f1777d Merge pull request #2038
89e20bb9 Fix typo (xmr-eric)
2017-05-30 21:23:25 +02:00
Riccardo Spagni
cd13bcb4d2 Merge pull request #2036
89b2f306 tests: fix invalid key image test (moneromooo-monero)
a374a522 wallet2: check key image validity domain in import_key_images (moneromooo-monero)
2017-05-30 21:23:05 +02:00
Riccardo Spagni
8b1c11c3c9 Merge pull request #2035
45e9838b unbound: update some EVP APIs to new names (Howard Chu)
2017-05-30 21:22:22 +02:00
Riccardo Spagni
9ea7fbed8a Merge pull request #2032
dd8e3266 shared libs build (i.e. make debug) (stoffu)
2017-05-30 21:21:36 +02: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
d621f9e558 Merge pull request #2022
e2529347 Correct spelling of 'get_upper_transaction_size_limit' (Nano Akron)
3029d0ef Remove the 1.25x multiplier in max transaction size in just the wallet (Nano Akron)
2017-05-30 21:19:00 +02:00
Riccardo Spagni
62cc3b6447 Merge pull request #2021
8ac2496c corrected typo in help regarding min-outputs-* (stoffu)
2017-05-30 21:15:33 +02:00
Riccardo Spagni
024860b49d Merge pull request #2020
6cb1ad1f wallet fix: ensure iterator to be valid (stoffu)
2017-05-30 21:14:24 +02:00
Riccardo Spagni
1555e7673d Merge pull request #2017
0a182576 node_rpc_proxy: fix earliest fork height query for unknown forks (moneromooo-monero)
391c918d wallet2: fix sweep_unmixable assuming wrong minimum mixin at v5 (moneromooo-monero)
2017-05-30 21:13:47 +02:00
Riccardo Spagni
40eb22aeb4 Merge pull request #2016
d1db3251 Fix overlooked renaming of Português in the unit tests (Nano Akron)
2017-05-30 21:13:22 +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
977c2186c9 easylogging++: log timestamps in GMT for privacy 2017-05-28 13:20:27 +01:00
moneromooo-monero
05f3dcf738 simplewallet: fix refresh height for new wallets
With the recent change to wallet creation code, the code was
calling to the daemon before the wallet's daemon address was
initialized, and thus failing. This was causing all new wallets
to refresh from 0 instead of just fetching early block hashes.
2017-05-28 13:17:32 +01:00
moneromooo-monero
072102cfd2 abstracted nework addresses
All code which was using ip and port now uses a new IPv4 object,
subclass of a new network_address class. This will allow easy
addition of I2P addresses later (and also IPv6, etc).
Both old style and new style peer lists are now sent in the P2P
protocol, which is inefficient but allows peers using both
codebases to talk to each other. This will be removed in the
future. No other subclasses than IPv4 exist yet.
2017-05-27 11:35:54 +01:00
moneromooo-monero
0a182576d0 node_rpc_proxy: fix earliest fork height query for unknown forks 2017-05-26 21:34:44 +01: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
Jaquee
740bc24c95 Wallet API: Set seed lang when recovering form keys 2017-05-23 14:01:23 +02:00
Gentian
4b932ff314 changed crypto to cncrypto so it generated libcncrypto
fix a cmakelist
2017-05-23 07:45:40 -04:00
xmr-eric
89e20bb9af Fix typo 2017-05-19 00:40:51 -04:00
moneromooo-monero
89b2f3061b tests: fix invalid key image test
It was using an invalid key image which wasn't in the key image
domain, so the transaction was rejected earlier than the test
was expecting
2017-05-18 09:19:55 +01:00
moneromooo-monero
a374a522df wallet2: check key image validity domain in import_key_images 2017-05-18 09:19:48 +01:00
Howard Chu
45e9838bb1 unbound: update some EVP APIs to new names
Replace EVP_VerifyInit with EVP_DigestInit, and EVP_VerifyUpdate
with EVP_DigestUpdate. Reported/requested by hyc, changed by mooo.
2017-05-17 22:33:16 +01:00
stoffu
dd8e3266b2 shared libs build (i.e. make debug) 2017-05-17 10:17:08 +09:00
xmr-eric
a57392016b Update sync time copy 2017-05-10 14:34:18 -04:00
Nano Akron
e2529347b6 Correct spelling of 'get_upper_transaction_size_limit' 2017-05-09 16:02:57 +01:00
Nano Akron
3029d0efb3 Remove the 1.25x multiplier in max transaction size in just the wallet 2017-05-09 16:01:11 +01:00
stoffu
8ac2496c5d corrected typo in help regarding min-outputs-* 2017-05-09 12:06:46 +09:00
stoffu
6cb1ad1fa2 wallet fix: ensure iterator to be valid 2017-05-09 11:54:21 +09:00
moneromooo-monero
391c918d87 wallet2: fix sweep_unmixable assuming wrong minimum mixin at v5
The bump to minimum mixin 4 was moved from v5 to v6
2017-05-07 18:27:25 +01:00
Nano Akron
d1db32511c Fix overlooked renaming of Português in the unit tests 2017-05-07 16:36:03 +01:00
Riccardo Spagni
694470fae7 Merge pull request #2015
b7ae0911 GUI: easylogging++ install target (Jaquee)
2017-05-06 19:41:25 +02:00
Jaquee
b7ae09111d GUI: easylogging++ install target 2017-05-06 17:07:36 +02:00
Riccardo Spagni
81b370d5a1 Merge pull request #2012
bbf4c210 Wallet API: add spend/view key getters (Jaquee)
2017-05-05 11:35:03 +02:00
Riccardo Spagni
cf3b108ef5 Merge pull request #2009
777684e0 Update README.md instructions for Boost 1.64 and a little bit of formatting (Nano Akron)
2017-05-05 11:34:02 +02:00
Riccardo Spagni
c9a2cf9d4c Merge pull request #2008
6f12b525 Note that this build is community contributed. (Martin Wimpress)
1ff5b5f1 Add snap install instructions (Martin Wimpress)
2017-05-05 11:33:15 +02:00
Riccardo Spagni
6c48494c5a Merge pull request #2006
7199fc83 Removed some unused epee functions (Lee Clagett)
2017-05-05 11:31:59 +02:00
Riccardo Spagni
b3dd7f9ab2 Merge pull request #2004
5f9353bd Linking i18n internationalization file (Jkat)
2017-05-05 11:30:37 +02:00
Riccardo Spagni
c17102c385 Merge pull request #2002
12fff108 Change Old_English to English_Old - 'Old English' is actually a language (Nano Akron)
533187f0 Change all wallet language names into native names (and scripts) (Nano Akron)
2017-05-05 11:29:51 +02:00
Riccardo Spagni
28ecac2671 Merge pull request #2000
710b2e80 Silence clang++ warnings (Howard Chu)
2017-05-05 11:26:38 +02:00
Riccardo Spagni
ed09652a17 Merge pull request #1701
8277e67f Add anchor connections (Miguel Herranz)
2017-05-05 11:26:11 +02:00
Riccardo Spagni
f76fd38baa Merge pull request #1997
5d86c9f4 easylogging++: default to creating categories by default (moneromooo-monero)
2017-05-05 11:24:04 +02:00
Riccardo Spagni
bef164f5ce Merge pull request #1995
66ecee09 Docs: add VRP link to README (anonimal)
1a66db8f Docs: add Vulnerability Response Process (anonimal)
2017-05-05 11:23:44 +02:00
Riccardo Spagni
5566951eba Merge pull request #1986
6df83b3e wallet: add sweep_below function (moneromooo-monero)
2017-05-05 11:22:46 +02:00
Jaquee
bbf4c21048 Wallet API: add spend/view key getters 2017-05-02 16:48:38 +02:00
Martin Wimpress
6f12b525e8 Note that this build is community contributed.
As requested this pull request add a note that this snap is community contributed. It also adds some more explanation of what  a snap is.
2017-04-28 15:12:21 +01:00
Nano Akron
777684e0c1 Update README.md instructions for Boost 1.64 and a little bit of formatting 2017-04-27 21:18:05 +01:00
Martin Wimpress
1ff5b5f10a Add snap install instructions
Monero is now published in the Snap store, this pull request add instructions for installing the snap.
2017-04-27 12:42:24 +01:00
Lee Clagett
7199fc8373 Removed some unused epee functions 2017-04-25 16:07:32 -04:00
Jkat
5f9353bde1 Linking i18n internationalization file 2017-04-25 08:54:42 -04:00
anonimal
66ecee0942 Docs: add VRP link to README 2017-04-24 20:11:10 +00:00
anonimal
1a66db8f33 Docs: add Vulnerability Response Process 2017-04-24 20:11:09 +00:00
Nano Akron
12fff108ea Change Old_English to English_Old - 'Old English' is actually a language 2017-04-24 20:27:12 +01:00
moneromooo-monero
6df83b3efb wallet: add sweep_below function
It sweeps all outputs below the given threshold

This is available via the existing sweep_all RPC, by setting
amount_threshold the desired amount (in atomic units)
2017-04-24 19:50:37 +01:00
Nano Akron
533187f0c3 Change all wallet language names into native names (and scripts) 2017-04-24 11:17:33 +01:00
Riccardo Spagni
9a9fb0483f Merge pull request #1996
a6d5bb75 wallet2: refer to triangular distribution for recent zone in comment (moneromooo-monero)
ac1aba90 wallet2: bias fake outs more towards recent outputs (moneromooo-monero)
2017-04-24 10:55:24 +02:00
Riccardo Spagni
999b0f399d Merge pull request #1989
7f4beaa4 wallet2: fix removal of wrong txes from unconfirmed_payments (moneromooo-monero)
2017-04-24 10:50:54 +02:00
Riccardo Spagni
0385999cda Merge pull request #1984
a255a540 simplewallet: allow multiline seed (moneromooo-monero)
5fce581c mnemonics: ignore multiple whitespace between words (moneromooo-monero)
2017-04-24 10:49:51 +02:00
Riccardo Spagni
e53dd76a49 Merge pull request #1983
72d113dd Amended software licenses for Portuguese and Spanish (Nano Akron)
54bcd260 Added Simplified Chinese electrum word list (Nano Akron)
2017-04-24 10:49:24 +02:00
Riccardo Spagni
ae1d816768 Merge pull request #1976
a7d78dda wallet2: fix --generate-from-json in RPC mode (moneromooo-monero)
2017-04-24 10:48:56 +02:00
Riccardo Spagni
ed082a747a Merge pull request #1973
e9fb44ed wallet cli: removed some inappropriate return-false (kenshi84)
2017-04-24 10:48:20 +02:00
Riccardo Spagni
e0b5a8349f Merge pull request #1972
934d8b57 changed kenshi84's GPG key (kenshi84)
2017-04-24 10:47:27 +02:00
Riccardo Spagni
865bb03ecf Merge pull request #1968
5e5b8512 Fix obsolete OpenSSL API usage (hyc)
6c72d6a0 Fix Android recognition (hyc)
e65d66fe Fix ARM64 identification (hyc)
a4673218 Clean up ARMv8-a aes_expand_key() (hyc)
a3d77901 Fix block_longhash_worker thread (hyc)
2017-04-24 10:46:23 +02:00
Riccardo Spagni
470ac0bfc7 Merge pull request #1967
6e985996 Easylogging: ELPP_STACKTRACE_ON_CRASH moved to ELPP_FEATURE_CRASH_LOG (MoroccanMalinois)
2017-04-24 10:46:01 +02:00
Riccardo Spagni
c1691ed58e Merge pull request #1966
7ff19f1e Easylogging: remove invalid static in function member definition (MoroccanMalinois)
2017-04-24 10:45:22 +02:00
Riccardo Spagni
042924b355 Merge pull request #1965
35755a91 Spelling mistake in About this project  paragraph (Andrei Muresan)
2017-04-24 10:44:49 +02:00
Riccardo Spagni
3d59ec7e68 Merge pull request #1962
aa02ff7f mv "Contributing" above install, compile, etc (Mike C)
a55bb375 Add link to CONTRIBUTING to README.md (Mike C)
09bbf96d Grouping CONTRIBUTING into digestable sections (Mike C)
dc35c736 Rename CONTRIBUTING to CONTRIBUTING.md (Mike C)
2017-04-24 10:44:10 +02:00
Riccardo Spagni
29a77c9b19 Merge pull request #1961
89d70756 wallet2: fix spurious output splitting when not merging destinations (moneromooo-monero)
2017-04-24 10:43:39 +02:00
Riccardo Spagni
0a6da8929d Merge pull request #1959
10e137be wallet2: mention escaping/quoting --password in help string (moneromooo-monero)
2017-04-24 10:43:13 +02:00
Riccardo Spagni
f65d739c41 Merge pull request #1954
110b6831 Resolve #92 add ability to create wallets thru RPC (Howard Chu)
2017-04-24 10:42:10 +02:00
Riccardo Spagni
acbe0b4849 Merge pull request #1938
bff90264 Add expected total reward to RPC "getblocktemplate". Only works from V5 fork onward - returns 0 before that block. (assylias)
2017-04-24 10:41:32 +02:00
Riccardo Spagni
a059e91d7f Merge pull request #1816
93e10f1c Simplified the implementation and features of span (Lee Clagett)
4a8f96f9 Improvements for epee binary to hex functions: (Lee Clagett)
2017-04-24 10:29:19 +02:00
Howard Chu
710b2e80c6 Silence clang++ warnings
Using defined(foo) in a macro expansion is undefined.
2017-04-23 23:44:19 +01:00
moneromooo-monero
5d86c9f4d5 easylogging++: default to creating categories by default
This avoids error spews from easylogging++ when we try to log
something before easylogging is initialized, which can happen
when errors happen at command line parsing time
2017-04-22 12:15:57 +01:00
moneromooo-monero
a6d5bb75fe wallet2: refer to triangular distribution for recent zone in comment
It was wrongly refering to equiprobable distribution, which I think
I'd originally done, but forgot to update the comment after changing
to triangular

Reported by smooth on IRC
2017-04-22 11:22:39 +01:00
moneromooo-monero
ac1aba90f8 wallet2: bias fake outs more towards recent outputs
Two recent papers quantified the real usage bias for the
real output in a ring being the true one, and shows that
the current biasing is much too weak.

While we wait for a better solution, we increase the ratio
of recent-to-total fake outputs, as well as decrease the
time window for recent outputs, so that half the fake outs
are selected within the last 1.8 day. Value plucked from
figure 10, page 11 of An Empirical Analysis of Linkability
in the Monero Blockchain, 2017, Miller et al.

This is also arbitrary, of course, but serves as a stopgap
till a better selection algorithm is chosen.
2017-04-22 10:29:03 +01: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
7f4beaa44a wallet2: fix removal of wrong txes from unconfirmed_payments
unconfirmed_payments changed from having the txid as key to
the payment id, and this was not changed to match.
2017-04-17 19:37:13 +01:00
Nano Akron
72d113dd38 Amended software licenses for Portuguese and Spanish 2017-04-16 12:15:59 +01:00
Nano Akron
54bcd260ff Added Simplified Chinese electrum word list 2017-04-16 12:06:53 +01:00
moneromooo-monero
a255a5407f simplewallet: allow multiline seed
People are likely to enter it in three lines as it is how it
is displayed at creation time
2017-04-16 11:52:30 +01:00
moneromooo-monero
5fce581ce3 mnemonics: ignore multiple whitespace between words 2017-04-16 11:29:21 +01:00
moneromooo-monero
a7d78dda77 wallet2: fix --generate-from-json in RPC mode
The daemon address was initialized too late
2017-04-14 22:12:20 +01:00
MoroccanMalinois
7ff19f1ec4 Easylogging: remove invalid static in function member definition 2017-04-12 23:01:16 +00:00
hyc
5e5b8512d6 Fix obsolete OpenSSL API usage
EVP_dss1() was deprecated and EVP_sha1() is the direct replacement.
Upstream libunbound already has this patch. Note that I haven't
added a test for HAVE_EVP_DSS1 since that was deprecated quite a
long time ago in OpenSSL, there's really no reason to support it.
2017-04-12 23:56:23 +01:00
hyc
6c72d6a058 Fix Android recognition
The official macro is __ANDROID__; ANDROID may or may not be defined.
2017-04-12 23:55:29 +01:00
hyc
e65d66fe04 Fix ARM64 identification
The actual arch flag the compiler recognizes is "armv8-a".
This is true for both gcc and clang.
2017-04-12 23:54:33 +01:00
hyc
a467321800 Clean up ARMv8-a aes_expand_key()
The inline asm was lying about its parameters
2017-04-12 23:53:08 +01:00
hyc
a3d779013d Fix block_longhash_worker thread
Wasn't getting its stack size initialized; crashes on Android
with a default stack size of 1MB.
2017-04-12 23:51:18 +01:00
MoroccanMalinois
6e98599634 Easylogging: ELPP_STACKTRACE_ON_CRASH moved to ELPP_FEATURE_CRASH_LOG 2017-04-12 22:47:59 +00:00
kenshi84
934d8b57c0 changed kenshi84's GPG key 2017-04-12 21:37:22 +09:00
kenshi84
e9fb44ed3c wallet cli: removed some inappropriate return-false 2017-04-12 21:33:19 +09:00
Lee Clagett
93e10f1cc4 Simplified the implementation and features of span 2017-04-11 16:35:14 -04:00
Lee Clagett
4a8f96f95d Improvements for epee binary to hex functions:
- Performance improvements
  - Added `span` for zero-copy pointer+length arguments
  - Added `std::ostream` overload for direct writing to output buffers
  - Removal of unused `string_tools::buff_to_hex`
2017-04-11 16:35:00 -04:00
Andrei Muresan
35755a91a0 Spelling mistake in About this project paragraph
I corrected a spelling mistake in the About this project paragraph.
2017-04-11 22:09:37 +03:00
Howard Chu
110b683152 Resolve #92 add ability to create wallets thru RPC
Reviewed and squashed. Open/Create is only allowed if no walletfile
was specified at startup.
2017-04-11 01:22:44 +01:00
Riccardo Spagni
9ed496bbc5 Merge pull request #1956
eb20f720 daemon: print average fee per byte in print_pool_stats (moneromooo-monero)
37be70bb daemon: add fee/byte when print pool transaction info (moneromooo-monero)
893f5a30 tx_pool: add blob size and fee/byte when logging a new tx (moneromooo-monero)
2017-04-11 00:34:46 +02:00
Riccardo Spagni
c8dd4c58ce Merge pull request #1955
5b632468 core: fix blob size cache, and reenable hash and blob size caches (moneromooo-monero)
2017-04-11 00:34:03 +02:00
Riccardo Spagni
878c4ee913 Merge pull request #1952
548075b1 daemon: new relay_tx command and RPC (moneromooo-monero)
2017-04-11 00:32:30 +02:00
Riccardo Spagni
4be94be168 Merge pull request #1951
0a7885bf Wallet API: fix Cold signing split tx (Jaquee)
2017-04-11 00:26:47 +02:00
Riccardo Spagni
e9ca165b1a Merge pull request #1950
f5bd3465 IOS CMAKE build settings (Jaquee)
d8a88d05 add IOS CMAKE toolchain (Jaquee)
2017-04-11 00:26:15 +02:00
Riccardo Spagni
9c2bcabcdd Merge pull request #1949
0ee018b4 wallet2: do not go over the target tx size if many destinations (moneromooo-monero)
9ae566d0 simplewallet: fix cold signing of split transactions (moneromooo-monero)
aae14a10 simplewallet: allow setting confirm-missing-payment-id in watch wallets (moneromooo-monero)
2017-04-11 00:25:09 +02:00
Riccardo Spagni
de68b00596 Merge pull request #1948
62efe5f6 mlog: direct log category changes to file only (moneromooo-monero)
2017-04-11 00:24:08 +02:00
Riccardo Spagni
6353e5b0e5 Merge pull request #1946
a38343bf miner: add a debug log in pause and resume (moneromooo-monero)
2017-04-11 00:23:43 +02:00
Riccardo Spagni
6e9b659c07 Merge pull request #1944
933e08f2 Replace deprecated tmpnam function. (Randi Joseph)
2017-04-11 00:20:57 +02:00
Riccardo Spagni
17e8ce8c35 Merge pull request #1940
17c7c62d Add per transaction fee to transfer command (Antti Keränen)
2017-04-11 00:19:32 +02:00
Riccardo Spagni
2037083b5f Merge pull request #1937
64377c90 Add other possible paths of AC power status file on Linux (Guillaume LE VAILLANT)
2017-04-11 00:15:24 +02:00
Riccardo Spagni
fcaac0e9e6 Merge pull request #1932
e251a2d7 readme: update min and rec versions and ND date (Gingeropolous)
cc30639f changed version of recommended monero version (Gingeropolous)
2017-04-11 00:14:28 +02:00
Riccardo Spagni
bf665e5991 Merge pull request #1931
89e100bc wallet cli: remove redundant password confirm in donate command (kenshi84)
2017-04-11 00:14:02 +02:00
Riccardo Spagni
541e1ff474 Merge pull request #1929
89949706 simplewallet: factor the per-variable code in set_variable (moneromooo-monero)
2017-04-11 00:13:40 +02:00
Riccardo Spagni
4600d0a9bb Merge pull request #1928
a28950da setThreadName moved in new version of easylogging++ (moneromooo-monero)
ea359b50 Fixup choice of easylogging++ vs libunwind stack trace code (moneromooo-monero)
1e6d8757 easylogging++: do not disable DEBUG level based on _DEBUG/NDEBUG (moneromooo-monero)
7a56fd6c easylogging++: detect DragonFly BSD as a UNIX (moneromooo-monero)
2c8b23e3 easylogging++: fix logging with static const header only data members (moneromooo-monero)
72663f4b easylogging++: allow clipping a common filename prefix (moneromooo-monero)
5bab0449 easylogging++: add file-only logs (moneromooo-monero)
db9dc7c2 eayslogging++: Fix bad memory access before opening any files (moneromooo-monero)
14620ca0 easylogging++: avoid creating directory/filename for the builtin default log file (moneromooo-monero)
0c1ad0ff easylogging++: Print thread ID in a nicer way (moneromooo-monero)
e7fabbd4 easylogging++: add categories (moneromooo-monero)
a8ac4f0a update easylogging++ to latest upstream (moneromooo-monero)
2017-04-11 00:13:11 +02:00
moneromooo-monero
a28950da73 setThreadName moved in new version of easylogging++ 2017-04-10 21:05:56 +01:00
moneromooo-monero
ea359b50cb Fixup choice of easylogging++ vs libunwind stack trace code 2017-04-10 21:05:47 +01:00
moneromooo-monero
1e6d875783 easylogging++: do not disable DEBUG level based on _DEBUG/NDEBUG 2017-04-10 21:05:43 +01:00
moneromooo-monero
7a56fd6c93 easylogging++: detect DragonFly BSD as a UNIX 2017-04-10 21:05:39 +01:00
moneromooo-monero
2c8b23e331 easylogging++: fix logging with static const header only data members 2017-04-10 21:05:35 +01:00
moneromooo-monero
72663f4b83 easylogging++: allow clipping a common filename prefix 2017-04-10 21:05:28 +01:00
moneromooo-monero
5bab044984 easylogging++: add file-only logs 2017-04-10 21:05:22 +01:00
moneromooo-monero
db9dc7c2df eayslogging++: Fix bad memory access before opening any files 2017-04-10 21:05:18 +01:00
moneromooo-monero
14620ca0bd easylogging++: avoid creating directory/filename for the builtin default log file 2017-04-10 21:05:15 +01:00
moneromooo-monero
0c1ad0ff1a easylogging++: Print thread ID in a nicer way 2017-04-10 21:05:11 +01:00
moneromooo-monero
e7fabbd470 easylogging++: add categories 2017-04-10 21:05:07 +01:00
moneromooo-monero
a8ac4f0a70 update easylogging++ to latest upstream 2017-04-10 21:05:02 +01:00
Mike C
aa02ff7f35 mv "Contributing" above install, compile, etc
The section on contributing to the Monero project is buried deep below lots of other information in the main README. This PR moves that section (which is very small since it links to a different document) up to an easier to locate place just below License information.
2017-04-09 13:32:25 -06:00
Mike C
a55bb37508 Add link to CONTRIBUTING to README.md 2017-04-09 13:29:26 -06:00
Mike C
09bbf96d85 Grouping CONTRIBUTING into digestable sections
The current document is very much a wall of text. This commit begins to re-structure that information into logical groups.
2017-04-09 13:26:26 -06:00
Mike C
dc35c73642 Rename CONTRIBUTING to CONTRIBUTING.md
Renaming document allows a CONTRIBUTING guide to be better formatted and therefore more accessible.
2017-04-09 13:14:09 -06:00
moneromooo-monero
89d707566a wallet2: fix spurious output splitting when not merging destinations 2017-04-08 11:13:28 +01:00
moneromooo-monero
10e137be3a wallet2: mention escaping/quoting --password in help string 2017-04-06 21:24:55 +01:00
moneromooo-monero
eb20f7209e daemon: print average fee per byte in print_pool_stats 2017-04-04 19:00:57 +01:00
moneromooo-monero
37be70bbd7 daemon: add fee/byte when print pool transaction info 2017-04-04 09:04:39 +01:00
moneromooo-monero
893f5a301e tx_pool: add blob size and fee/byte when logging a new tx 2017-04-04 09:04:11 +01:00
moneromooo-monero
5b63246813 core: fix blob size cache, and reenable hash and blob size caches 2017-04-03 22:19:57 +01:00
Jaquee
f5bd346573 IOS CMAKE build settings 2017-04-03 18:38:50 +02:00
Jaquee
d8a88d058e add IOS CMAKE toolchain 2017-04-03 18:38:43 +02:00
Jaquee
0a7885bf19 Wallet API: fix Cold signing split tx 2017-04-02 14:19:21 +02:00
moneromooo-monero
548075b1f5 daemon: new relay_tx command and RPC 2017-04-02 12:17:35 +01:00
moneromooo-monero
0ee018b407 wallet2: do not go over the target tx size if many destinations
If using a large input and many destinations, the code would
generate as many outputs as it could using that input, even if
it would bring the resulting tx above the max tx size.
2017-04-02 11:13:15 +01:00
moneromooo-monero
9ae566d0dd simplewallet: fix cold signing of split transactions
They'd be rejected as suspicious as the change goes to more
than one destination. However, split transactions will most
likely include fake zero amount change to random addresses,
so we only consider change with non zero amount for this.
2017-04-02 11:11:18 +01:00
moneromooo-monero
aae14a107a simplewallet: allow setting confirm-missing-payment-id in watch wallets
These can create transactions, even though they cannot sign them.
2017-04-02 11:10:11 +01:00
moneromooo-monero
62efe5f656 mlog: direct log category changes to file only
Because some people just won't even try to read what is written
and freak out because the word FATAL is in here, despite the
context making it clear it's not an error.
2017-04-01 11:29:43 +01:00
Antti Keränen
17c7c62d55 Add per transaction fee to transfer command
Allows priority argument default/unimportant/normal/elevated/priority to
be used per transaction in CLI wallet's transfer command. Resolves #1913.
2017-04-01 09:59:15 +03:00
moneromooo-monero
a38343bf68 miner: add a debug log in pause and resume 2017-03-31 20:01:58 +01:00
Randi Joseph
933e08f2f3 Replace deprecated tmpnam function. 2017-03-29 22:32:00 -04:00
Guillaume LE VAILLANT
64377c90b5 Add other possible paths of AC power status file on Linux 2017-03-28 11:35:18 +02:00
Gingeropolous
e251a2d7d5 readme: update min and rec versions and ND date
update min version to 0.10.3 and rec version to 0.10.3.1 and changed the not determined as of date to todays date.
2017-03-27 11:05:10 -04:00
Gingeropolous
cc30639f97 changed version of recommended monero version
... to v0.10.3.1 ... and minimum Monero version to v0.10.3.0 because the hardfork code is only in v0.10.3.x , not v0.10.2.1
2017-03-27 10:54:51 -04:00
kenshi84
89e100bc8c wallet cli: remove redundant password confirm in donate command 2017-03-27 11:02:20 +09:00
Riccardo Spagni
c9063c0b8f Merge pull request #1930
d1530f06 update version to 0.10.3.1 tag (Riccardo Spagni)
2017-03-26 23:32:54 +02:00
Riccardo Spagni
d1530f06bb update version to 0.10.3.1 tag 2017-03-26 23:29:31 +02:00
Riccardo Spagni
5f17d79527 Merge pull request #1927
a96f9bae core: disable tx/block hash cache (moneromooo-monero)
2017-03-26 22:36:43 +02:00
moneromooo-monero
899497069b simplewallet: factor the per-variable code in set_variable 2017-03-26 17:52:36 +01:00
moneromooo-monero
a96f9baeb4 core: disable tx/block hash cache
Looks like it doesn't work on win64
2017-03-26 02:21:01 +01:00
Riccardo Spagni
b1313aefd8 Merge pull request #1925
93b32892 Silence warning about possibly uninitialized pointer (Guillaume LE VAILLANT)
2017-03-25 17:36:23 +02:00
Riccardo Spagni
f64a0f2243 Merge pull request #1917
6e679478 mnemonics: sanity checks for word lists (moneromooo-monero)
e98f1114 mnemonics: misc cleanup (moneromooo-monero)
2017-03-25 17:35:52 +02:00
Guillaume LE VAILLANT
93b32892f7 Silence warning about possibly uninitialized pointer 2017-03-25 13:53:14 +01:00
moneromooo-monero
6e6794786a mnemonics: sanity checks for word lists
and a test to go with it

Remember to run the test when changing word lists, or simplewallet
will throw uncaught if that word list is used.
2017-03-25 12:14:01 +00:00
moneromooo-monero
e98f1114a0 mnemonics: misc cleanup
Pass relevant information to the base class instead of overwriting
default values later, use objects instead of pointers to objects
to avoid having to new objects unnecessarily.
2017-03-25 11:51:04 +00:00
Riccardo Spagni
a0af28ceba Merge pull request #1920
a50c4a4f wallet: option to merge destinations (moneromooo-monero)
2017-03-25 13:48:28 +02:00
moneromooo-monero
a50c4a4fad wallet: option to merge destinations
With the change from the original transfer method to the new
algorithm, payments to the same destination were merged. It
seemed like a good idea, optimizing space. However, it is a
useful tool for people who want to split large outputs into
several smaller ones (ie, service providers making frequent
payments, and who do not like a large chunk of their balance
being locked for 10 blocks after each payment).

Default to off, which is a change from the previous behavior.
2017-03-25 11:44:04 +00:00
Riccardo Spagni
e3d2b135e7 Merge pull request #1924
6d315459 core: avoid possible reordering bugs wth tx/bloch hash cache (moneromooo-monero)
2017-03-25 13:29:36 +02:00
Riccardo Spagni
119803f26e Merge pull request #1921
2bee92db Fixed typo in v5 hard fork finalized date (Derek Zhang)
d17179d1 Fixed typo in CLI wallet help message (Derek Zhang)
2017-03-25 13:29:11 +02:00
Riccardo Spagni
4737f61c81 Merge pull request #1919
0ad87db0 wallet: try to save large outputs when using an unneeded second input (moneromooo-monero)
2017-03-25 13:28:19 +02:00
Riccardo Spagni
721d1ca5ef Merge pull request #1918
5a4827ae Add Dutch mnemonics wordlist (Roy Jacobs)
2017-03-25 13:27:57 +02:00
moneromooo-monero
6d315459b6 core: avoid possible reordering bugs wth tx/bloch hash cache 2017-03-25 09:18:53 +00:00
Derek Zhang
2bee92dbd0 Fixed typo in v5 hard fork finalized date 2017-03-24 18:06:55 -07:00
Derek Zhang
d17179d14b Fixed typo in CLI wallet help message 2017-03-24 18:05:05 -07:00
Roy Jacobs
5a4827ae21 Add Dutch mnemonics wordlist 2017-03-25 00:58:35 +01:00
moneromooo-monero
0ad87db01f wallet: try to save large outputs when using an unneeded second input
When a single input is enough to satisfy a transfer, the code would
previously try to add a second input, to match the "canonical" makeup
of a transaction with two inputs and two outputs. This would cause
wallets to slowly merge outputs till all the monero ends up in a
single output, which causes trouble when making two transactions
one after the other, since change is locked for 10 blocks, and an
increasing portion of the remaining balance would end up locked on
each transaction.

There are two new settings (min-output-count and min-output-value)
which can control when to stop adding such unneeded second outputs.
The idea is that small "dust" outputs will still get added, but
larger ones will not.

Enable with, eg:

set min-output-count 10
set min-output-value 30

to avoid using an unneeded second output of 30 monero or more, if
there would be less than 10 such outputs left.

This does not invalidate any other reason why such outputs would
be used (ie, when they're really needed to satisfy a transfer, or
when randomly picked in the normal course of selection). This may
be improved in the future.
2017-03-24 21:04:08 +00:00
Riccardo Spagni
11e24bb2ba Merge pull request #1916
5a798358 blockchain: offset v5 addition date on testnet (moneromooo-monero)
2017-03-24 14:36:44 +02:00
Riccardo Spagni
92c2d79d10 Merge pull request #1915
a8646b09 Wallet API: add hard fork info functions (Jaquee)
2017-03-24 14:34:55 +02:00
Riccardo Spagni
20387386b9 Merge pull request #1914
31616af3 Fixes #1850 - Add French mnemonics wordlist (assylias)
2017-03-24 14:34:07 +02:00
Riccardo Spagni
f543377789 Merge pull request #1894
8bbcbcfb wallet rpc: enable solo mining (stoffu)
2017-03-24 14:33:47 +02:00
moneromooo-monero
5a7983585e blockchain: offset v5 addition date on testnet
to silence the update warning, since v5 was done very early
on testnet
2017-03-24 10:01:15 +00:00
Jaquee
a8646b0957 Wallet API: add hard fork info functions 2017-03-24 09:59:26 +01:00
assylias
31616af33d Fixes #1850 - Add French mnemonics wordlist 2017-03-23 21:53:20 +00:00
Riccardo Spagni
16f12f0628 Merge pull request #1912
00cbf720 ringct: move ge_frombytes_vartime failure error to warning (moneromooo-monero)
2017-03-23 11:47:26 +02:00
Riccardo Spagni
a73a886cb1 Merge pull request #1911
91d41090 tx_pool: ensure txes loaded from poolstate.bin have their txid cached (moneromooo-monero)
aaeb164c tx_pool: remove transactions if they're in the blockchain (moneromooo-monero)
558cfc31 core, wallet: faster tx pool scanning (moneromooo-monero)
f065234b core: cache tx and block hashes in the respective classes (moneromooo-monero)
2017-03-23 11:46:57 +02:00
Riccardo Spagni
7432f13898 Merge pull request #1910
9bccf1b1 Transfer help (Akademik Prokhor Zakharov)
2017-03-23 11:46:29 +02:00
Riccardo Spagni
8188f6bfe8 Merge pull request #1908
c94f8fac daemon: better error reporting in commands (moneromooo-monero)
2017-03-23 11:45:49 +02:00
Riccardo Spagni
a65a64f8e0 Merge pull request #1907
287ef36e Fix freebsd build (Lee Clagett)
2017-03-23 11:45:21 +02:00
Riccardo Spagni
4ec8a4c2b6 Merge pull request #1905
2242d8eb tx_pool: silence use of uninitialized warning (moneromooo-monero)
2017-03-23 11:45:00 +02:00
Riccardo Spagni
bff1bf27d9 Merge pull request #1898
cc8a4788 Updated Readme.md for v5 hardfork (xmr-eric)
2017-03-23 11:44:29 +02:00
moneromooo-monero
91d4109023 tx_pool: ensure txes loaded from poolstate.bin have their txid cached
The txid is not saved, and we want to make sure the transactions
have their txid cached while in the pool, since get_transactions
copies the transaction object, so any txid calculation on those
copies would not benefit any later caller, since the original tx
would be left without a cached txid.
2017-03-23 09:25:33 +00:00
moneromooo-monero
aaeb164cf6 tx_pool: remove transactions if they're in the blockchain
When starting up, if the pool state was not saved, the pool
might contain transactions which made it into the blockchain,
so these need removing
2017-03-23 09:25:29 +00: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
f065234b71 core: cache tx and block hashes in the respective classes
An idea from smooth
2017-03-23 09:25:17 +00:00
moneromooo-monero
00cbf72064 ringct: move ge_frombytes_vartime failure error to warning
Avoids scaring people when seeing some invalid txes
2017-03-22 21:26:38 +00:00
Akademik Prokhor Zakharov
9bccf1b11e Transfer help
New pull request because I couldn't figure out how to change the previous one.
1. For clarity, I want to focus the help text for the 'transfer' command on the most typical use case (a single payment). 
2. New users will prefer to use 'transfer', so the older method 'transfer_original' should refer to 'transfer' rather than the other way around.
2017-03-22 14:10:34 +01:00
moneromooo-monero
c94f8facf5 daemon: better error reporting in commands 2017-03-21 19:21:00 +00:00
Lee Clagett
287ef36ed8 Fix freebsd build 2017-03-21 10:41:21 -04:00
moneromooo-monero
2242d8ebd6 tx_pool: silence use of uninitialized warning
The result is not actually used when uninitialized
2017-03-21 12:21:19 +00:00
Riccardo Spagni
72f38bcc91 Merge pull request #1901
33f3cfde set USE_LTO_DEFAULT to false (Christoph Schnerch)
2017-03-21 14:13:00 +02:00
Riccardo Spagni
4b34531307 Merge pull request #1897
44a5b038 create a foreground non-interactive mode (Noah Watkins)
2017-03-21 14:10:36 +02:00
Riccardo Spagni
70e71a1845 Merge pull request #1904
995969b1 wallet: fix set_log not handling 0,xxx style settings (moneromooo-monero)
2017-03-21 14:09:42 +02:00
Riccardo Spagni
7769a6e757 Merge pull request #1903
350e99ae wallet2: cache which pool txes were scanned already (moneromooo-monero)
2017-03-21 14:09:19 +02:00
Riccardo Spagni
9d157b519d Merge pull request #1899
c1e9ccc7 wallet2: speed up transactions using remote nodes (moneromooo-monero)
2017-03-21 14:08:36 +02:00
moneromooo-monero
995969b190 wallet: fix set_log not handling 0,xxx style settings 2017-03-21 11:17:05 +00:00
moneromooo-monero
350e99ae57 wallet2: cache which pool txes were scanned already
This massively speeds up the wallet updating the pool on mainnet,
where the tx backlog is more than 500 txes.
2017-03-21 10:30:25 +00:00
Riccardo Spagni
37eebd9dcf Merge pull request #1902
7c033498 blockchain: lower the relay fee by 2% (moneromooo-monero)
266492e9 tx_pool: use new filling algorithm from v5 only (moneromooo-monero)
5b7c6ced wallet2: start using new fee priorities at v5, not 14 days laer (moneromooo-monero)
2017-03-20 23:29:43 +02:00
moneromooo-monero
7c03349869 blockchain: lower the relay fee by 2%
This ensures we accept txes with a fee that's slightly too small,
to accomodate blockchain median jitter
2017-03-20 19:14:12 +00:00
moneromooo-monero
266492e919 tx_pool: use new filling algorithm from v5 only 2017-03-20 18:46:57 +00:00
moneromooo-monero
5b7c6ced80 wallet2: start using new fee priorities at v5, not 14 days laer
Waiting would mean the fee used is 1x base, but the base will
have suddenly dropped
2017-03-20 18:34:56 +00:00
Christoph Schnerch
33f3cfdec0 set USE_LTO_DEFAULT to false 2017-03-20 13:24:30 +01:00
moneromooo-monero
c1e9ccc794 wallet2: speed up transactions using remote nodes
Asking for a full histogram from a remote node (since it's
untrusted) is pretty slow, and spams the remote node, so
we replace it by only adding a second input if we have rct
ones, which are for all intents and purposes always mixable.
2017-03-20 08:44:28 +00:00
xmr-eric
cc8a478887 Updated Readme.md for v5 hardfork 2017-03-20 02:00:06 -04:00
stoffu
8bbcbcfb0d wallet rpc: enable solo mining 2017-03-20 09:47:16 +09:00
Riccardo Spagni
73e8510717 Merge pull request #1896
a6f1d8fc core: call {prepare|cleanup}_handle_incoming_blocks when adding a mined block (moneromooo-monero)
2017-03-19 23:03:18 +02:00
Riccardo Spagni
dbfbd3b698 Merge pull request #1895
d3aaf740 Partial fix #1876, check thread in block_txn_start() (Howard Chu)
2017-03-19 23:02:32 +02:00
Riccardo Spagni
a85f750ee8 Merge pull request #1893
0effe196 Revert "Increase the log level for the info about log levels" (moneromooo-monero)
2017-03-19 22:59:26 +02:00
Riccardo Spagni
45fa27b56a Merge pull request #1892
df810a82 wallet-rpc bugfix: get_transfer_by_txid previously checking against payment id (kenshi84)
2017-03-19 22:58:55 +02:00
Riccardo Spagni
c97005723c Merge pull request #1890
50cd179a Removed boost/asio.hpp include from epee/string_tools.h (Lee Clagett)
2017-03-19 22:55:39 +02:00
Riccardo Spagni
4a6fc007c6 Merge pull request #1889
24ae7140 wallet: increase node_rpc_proxy timeout to match wallet2 (moneromooo-monero)
2017-03-19 22:55:10 +02: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
Howard Chu
d3aaf74080 Partial fix #1876, check thread in block_txn_start()
Don't allow use of existing batch txn if it's from the wrong thread
2017-03-19 12:27:03 +00:00
moneromooo-monero
0effe196e4 Revert "Increase the log level for the info about log levels"
We want to know which log categories are active.

This reverts commit 4f7bce6d20.
2017-03-19 09:39:28 +00:00
kenshi84
df810a8250 wallet-rpc bugfix: get_transfer_by_txid previously checking against payment id 2017-03-19 17:45:39 +09:00
Lee Clagett
50cd179a60 Removed boost/asio.hpp include from epee/string_tools.h 2017-03-18 22:05:14 -04:00
moneromooo-monero
24ae71404f wallet: increase node_rpc_proxy timeout to match wallet2 2017-03-18 23:06:06 +00:00
Riccardo Spagni
df140d90ee Merge pull request #1887
c5316d29 update version to 0.10.3.0 (Riccardo Spagni)
2017-03-18 21:56:56 +02:00
Riccardo Spagni
af82836ac6 Merge pull request #1888
d5fbfd67 daemon: fix missing close parenthesis in alt_chain_info output (moneromooo-monero)
2017-03-18 21:56:17 +02:00
moneromooo-monero
d5fbfd677c daemon: fix missing close parenthesis in alt_chain_info output
Reported by assylias_ on IRC
2017-03-18 19:19:32 +00:00
Riccardo Spagni
c5316d2929 update version to 0.10.3.0 2017-03-18 20:34:52 +02:00
Riccardo Spagni
82411cdf3a Merge pull request #1886
f9a2b527 simplewallet: allow setting tx priority in watch wallets (moneromooo-monero)
2017-03-18 20:31:37 +02:00
Riccardo Spagni
a48e41787b Merge pull request #1885
63d7cd88 daemon: alt_chain_info now prints fork depth (moneromooo-monero)
2017-03-18 20:31:12 +02:00
Riccardo Spagni
a6f1959d1c Merge pull request #1884
e9175cec wallet_rpc_server: make a few RPCs unavailable in restricted mode (moneromooo-monero)
2017-03-18 20:30:50 +02:00
Riccardo Spagni
f33a696ec7 Merge pull request #1883
d0238313 use const references in catch blocks (moneromooo-monero)
2017-03-18 20:30:19 +02:00
Riccardo Spagni
9aac64c238 Merge pull request #1882
3fa59755 wallet2: call is_key_image_spent in blocks in rescan_spent (moneromooo-monero)
9d134e86 wallet_rpc_server: add a rescan_spent RPC (moneromooo-monero)
2017-03-18 20:29:22 +02:00
Riccardo Spagni
4fb39a9d20 Merge pull request #1881
1a666c30 simplewallet: catch case where no transactions are made (moneromooo-monero)
2017-03-18 20:28:45 +02:00
Riccardo Spagni
d628ed2c14 Merge pull request #1880
8d787e24 bump version number (Riccardo Spagni)
2017-03-18 20:27:44 +02:00
Riccardo Spagni
585445d0bc Merge pull request #1879
c1c9eeaa p2p: use the fallback seed IPs when not enough seeds are found (moneromooo-monero)
2017-03-18 20:27:00 +02:00
Riccardo Spagni
ae6c92c2a5 Merge pull request #1875
b46620b0 Added hint to adjust jail configuration to readme for FreeBSD (S)
2017-03-18 20:23:27 +02:00
Riccardo Spagni
50b8af5b45 Merge pull request #1874
250c4cb3 wallet-rpc: enable openalias (stoffu)
2017-03-18 20:22:31 +02:00
moneromooo-monero
f9a2b5279d simplewallet: allow setting tx priority in watch wallets
Those can create unsigned transactions
2017-03-18 18:07:54 +00:00
moneromooo-monero
63d7cd8882 daemon: alt_chain_info now prints fork depth 2017-03-18 16:59:57 +00:00
moneromooo-monero
e9175cec07 wallet_rpc_server: make a few RPCs unavailable in restricted mode
Address book modification, setting tx nodes, importing key images
2017-03-18 13:01:53 +00:00
moneromooo-monero
d023831327 use const references in catch blocks 2017-03-18 12:56:07 +00:00
moneromooo-monero
3fa5975520 wallet2: call is_key_image_spent in blocks in rescan_spent
This is a potentially long lasting daemon RPC call
2017-03-18 12:47:07 +00:00
moneromooo-monero
9d134e8647 wallet_rpc_server: add a rescan_spent RPC 2017-03-18 12:04:17 +00:00
moneromooo-monero
1a666c3016 simplewallet: catch case where no transactions are made
This would otherwise be a silent noop, which is confusing.
This can happen if the daemon is started, but not yet ready
to service all requests, and this is a safe catch all.
2017-03-18 11:44:31 +00:00
moneromooo-monero
c1c9eeaaf7 p2p: use the fallback seed IPs when not enough seeds are found
In case the DNS seed(s) is/are down, which would otherwise
cause the fallback seeds to never be used. Also if the seeds
resolve to too few IPs.
2017-03-18 11:40:28 +00:00
Riccardo Spagni
8d787e2414 bump version number 2017-03-17 23:42:06 +01:00
S
b46620b062 Added hint to adjust jail configuration to readme for FreeBSD 2017-03-17 14:29:34 +01:00
stoffu
250c4cb3e0 wallet-rpc: enable openalias 2017-03-17 10:42:10 +09:00
Riccardo Spagni
c642d3224c Merge pull request #1869
3396a9f2 Add intervening v5 fork for increased min block size (moneromooo-monero)
2017-03-15 18:23:51 +01:00
Riccardo Spagni
e5b5d041f5 Merge pull request #1868
585c9176 Specify "524,288" iterations instead of "500,000" (darentuzi)
2017-03-15 18:21:43 +01:00
Riccardo Spagni
2f8e0af7f9 Merge pull request #1867
b54e19d0 protocol: fix wrong tx being looked up from fluffy block (moneromooo-monero)
2017-03-15 18:21:19 +01:00
Riccardo Spagni
6de3a70347 Merge pull request #1861
badec326 Adds a config file option to the wallet (Arne Brutschy)
2017-03-15 18:20:53 +01:00
moneromooo-monero
3396a9f2af Add intervening v5 fork for increased min block size
Minimum mixin 4 and enforced ringct is moved from v5 to v6.
v5 is now used for an increased minimum block size (from 60000
to 300000) to cater for larger typical/minimum transaction size.

The fee algorithm is also changed to decrease the base per kB
fee, and add a cheap tier for those transactions which we do
not care if they get delayed (or even included in a block).
2017-03-15 08:32:51 +00:00
darentuzi
585c917691 Specify "524,288" iterations instead of "500,000"
CryptoNight does exactly 524,288 iterations over the scratchpad as defined in CNS008, saying 500,000 could be confusing. I know its meant to give a rough idea (around 500k) to the reader but if you are reading the code, might as well know the exact number.
2017-03-14 16:39:44 +02:00
moneromooo-monero
b54e19d00e protocol: fix wrong tx being looked up from fluffy block
Found by smooth
2017-03-13 19:16:25 +00:00
Riccardo Spagni
c6102d5c1b Merge pull request #1864
74b216a1 core: don't try to re-relay an empty set of pool transactions (moneromooo-monero)
2017-03-13 17:22:33 +01:00
Riccardo Spagni
22e51c5d29 Merge pull request #1863
09e060fe protocol: fix fluffy to normal block dropping txes (moneromooo-monero)
2017-03-13 17:22:10 +01:00
Arne Brutschy
badec326d8 Adds a config file option to the wallet 2017-03-12 21:45:59 +01: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
09e060febb protocol: fix fluffy to normal block dropping txes 2017-03-12 14:14:51 +00:00
Riccardo Spagni
1dfed893e0 Merge pull request #1857
efc4c7b0 Separated dependency installation, git clone and build commands to reduce repeated work on failure (adot23)
2017-03-10 14:28:26 +00:00
Riccardo Spagni
a68496deec Merge pull request #1856
5d062e47 Improved wording in hard fork schedule section (Gingeropolous)
2017-03-10 14:27:55 +00:00
Riccardo Spagni
8fcede28df Merge pull request #1853
7d07c64f fix dependency: put HardFork back to cryptonote_basic, made some BlockchainDB functions virtual again to avoid missing symbols error (kenshi84)
2017-03-10 14:27:29 +00:00
kenshi84
7d07c64fe5 fix dependency: put HardFork back to cryptonote_basic, made some BlockchainDB functions virtual again to avoid missing symbols error 2017-03-10 11:22:39 +09:00
adot23
efc4c7b09f Separated dependency installation, git clone and build commands to reduce repeated work on failure 2017-03-09 16:03:28 +00:00
Gingeropolous
5d062e476e Improved wording in hard fork schedule section
changed hard forking to hard fork and fixed data format
2017-03-08 18:39:49 -05:00
Riccardo Spagni
b67877af6f Merge pull request #1852
088930fa Problem: misleading information about LMDB storage (Gareth)
2017-03-08 17:39:32 +00:00
Gareth
088930facc Problem: misleading information about LMDB storage
Solution: updated the comments to reflect the current situation in terms of LMDB implementation and no longer recommend 'memory' for blockchain storage in production use.
2017-03-08 21:29:08 +08:00
Riccardo Spagni
8b57e899d4 Merge pull request #1840
94c26b00 Update README.md (Gingeropolous)
4a76ec89 update Readme.md (Gingeropolous)
74bc86a2 updated reccommended Monero version in Readme (Gingeropolous)
2017-03-07 10:18:15 +00:00
Gingeropolous
94c26b00b7 Update README.md
There we go. Problem solved.
2017-03-06 15:05:13 -05:00
Gingeropolous
4a76ec899f update Readme.md
I think this does what was wanted... we still want a minimum version, right?
2017-03-06 14:58:54 -05:00
Riccardo Spagni
ba0767477d Merge pull request #1841
b553c282 rpc: fix BUILD_TAG mispelling (BUILDTAG) (moneromooo-monero)
02097c87 core: print the "new update found" message in cyan, for visibility (moneromooo-monero)
749ebace download: check available disk space before downloading (moneromooo-monero)
f36c5f1e download: give download threads distinct names (moneromooo-monero)
f6211322 core: make update download cancellable (moneromooo-monero)
63f0e074 download: async API (moneromooo-monero)
9bf017ed http_client: allow cancelling a download (moneromooo-monero)
0d90123c http_client: allow derived class to get headers at start (moneromooo-monero)
2017-03-06 15:17:08 +00:00
Riccardo Spagni
ea047307da Merge pull request #1848
cfa2564a blockchain: don't try to load an empty block hash set (moneromooo-monero)
38359036 blockchain_import: make --log-level understand categories (moneromooo-monero)
5fee8561 blockchain_export: make --log-level understand categories (moneromooo-monero)
50ebf661 blockchain_import: error out nicely on exceptions (moneromooo-monero)
87d57d9c blockchain_export: error out nicely on exceptions (moneromooo-monero)
2017-03-06 15:16:02 +00:00
Riccardo Spagni
5bcb25f3f8 Merge pull request #1846
4b48565c wallet: add password command (moneromooo-monero)
2017-03-06 15:14:59 +00:00
moneromooo-monero
cfa2564a40 blockchain: don't try to load an empty block hash set
If the blocks aren't being linked against a binary (such as
one of the blockchain utilities), the symbol will not be
NULL, but the size will be 0. This avoids a apurious warning
about the data hash.
2017-03-05 19:46:55 +00:00
moneromooo-monero
3835903650 blockchain_import: make --log-level understand categories 2017-03-05 19:45:22 +00:00
moneromooo-monero
5fee85616d blockchain_export: make --log-level understand categories 2017-03-05 19:45:00 +00:00
moneromooo-monero
50ebf66150 blockchain_import: error out nicely on exceptions 2017-03-05 19:25:01 +00:00
moneromooo-monero
87d57d9c59 blockchain_export: error out nicely on exceptions 2017-03-05 19:24:47 +00:00
moneromooo-monero
b553c282fb rpc: fix BUILD_TAG mispelling (BUILDTAG)
This ensures a manual or RPC update tries the right build tag,
rather than source, which is currently not setup
2017-03-05 16:59:39 +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
749ebacebd download: check available disk space before downloading
We don't check *while* the download happens, so it might
still be that we don't have enough space later
2017-03-05 16:59:32 +00:00
moneromooo-monero
f36c5f1e08 download: give download threads distinct names 2017-03-05 16:59:29 +00:00
moneromooo-monero
f6211322e5 core: make update download cancellable 2017-03-05 16:59:25 +00:00
moneromooo-monero
63f0e074eb download: async API 2017-03-05 16:58:48 +00:00
Riccardo Spagni
d423668954 Merge pull request #1845
f7547781 unit_tests: fix fee tests after quantization change (moneromooo-monero)
2017-03-05 18:23:38 +02:00
moneromooo-monero
9bf017edf2 http_client: allow cancelling a download 2017-03-05 16:23:34 +00:00
moneromooo-monero
0d90123cac http_client: allow derived class to get headers at start 2017-03-05 16:23:29 +00:00
Riccardo Spagni
e66866c1fc Merge pull request #1844
d18ff58a format_utils: fix typo in assert message (lethos3)
2017-03-05 18:13:49 +02:00
Riccardo Spagni
b375dde57f Merge pull request #1843
3964b30f Add dependency for blocksdat.o (Howard Chu)
2017-03-05 18:01:03 +02:00
Riccardo Spagni
8cb58dbb69 Merge pull request #1842
223fe5bb wallet: fix get_tranfers with multiple incoming txes with same pid (moneromooo-monero)
2017-03-05 17:52:42 +02:00
Riccardo Spagni
a861992359 Merge pull request #1839
c7dd0b15 Revert "wallet: fix insertion of pool transactions" (moneromooo-monero)
2017-03-05 17:47:18 +02:00
moneromooo-monero
4b48565c9e wallet: add password command
Also tweak wallet2 password code to verify password without
saying it's a new wallet, because it's assuming things.
2017-03-05 14:53:46 +00:00
moneromooo-monero
f75477819c unit_tests: fix fee tests after quantization change 2017-03-04 22:45:49 +00:00
lethos3
d18ff58a1c format_utils: fix typo in assert message
Fix two small typos as mentioned by reddit user nthterm.
2017-03-05 11:11:44 +13:00
Howard Chu
3964b30f2d Add dependency for blocksdat.o
To make sure it gets regenerated whenever checkpoints.dat changes
Likewise for blocks.o and testnet_blocks.o
2017-03-04 22:02:10 +00:00
moneromooo-monero
223fe5bbe2 wallet: fix get_tranfers with multiple incoming txes with same pid 2017-03-04 21:47:53 +00:00
Riccardo Spagni
4728ab977a Merge pull request #1837
31533493 core: quantize per kB fee to 8 decimals (moneromooo-monero)
2017-03-04 21:15:04 +02:00
Riccardo Spagni
f2d0f0174f Merge pull request #1836
cd71774d tx_pool: log separately "not ready" and "double spend" cases (moneromooo-monero)
2017-03-04 21:14:38 +02:00
Riccardo Spagni
734f7c26d5 Merge pull request #1834
e4437b25 Fix double-import (Howard Chu)
2017-03-04 21:14:19 +02:00
Gingeropolous
74bc86a272 updated reccommended Monero version in Readme 2017-03-04 08:02:19 -05:00
moneromooo-monero
c7dd0b1535 Revert "wallet: fix insertion of pool transactions"
This reverts commit d47dac9a88.

Callers actually expect the key to be payment id, so this
needs a lot more changes (like storing payment ids in the
structure, and possibly also to other existing structures
which do the same thing).
2017-03-04 12:41:19 +00:00
moneromooo-monero
3153349325 core: quantize per kB fee to 8 decimals 2017-03-03 23:31:56 +00:00
moneromooo-monero
cd71774d77 tx_pool: log separately "not ready" and "double spend" cases 2017-03-03 22:32:51 +00:00
Howard Chu
e4437b2551 Fix double-import
Incomplete ifdef cleanup in 9e82b694da
2017-03-03 21:45:14 +00:00
Riccardo Spagni
3e761c137d Merge pull request #1832
eb62dcc8 Remove redundant num_txs() method (Howard Chu)
296641e0 Fix #1824 don't end batch that we didn't start (Howard Chu)
2017-03-03 18:56:46 +02:00
Howard Chu
eb62dcc871 Remove redundant num_txs() method
Cleanup of bf1348b7e2
2017-03-03 16:52:45 +00:00
Howard Chu
296641e047 Fix #1824 don't end batch that we didn't start 2017-03-03 16:50:53 +00:00
Riccardo Spagni
4e92ef4aa4 Merge pull request #1831
9ae33b51 wallet api: fix parameters in wallet2callbackImpl (Jaquee)
1cf2f5a5 use txid in wallet2::process_new_transaction() (Jaquee)
2017-03-03 16:59:32 +02:00
Jaquee
9ae33b51fb wallet api: fix parameters in wallet2callbackImpl 2017-03-03 15:49:12 +01:00
Jaquee
1cf2f5a5c2 use txid in wallet2::process_new_transaction() 2017-03-03 15:48:32 +01:00
Riccardo Spagni
e24cd86c18 Merge pull request #1827
db1c7d80 wallet api: add missing mining options (Jaquee)
2017-03-03 14:31:28 +02:00
Riccardo Spagni
d35d626181 Merge pull request #1826
2c468dd4 allow user I/O in millinero, micronero, nanonero, piconero (moneromooo-monero)
2017-03-03 14:31:04 +02:00
Riccardo Spagni
2f9ecd4fba Merge pull request #1823
d47dac9a wallet: fix insertion of pool transactions (moneromooo-monero)
2017-03-03 14:30:24 +02:00
Riccardo Spagni
78a99fe7da Merge pull request #1820
7a44f38a Add support for the wallet to refresh pruned blocks (moneromooo-monero)
da18898f ringct: do not require range proof in decodeRct/decodeRctSimple (moneromooo-monero)
b49c6ab4 rpc: add a default category for daemon rpc (moneromooo-monero)
f113b92b core: add functions to serialize base tx info (moneromooo-monero)
6fd4b827 node_rpc_proxy: allow caching daemon RPC version (moneromooo-monero)
b5c74e40 wallet: invalidate node proxy cache when reconnecting (moneromooo-monero)
2017-03-03 14:30:02 +02:00
Riccardo Spagni
11f8e0d33f Merge pull request #1687
1a7e18bf Make gray peer selection uniform (Miguel Herranz)
f3be9991 Make get_random_gray_peer distribution uniform (Miguel Herranz)
2017-03-03 14:29:23 +02:00
Riccardo Spagni
9e10fac223 Merge pull request #1814
11a00df6 daemon: fix bc_dyn_stats via rpc (moneromooo-monero)
2017-03-03 14:14:51 +02:00
Riccardo Spagni
460836a2b7 Merge pull request #1813
b8a08f19 wallet: fix --log-file not working (moneromooo-monero)
2017-03-03 14:14:09 +02:00
Riccardo Spagni
1965c819f6 Merge pull request #1811
378d2bb1 Revert attempt to write to console on daemon shutdown (Nano Akron)
2017-03-03 14:13:52 +02:00
Riccardo Spagni
e10bf1d6c0 Merge pull request #1805
b7f85a30 mlog: default net.cn to FATAL (moneromooo-monero)
2017-03-03 14:12:21 +02:00
Riccardo Spagni
3787ffca80 Merge pull request #1804
12adb4a3 core: move hardfork back to cryptonote_core (moneromooo-monero)
2017-03-03 14:11:09 +02:00
Riccardo Spagni
14c6c910d7 Merge pull request #1803
53105743 Wallet API: Add support for daemon rpc login (Jaquee)
2017-03-03 14:10:44 +02:00
Riccardo Spagni
6aedd3d82b Merge pull request #1802
4f7bce6d Increase the log level for the info about log levels (Nano Akron)
2017-03-03 14:06:58 +02:00
Riccardo Spagni
27b7320fed Merge pull request #1801
96ce57d5 protocol: tone down a rate limit not implemented yet warning (moneromooo-monero)
2017-03-03 14:04:35 +02:00
Riccardo Spagni
321691a698 Merge pull request #1800
ea873ceb daemon/rpc: updates command and RPC (moneromooo-monero)
2017-03-03 14:04:06 +02:00
moneromooo-monero
2c468dd429 allow user I/O in millinero, micronero, nanonero, piconero 2017-03-02 19:02:41 +00:00
Jaquee
db1c7d80b1 wallet api: add missing mining options 2017-03-02 14:09:04 +01:00
moneromooo-monero
d47dac9a88 wallet: fix insertion of pool transactions
They were inserted using payment id as key, not txid
2017-02-28 21:19:24 +00:00
Miguel Herranz
1a7e18bfdf Make gray peer selection uniform
Prevents the system from always picking the gray peers with the most
recent last_seen.
2017-02-28 17:39:39 +01:00
moneromooo-monero
b8a08f199a wallet: fix --log-file not working 2017-02-28 09:07:56 +00:00
moneromooo-monero
7a44f38a7f Add support for the wallet to refresh pruned blocks 2017-02-27 22:29:00 +00:00
moneromooo-monero
da18898f0e ringct: do not require range proof in decodeRct/decodeRctSimple
These fields aren't used, and they'll actually be pruned in
some cases
2017-02-27 22:28:45 +00:00
moneromooo-monero
b49c6ab45d rpc: add a default category for daemon rpc 2017-02-27 20:25:35 +00:00
moneromooo-monero
f113b92b93 core: add functions to serialize base tx info
That is, information without signatures (for v1) nor range
proofs and MGs (for v2)
2017-02-27 20:24:39 +00:00
moneromooo-monero
6fd4b827fb node_rpc_proxy: allow caching daemon RPC version 2017-02-27 17:57:18 +00:00
moneromooo-monero
b5c74e4041 wallet: invalidate node proxy cache when reconnecting 2017-02-27 17:46:55 +00:00
Miguel Herranz
f3be9991d7 Make get_random_gray_peer distribution uniform
get_random_gray_peer is used to implement feeler connections, described
in: https://eprint.iacr.org/2015/263.pdf 2. Random selection
2017-02-27 18:29:50 +01:00
moneromooo-monero
11a00df699 daemon: fix bc_dyn_stats via rpc 2017-02-26 23:12:55 +00:00
Nano Akron
378d2bb1ff Revert attempt to write to console on daemon shutdown 2017-02-26 21:49:50 +00:00
moneromooo-monero
b7f85a30cd mlog: default net.cn to FATAL
Errors in this layer depend on how peers behave, and thus errors
are expected
2017-02-26 11:02:05 +00:00
Jaquee
5310574382 Wallet API: Add support for daemon rpc login 2017-02-25 22:17:35 +01:00
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
Nano Akron
4f7bce6d20 Increase the log level for the info about log levels 2017-02-25 14:58:18 +00:00
moneromooo-monero
96ce57d551 protocol: tone down a rate limit not implemented yet warning
it scares users
2017-02-25 12:10:29 +00:00
moneromooo-monero
ea873ceb2c daemon/rpc: updates command and RPC
subcommands "check", "download", and "update".
update is not yet implemented.
2017-02-24 23:18:27 +00:00
Riccardo Spagni
beee286c7b Merge pull request #1798
9a2157d7 update version (Riccardo Spagni)
2017-02-24 21:14:20 +02:00
Riccardo Spagni
44484acf2d Merge pull request #1799
2b188151 daemon: avoid pre-log-init spew on creating directories (moneromooo-monero)
cf2b1511 wallet: avoid pre-log-init spew on --version (moneromooo-monero)
2017-02-24 21:10:25 +02:00
moneromooo-monero
2b188151d4 daemon: avoid pre-log-init spew on creating directories 2017-02-24 19:08:20 +00:00
moneromooo-monero
cf2b151116 wallet: avoid pre-log-init spew on --version 2017-02-24 19:08:02 +00:00
Riccardo Spagni
9a2157d71a update version 2017-02-24 21:03:57 +02:00
Riccardo Spagni
57f15994a5 Merge pull request #1797
ada6a8a2 wallet_rpc_server: new --trusted-daemon flag (moneromooo-monero)
2017-02-24 20:33:04 +02:00
moneromooo-monero
ada6a8a2de wallet_rpc_server: new --trusted-daemon flag
and remove trusted_daemon fields from transfer RPCs,
it is much friendlier on users
2017-02-24 18:20:14 +00:00
Riccardo Spagni
6f9310bde8 Merge pull request #1795
3435038a add rpc timeouts to calls that might timeout (Riccardo Spagni)
2017-02-24 20:13:54 +02:00
Riccardo Spagni
1ef92074ad Merge pull request #1796
8c84d48c Updated default RPC timeout from 5 seconds to 15 seconds (Lee Clagett)
2017-02-24 20:13:28 +02:00
Lee Clagett
8c84d48caa Updated default RPC timeout from 5 seconds to 15 seconds 2017-02-24 12:55:17 -05:00
Riccardo Spagni
3435038a4d add rpc timeouts to calls that might timeout 2017-02-24 19:17:22 +02:00
Riccardo Spagni
1e7f783f69 Merge pull request #1776
e4dbea97 wallet2: fix wrong status on daemon shutdown/startup (Jaquee)
2017-02-24 14:22:55 +02:00
Riccardo Spagni
4cb6b265ee Merge pull request #1794
29b34ed1 blockchain_utilities: link against blockchain_db (moneromooo-monero)
2017-02-24 12:05:39 +02:00
Riccardo Spagni
0e7722ff40 Merge pull request #1793
eabe3bf2 simplewallet: updated help message for 'set ask-password' (kenshi84)
2017-02-24 12:04:28 +02:00
Riccardo Spagni
2f88c14f53 Merge pull request #1790
032fd354 Makefile add missing space for target android (MoroccanMalinois)
2017-02-24 12:03:46 +02:00
Riccardo Spagni
45c98e948b Merge pull request #1789
5db8df7b Unify dist files and prime (vdo)
38b9226f wrapper +x (vdo)
b4c90d56 Add meta icon for snap (vdo)
a2b90426 Add snap symlink (vdo)
2c51c4d1 Reorganize snap. Add daemon wrapper (vdo)
2017-02-24 12:02:45 +02:00
Riccardo Spagni
954cc459d2 Merge pull request #1786
4d05955d protocol: fix "sync done" message not appearing (moneromooo-monero)
2017-02-24 12:01:36 +02:00
Riccardo Spagni
ed6f2e8323 Merge pull request #1785
583a7b5c core: protect precomputed block hashes with SHA256 (moneromooo-monero)
2017-02-24 12:00:51 +02:00
Riccardo Spagni
b944949bb0 Merge pull request #1784
a1cd4db4 updated Dockerfile (Mine Coins)
2017-02-24 12:00:06 +02:00
Riccardo Spagni
6a66ecc079 Merge pull request #1783
a6f0abb7 README: libevent is replaced by minievent (Mine Coins)
2017-02-24 11:59:34 +02:00
Riccardo Spagni
b352330a3f Merge pull request #1781
520756c3 rpc: s/rcp/rpc/ (moneromooo-monero)
2017-02-24 11:58:38 +02:00
Riccardo Spagni
089df0a7a4 Merge pull request #1780
8262da81 rpc: make mining_status RPC work when syncing (moneromooo-monero)
2017-02-24 11:57:03 +02:00
Riccardo Spagni
2b38973b5c Merge pull request #1779
9effa553 core: bound the amount of entries in bad tx semantics cache (moneromooo-monero)
240054a7 core: remove a couple unused/obsolete bits (moneromooo-monero)
2017-02-24 11:55:54 +02:00
Riccardo Spagni
bc8d325216 Merge pull request #1777
3bdda60f Add print_pl_stats daemon command (Miguel Herranz)
2017-02-24 11:54:49 +02:00
moneromooo-monero
29b34ed156 blockchain_utilities: link against blockchain_db 2017-02-24 09:01:34 +00:00
kenshi84
eabe3bf20c simplewallet: updated help message for 'set ask-password' 2017-02-24 17:54:30 +09:00
MoroccanMalinois
032fd3543d Makefile add missing space for target android 2017-02-24 04:21:32 +00:00
vdo
5db8df7bb6 Unify dist files and prime 2017-02-24 03:28:22 +01:00
vdo
38b9226f44 wrapper +x 2017-02-24 02:53:59 +01:00
vdo
b4c90d5645 Add meta icon for snap 2017-02-24 02:52:15 +01:00
vdo
a2b90426bd Add snap symlink 2017-02-24 02:49:48 +01:00
moneromooo-monero
4d05955d53 protocol: fix "sync done" message not appearing 2017-02-24 01:28:56 +00:00
vdo
2c51c4d186 Reorganize snap. Add daemon wrapper 2017-02-24 02:20:02 +01:00
moneromooo-monero
583a7b5c74 core: protect precomputed block hashes with SHA256 2017-02-23 23:18:10 +00:00
Mine Coins
a1cd4db4e6 updated Dockerfile
- minified image: 75% smaller image
- statically-linked build
- add .dockerignore: no need to send repo to build context
2017-02-24 00:56:15 +02:00
Mine Coins
a6f0abb7c3 README: libevent is replaced by minievent 2017-02-24 00:36:36 +02:00
moneromooo-monero
520756c3c5 rpc: s/rcp/rpc/ 2017-02-23 21:02:15 +00:00
moneromooo-monero
8262da8137 rpc: make mining_status RPC work when syncing 2017-02-23 20:40:28 +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
240054a7f8 core: remove a couple unused/obsolete bits 2017-02-23 20:11:57 +00:00
Miguel Herranz
3bdda60f3e Add print_pl_stats daemon command 2017-02-23 18:20:17 +01:00
Jaquee
e4dbea976e wallet2: fix wrong status on daemon shutdown/startup 2017-02-23 12:41:21 +01:00
Riccardo Spagni
d666339853 Merge pull request #1775
700d218c fix broken test data (Riccardo Spagni)
0abddd64 fix broken checkpoints.dat (Riccardo Spagni)
2017-02-22 23:18:36 +02:00
Riccardo Spagni
700d218c5d fix broken test data 2017-02-22 23:12:21 +02:00
Riccardo Spagni
0abddd648d fix broken checkpoints.dat 2017-02-22 23:10:05 +02:00
Riccardo Spagni
f50704ec01 Merge pull request #1750
ada0e23a updates: fix user/auto url split (moneromooo-monero)
14d0e002 wallet2_api: add updates check api (moneromooo-monero)
2017-02-22 15:51:42 +02:00
moneromooo-monero
ada0e23a84 updates: fix user/auto url split 2017-02-22 13:04:07 +00:00
moneromooo-monero
14d0e00235 wallet2_api: add updates check api 2017-02-22 13:03:45 +00:00
Riccardo Spagni
7de43154d3 Merge pull request #1774
59013316 updates: remove testnet case (moneromooo-monero)
822577eb updates: we now have a user URL, and an automatic one (moneromooo-monero)
9f17b1a3 updates: s/monerod/monero/ for the main download (moneromooo-monero)
6a5dfb88 updates: add all update servers (moneromooo-monero)
72d40f13 updates: use HTTP, not HTTPS (moneromooo-monero)
2017-02-22 13:36:57 +02: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
moneromooo-monero
6a5dfb88d2 updates: add all update servers 2017-02-22 11:20:24 +00:00
moneromooo-monero
72d40f13a4 updates: use HTTP, not HTTPS
The files are hashed and the hashes signed
2017-02-22 09:08:35 +00:00
Riccardo Spagni
dc110a4391 Merge pull request #1773
27b477f6 update last few copyright year references (Riccardo Spagni)
2017-02-22 10:32:59 +02:00
Riccardo Spagni
27b477f68d update last few copyright year references 2017-02-22 09:55:06 +02:00
Riccardo Spagni
5aab25b60a Merge pull request #1765
5cfddd74 Add support for smart mining through wallet. (Dion Ahmetaj)
2017-02-22 09:37:31 +02:00
Riccardo Spagni
3ac5a785e0 Merge pull request #1762
dcf684c7 http_server_impl_base: set bind message to MGINFO (anonimal)
2017-02-22 09:37:05 +02: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
Riccardo Spagni
80a088a4fe Merge pull request #1767
708758b7 core: do not download an update we already downloaded (moneromooo-monero)
45101550 updates: use updates host, not downloads, for HTTP (moneromooo-monero)
2017-02-22 09:35:35 +02:00
Riccardo Spagni
1b55769e26 Merge pull request #1771
ec217cd1 README: add DragonFly BSD to build status + update FreeBSD version (anonimal)
2017-02-22 09:35:07 +02:00
Riccardo Spagni
c758e031f6 Merge pull request #1772
40946a29 kenshi84's gpg key (kenshi84)
2017-02-22 09:32:54 +02:00
kenshi84
40946a2981 kenshi84's gpg key 2017-02-22 12:36:27 +09:00
anonimal
ec217cd163 README: add DragonFly BSD to build status + update FreeBSD version 2017-02-22 02:49:29 +00:00
Noah Watkins
44a5b03841 create a foreground non-interactive mode
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2017-02-21 16:44:22 -08:00
moneromooo-monero
708758b737 core: do not download an update we already downloaded 2017-02-21 22:23:59 +00:00
moneromooo-monero
45101550f2 updates: use updates host, not downloads, for HTTP 2017-02-21 22:21:59 +00:00
Riccardo Spagni
72deb4846d updated fallback nodes 2017-02-21 22:40:26 +02:00
Riccardo Spagni
33329f5bd1 update version to 0.10.2 2017-02-21 22:24:01 +02:00
anonimal
dcf684c704 http_server_impl_base: set bind message to MGINFO 2017-02-21 18:30:43 +00:00
Riccardo Spagni
04a50a7ea4 update checkpoints.dat 2017-02-21 19:52:27 +02:00
Riccardo Spagni
e960be55ed Merge pull request #1761
56586bde mlog: restrict net.p2p to FATAL by default (moneromooo-monero)
2017-02-21 19:48:39 +02: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
56586bde9e mlog: restrict net.p2p to FATAL by default 2017-02-21 17:37:03 +00:00
Dion Ahmetaj
5cfddd74e9 Add support for smart mining through wallet. 2017-02-21 11:45:47 -05:00
Riccardo Spagni
2bdad8d695 Merge pull request #1760
efdd783c add openssl to readme (Riccardo Spagni)
058eed36 cmakify openssl (Riccardo Spagni)
2017-02-21 17:23:10 +02:00
Riccardo Spagni
5f48a1b000 Merge pull request #1759
417b126f Fix core_tests breaking on startup (moneromooo-monero)
2017-02-21 17:22:33 +02:00
Riccardo Spagni
ecbd3f0798 Merge pull request #1758
5664826a unit_tests: hardfork unit test now needs get_block_blob_from_height (moneromooo-monero)
2017-02-21 17:22:01 +02:00
Riccardo Spagni
41060f2090 Merge pull request #1757
5c3badb7 dns_utils: fix infinite recursion when distributing empty dns_urls (anonimal)
2017-02-21 17:18:03 +02:00
Riccardo Spagni
8ab127bda9 Merge pull request #1756
80749e59 More for PR #1724 (Howard Chu)
2017-02-21 17:17:25 +02:00
Riccardo Spagni
f0190bc45e Merge pull request #1755
86d8a33a BerkeleyDB code isn't usable any more, drop from dependencies (Howard Chu)
2017-02-21 17:17:02 +02:00
Riccardo Spagni
efdd783c20 add openssl to readme 2017-02-21 17:13:00 +02:00
Riccardo Spagni
058eed369b cmakify openssl 2017-02-21 17:11:12 +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
5664826a84 unit_tests: hardfork unit test now needs get_block_blob_from_height 2017-02-21 14:48:34 +00:00
anonimal
5c3badb749 dns_utils: fix infinite recursion when distributing empty dns_urls
load_txt_records_from_dns attempts to distribute `a = 0, b = -1` where
(b = dns_urls.size() - 1) and IntType is signed integer. This results in
an infinite recursion which leads to SIGSEGV.
2017-02-21 14:38:22 +00:00
Howard Chu
80749e59a8 More for PR #1724
Fix unit_tests build (get_output_key API change)
2017-02-21 13:53:13 +00:00
Howard Chu
86d8a33a4b BerkeleyDB code isn't usable any more, drop from dependencies 2017-02-21 13:33:43 +00:00
Riccardo Spagni
95f59f8c1f Merge pull request #1754
13cd544d Makefile: fix copy/paste mistake in targets (s/freebsd/mac) (moneromooo-monero)
2017-02-21 12:27:42 +02:00
moneromooo-monero
13cd544de3 Makefile: fix copy/paste mistake in targets (s/freebsd/mac) 2017-02-21 10:25:58 +00:00
Riccardo Spagni
2b67346ded Merge pull request #1703
e74b3ab5 core: add p2p bind port options from net_node (moneromooo-monero)
2017-02-21 11:53:20 +02: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
50fadea8fa Merge pull request #1747
26bd7aac wallet_api: fix logging init via api (moneromooo-monero)
2017-02-21 11:28:58 +02:00
Riccardo Spagni
31a189b7dd Merge pull request #1728
67693415 Fix compiler error about nested externs in slow_hash.c by moving declarations (NanoAkron)
2017-02-21 11:28:31 +02:00
Riccardo Spagni
b252afb0b0 Merge pull request #1736
424b76a4 Fix spurious synchronization status msgs (Howard Chu)
2017-02-21 11:27:49 +02: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
Riccardo Spagni
b67d35a76a Merge pull request #1725
53f04044 cryptonote_protocol: tweaks to the syncing speedup (moneromooo-monero)
2017-02-21 11:26:47 +02:00
Riccardo Spagni
98e34ca157 Merge pull request #1723
d43fde8a network_throttle: demote spammy logs to TRACE (moneromooo-monero)
2017-02-21 11:26:32 +02:00
Riccardo Spagni
88c752b476 Merge pull request #1721
2cde2c02 switch to boost::thread for mingw build (Lee Clagett)
2017-02-21 11:26:09 +02:00
Riccardo Spagni
826f49485e Merge pull request #1716
b560ed4a daemon: silence spurious warning about uninitialized variable (moneromooo-monero)
2017-02-21 11:23:38 +02:00
Riccardo Spagni
59d96eedd8 Merge pull request #1724
cca95c1c blockchain_db: do not throw on expected partial results getting keys (moneromooo-monero)
2017-02-21 11:23:03 +02:00
Riccardo Spagni
7d9e085dcd Merge pull request #1730
72c6b811 README: add/update AUR packaging information (anonimal)
2017-02-21 11:22:36 +02:00
Riccardo Spagni
565c99f670 Merge pull request #1731
a427235e core: add a missing newline on a string to be logged (moneromooo-monero)
b6a2230e unit_tests: fix minor blockchain_db regression (moneromooo-monero)
c488eca5 hardfork: tone down some logs (moneromooo-monero)
2017-02-21 11:21:57 +02:00
Riccardo Spagni
6994c85201 Merge pull request #1733
a493c0b1 BACKGROUND_MINING_MINER_MONITOR_INVERVAL_IN_SECONDS was odr-used, so required a definition. (Dion Ahmetaj)
2017-02-21 11:21:14 +02:00
Riccardo Spagni
d11dbe7dc2 Merge pull request #1744
a5a0a3c8 core: updates can now be downloaded (and SHA256 hash checked) (moneromooo-monero)
216f062e util: add a SHA256 function (moneromooo-monero)
4bf78492 mlog: only silence errors for net by default, not net.* (moneromooo-monero)
d282cfcc core: test key images against validity domain (moneromooo-monero)
efb72e74 http_client: add a couple consts (moneromooo-monero)
f640512c Optionally query moneropulse DNS records to check for updates (moneromooo-monero)
e3cae4ae core: display any fork warning at startup too (moneromooo-monero)
969ad710 dns_utils: fix first checked DNS entry being ignored (moneromooo-monero)
08c3f380 util: add a vercmp function to compare version numbers (moneromooo-monero)
e8a7525c dns_utils: factor TXT record loading code from checkpoint code (moneromooo-monero)
2017-02-21 11:16:43 +02:00
Riccardo Spagni
d2059dfab2 Merge pull request #1737
69ab14d9 More robust battery status handling. (Dion Ahmetaj)
2017-02-21 11:16:08 +02:00
Riccardo Spagni
d596722dfa Merge pull request #1749
5a3b1e98 wallet2: fix failure to send (relatedness check in wrong case) (moneromooo-monero)
2017-02-21 11:15:40 +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
216f062eb8 util: add a SHA256 function 2017-02-20 22:58:33 +00:00
moneromooo-monero
4bf7849297 mlog: only silence errors for net by default, not net.* 2017-02-20 22:58:29 +00:00
moneromooo-monero
d282cfcc46 core: test key images against validity domain 2017-02-20 22:58:25 +00:00
moneromooo-monero
efb72e74e2 http_client: add a couple consts 2017-02-20 22:58:21 +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
moneromooo-monero
e3cae4ae2e core: display any fork warning at startup too
This is a good time for the operator to be around and see it
2017-02-20 22:58:12 +00:00
moneromooo-monero
969ad710ba dns_utils: fix first checked DNS entry being ignored 2017-02-20 22:58:08 +00:00
moneromooo-monero
08c3f38031 util: add a vercmp function to compare version numbers
It is simple, supports simple x.y.z type numeric versions,
and does not attempt any kind of validation
2017-02-20 22:58:04 +00:00
moneromooo-monero
e8a7525ceb dns_utils: factor TXT record loading code from checkpoint code 2017-02-20 22:57:57 +00:00
Riccardo Spagni
5892f653c7 Merge pull request #1729
9925edcb rpc: fix some RPC calls not returning OK status when needed (moneromooo-monero)
2017-02-21 00:52:12 +02:00
Riccardo Spagni
ba633d33a8 Merge pull request #1732
83ec209f simplewallet: validate hex input size (moneromooo-monero)
2017-02-21 00:51:46 +02:00
Riccardo Spagni
675434ffab Merge pull request #1748
bed2d9f2 Get rid of directory lock (Howard Chu)
2e913676 Handle map resizes from other processes (Howard Chu)
bf1348b7 Can't cache num_txs or num_outputs either (Howard Chu)
dc53e9ee Add a few read txns to streamline (Howard Chu)
2017-02-21 00:51:13 +02:00
Riccardo Spagni
fb9e4e15ed Merge pull request #1752
c3283093 tx_pool: revert template filling changes (moneromooo-monero)
2017-02-21 00:48:14 +02:00
moneromooo-monero
c32830937c tx_pool: revert template filling changes
They are not ready yet
2017-02-20 22:43:37 +00:00
moneromooo-monero
5a3b1e983c wallet2: fix failure to send (relatedness check in wrong case)
A relatedness check was meant to be done in the case of adding
an extra output if just one was enough. This was mistakenly
added to the "preferred output" case.
2017-02-19 09:31:54 +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
Howard Chu
2e9136767e Handle map resizes from other processes 2017-02-18 22:22:24 +00:00
Howard Chu
bf1348b7e2 Can't cache num_txs or num_outputs either
Same reason as 3ff54bdd7a
2017-02-18 21:01:24 +00:00
Howard Chu
dc53e9eef2 Add a few read txns to streamline
Slight perf gain, but mainly to reduce spam at loglevel 3
2017-02-18 21:01:24 +00:00
moneromooo-monero
26bd7aac03 wallet_api: fix logging init via api 2017-02-18 20:44:23 +00:00
Lee Clagett
2cde2c02ca switch to boost::thread for mingw build 2017-02-16 20:10:23 -05:00
Dion Ahmetaj
69ab14d91e More robust battery status handling.
Added an extra path to check for linux power supply status.
Added ignore battery option. If set to true, then when we can't figure out
the power status, we'll assume the system is plugged in.
2017-02-16 14:35:01 -05:00
Dion Ahmetaj
a493c0b196 BACKGROUND_MINING_MINER_MONITOR_INVERVAL_IN_SECONDS was odr-used, so required a definition.
Instead of adding a declaration to cpp file, I changed it to non odr-used.
2017-02-15 11:15:12 -05:00
Howard Chu
424b76a4e5 Fix spurious synchronization status msgs
Only update target height if it's actually greater than the current target.
Only display "synchronized" when current height equals target.
2017-02-15 14:41:42 +00:00
moneromooo-monero
83ec209f42 simplewallet: validate hex input size 2017-02-14 19:45:46 +00:00
moneromooo-monero
a427235e30 core: add a missing newline on a string to be logged 2017-02-14 19:14:41 +00:00
moneromooo-monero
b6a2230e6f unit_tests: fix minor blockchain_db regression
Due to the change in ordering for adding block and tx data
to the database in f2986ccfc1,
adding a block twice now throws TX_EXISTS, not BLOCK_EXISTS.
2017-02-14 18:56:42 +00:00
moneromooo-monero
c488eca5e8 hardfork: tone down some logs 2017-02-14 18:56:39 +00:00
anonimal
72c6b81115 README: add/update AUR packaging information 2017-02-14 17:23:00 +00:00
moneromooo-monero
9925edcb1e rpc: fix some RPC calls not returning OK status when needed 2017-02-13 23:50:10 +00:00
moneromooo-monero
b560ed4ac6 daemon: silence spurious warning about uninitialized variable
Also fixes a leak
2017-02-13 22:39:25 +00:00
NanoAkron
67693415ff Fix compiler error about nested externs in slow_hash.c by moving declarations 2017-02-13 22:35:43 +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
moneromooo-monero
53f040445f cryptonote_protocol: tweaks to the syncing speedup
- only pause mining once we've got the lock (in practice, it'll
  already be paused by another thread if we can't get the lock
  at once though)
- do not call prepare_handle_incoming_blocks when we dismissed
  all the blocks, it only causes cleanup_handle_incoming_blocks
  to complain afterwards
2017-02-13 19:36:31 +00:00
moneromooo-monero
cca95c1c7a blockchain_db: do not throw on expected partial results getting keys
When scanning for outputs used in a set of incoming blocks,
we expect that some of the inputs in their transactions will
not be found in the blockchain, as they could be in previous
blocks in that set. Those outputs will be scanned there at
a later point. In this case, we add a flag to control wehther
an output not being found is expected or not.
2017-02-13 19:05:30 +00:00
moneromooo-monero
d43fde8a9b network_throttle: demote spammy logs to TRACE 2017-02-13 16:54:45 +00:00
Riccardo Spagni
3f171b931f Merge pull request #1719
59c9d165 tests: fixup include paths after cryptonote_core split (moneromooo-monero)
2017-02-12 23:57:34 +02:00
moneromooo-monero
59c9d165f8 tests: fixup include paths after cryptonote_core split 2017-02-12 21:47:39 +00:00
Riccardo Spagni
6e78915061 Merge pull request #1718
882db8e9 tools: log to the correct file (moneromooo-monero)
142e5e1e tools: set requested log level (moneromooo-monero)
2017-02-12 23:28:56 +02:00
Riccardo Spagni
e246dd1443 Merge pull request #1717
8bdc86be protocol: speed up sync by minimizing duplicate work (moneromooo-monero)
61dfa310 epee: fix some log macros not printing context nicely (moneromooo-monero)
2017-02-12 23:28:38 +02:00
Riccardo Spagni
f4e2539a32 Merge pull request #1715
8ec2a8d2 net_node: fix spurious warning about using uninitialized data (moneromooo-monero)
2017-02-12 23:27:08 +02:00
Riccardo Spagni
92fe31fd44 Merge pull request #1714
5adcb5a4 tx_pool: add a debug message when adding a tx to the pool (moneromooo-monero)
9faef1f8 cryptonote_protocol: misc fluffy block fixes (moneromooo-monero)
2017-02-12 23:26:02 +02:00
Riccardo Spagni
4e7bcad58f Merge pull request #1713
422ecc98 Fixup choice of easylogging++ vs libunwind stack trace code (moneromooo-monero)
2017-02-12 23:25:42 +02:00
Riccardo Spagni
b0e992237e Merge pull request #1712
3b6839cc mlog: move log level changes to global level (moneromooo-monero)
38a1b9c9 rpc: fix daemon mixed style set_log 2,category:level (moneromooo-monero)
28d0b11f mlog: s/Mew/New/ in log (moneromooo-monero)
2017-02-12 23:25:07 +02:00
Riccardo Spagni
b1df7f114d Merge pull request #1711
cf2e75eb daemon: fix crash on exit when mining (moneromooo-monero)
2017-02-12 23:24:49 +02:00
Riccardo Spagni
47687399fb Merge pull request #1709
b2ac939e Fix GUI building after libcryptonote_core was split (#1626) (iDunk5400)
2017-02-12 23:24:19 +02:00
Riccardo Spagni
6a261fa1bc Merge pull request #1708
f2986ccf db_lmdb: fix bad height saved in tx data (moneromooo-monero)
2017-02-12 23:23:46 +02:00
Riccardo Spagni
e6c29eb5fc Merge pull request #1706
7403e56f performance_tests: report small time per call in microseconds (moneromooo-monero)
cadada2d performance_tests: add tests for sc_reduce32 and cn_fast_hash (moneromooo-monero)
962c72b6 performance_tests: initialize logging at startup (moneromooo-monero)
2017-02-12 23:23:17 +02:00
Riccardo Spagni
c64e10c2d7 Merge pull request #1700
73785263 backtrace_symbols() requires -lexecinfo on dragonflybsd (Dan Miller)
2017-02-12 23:20:27 +02:00
Riccardo Spagni
71770d1a78 Merge pull request #1699
dd348549 make previous change portable (Timothy D. Prime)
32d7d048 fixes #1688 protect make debug-test from gtest (Timothy D. Prime)
2017-02-12 23:19:33 +02:00
Riccardo Spagni
af48b6cf22 Merge pull request #1582
ad95e650 Added a note about smart mining to status command. Fixed up a bug where I was resetting bg mining enabled instead of started. Upped the miner threshold. Also moved setting of enabled on start above miner thread creation since starting with true, then stopping, then starting with false resulted in race condition. (Dion Ahmetaj)
e4dfd2fb Changed ac_line_status to on_battery_power. (Dion Ahmetaj)
23c73269 Use defined directive to silence pre-proc warnings. (Dion Ahmetaj)
d2c7d0f6 Cleaned up some logging. Thanks to moneromooo for help. (Dion Ahmetaj)
68652cd9 Added some //TODO comments pertaining to returning enums instead of bools in order to be better able to handle failure states. (Dion Ahmetaj)
0b1045ed Moved around checking of AC power in order to bail quicker to sleep if not plugged in. (Dion Ahmetaj)
2937fdbb Moved setting of previous process times to block where background mining is started, and added an explicit sleep in that block to wait for some mining to occur. (Dion Ahmetaj)
21a1e025 Set background mining started bool to false on bg thread start. If mining::stop then mining::start, idle logic is re-run instead of starting immediately (if it was running before stop). (Dion Ahmetaj)
345ed482 Background/smart mining. If a users' computer is plugged into a power source, and CPU has been idle for some time, then begin mining to some threshold (don't destroy the users' CPU). (Dion Ahmetaj)
2017-02-12 23:11:44 +02:00
moneromooo-monero
882db8e9d9 tools: log to the correct file 2017-02-12 19:39:59 +00:00
moneromooo-monero
142e5e1eb4 tools: set requested log level
also move a couple logs from INFO to DEBUG
2017-02-12 18:48:39 +00:00
moneromooo-monero
8bdc86beb4 protocol: speed up sync by minimizing duplicate work
In particular, the prepare_handle_incoming_blocks call
is pretty lengthy, and entirely pointless in the common
case where several different connections will prepare
the exact same blocks.
2017-02-12 17:17:30 +00:00
moneromooo-monero
61dfa310d7 epee: fix some log macros not printing context nicely 2017-02-12 17:16:11 +00:00
moneromooo-monero
8ec2a8d2b0 net_node: fix spurious warning about using uninitialized data
This is only used to load, not save
2017-02-12 14:06:36 +00:00
moneromooo-monero
422ecc98e4 Fixup choice of easylogging++ vs libunwind stack trace code 2017-02-12 13:59:21 +00:00
moneromooo-monero
5adcb5a48c tx_pool: add a debug message when adding a tx to the pool 2017-02-12 12:33:48 +00:00
moneromooo-monero
9faef1f83a cryptonote_protocol: misc fluffy block fixes
- fix wrong block being used when a new block is received between
  a node elaying a fluffy block and sending a new fluffy block
  with txes a peer did not have
- misc a neverending ping pong requesting the same missing txids
  when a new block is received in the meantime, causing the top
  block to not be the one we need
- send the original fluffy block message block height when sending
  a new fluffy block, not the current top height, which might
  have been updated since
- avoid sending back the whole block blob when asking for txes,
  send only the hash instead
- plus misc cleanup and additional debugging logs
2017-02-12 12:33:45 +00:00
moneromooo-monero
3b6839cc96 mlog: move log level changes to global level
Makes it more likely to show up
2017-02-12 11:45:22 +00:00
moneromooo-monero
38a1b9c956 rpc: fix daemon mixed style set_log 2,category:level 2017-02-12 11:37:09 +00:00
moneromooo-monero
28d0b11fde mlog: s/Mew/New/ in log 2017-02-12 11:35:04 +00:00
moneromooo-monero
cf2e75ebb3 daemon: fix crash on exit when mining
When exiting while the miner is running, finding a block after
the p2p layer has been shutdown will cause a crash as the now
uninitialized p2p layer is asked to relay the found block to
any peers.
2017-02-12 11:09:21 +00:00
iDunk5400
b2ac939eb3 Fix GUI building after libcryptonote_core was split (#1626) 2017-02-11 17:00:55 +01:00
moneromooo-monero
f2986ccfc1 db_lmdb: fix bad height saved in tx data
The recent change to not keep separate track of the blockchain
height caused the reported height to jump early in the lmdb
transaction (when the block data is added to the blocks table),
rather than at the end, after everything succeeded. Since the
block data is added before the transaction data, this caused
the transaction data to be saved with a height one more than
its expected value.

Fix this by saving the block data last. This should have no
side effects.
2017-02-11 10:16:18 +00:00
Dion Ahmetaj
ad95e65028 Added a note about smart mining to status command. Fixed up a bug where I was resetting bg mining enabled instead of started. Upped the miner threshold. Also moved setting of enabled on start above miner thread creation since starting with true, then stopping, then starting with false resulted in race condition. 2017-02-10 18:07:43 -05:00
Dion Ahmetaj
e4dfd2fb63 Changed ac_line_status to on_battery_power. 2017-02-10 18:07:42 -05:00
Dion Ahmetaj
23c73269ca Use defined directive to silence pre-proc warnings. 2017-02-10 18:07:41 -05:00
Dion Ahmetaj
d2c7d0f6b0 Cleaned up some logging. Thanks to moneromooo for help. 2017-02-10 18:07:41 -05:00
Dion Ahmetaj
68652cd94d Added some //TODO comments pertaining to returning enums instead of bools in order to be better able to handle failure states. 2017-02-10 18:07:41 -05:00
Dion Ahmetaj
0b1045ed7d Moved around checking of AC power in order to bail quicker to sleep if not plugged in. 2017-02-10 18:07:40 -05:00
Dion Ahmetaj
2937fdbbbf Moved setting of previous process times to block where background mining is started, and added an explicit sleep in that block to wait for some mining to occur. 2017-02-10 18:07:40 -05:00
Dion Ahmetaj
21a1e0252f Set background mining started bool to false on bg thread start. If mining::stop then mining::start, idle logic is re-run instead of starting immediately (if it was running before stop). 2017-02-10 18:07:39 -05:00
Dion Ahmetaj
345ed4823c Background/smart mining. If a users' computer is plugged into a power
source, and CPU has been idle for some time, then begin mining to some
threshold (don't destroy the users' CPU).

This patch only supports windows and linux (I've only tested on Win64 and
Ubuntu).

The variables currently default to pretty conservative values (i.e. 20%
CPU mining threshold).
2017-02-10 18:07:39 -05:00
moneromooo-monero
7403e56fb4 performance_tests: report small time per call in microseconds
This is to not report quick operations as 0 milliseconds
2017-02-10 22:56:34 +00:00
Riccardo Spagni
cb54eeaa31 Merge pull request #1698
9459f331 simplewallet: print error when address is wrong (kenshi84)
2017-02-11 00:54:30 +02:00
Riccardo Spagni
d1b7ad3f1a Merge pull request #1696
6ea3e3cc Fix race in setThreadName/getThreadName (Lee Clagett)
2017-02-11 00:53:31 +02:00
Riccardo Spagni
c7750b2570 Merge pull request #1694
27c3a0ea ITS#8582 keep mutex at end of struct (Howard Chu)
2017-02-11 00:47:37 +02:00
Riccardo Spagni
9ed3e1bb6a Merge pull request #1693
5d00659e disable ELPP_STACKTRACE_ON_CRASH for android (MoroccanMalinois)
2017-02-11 00:40:17 +02:00
Riccardo Spagni
eacf2124b6 Merge pull request #1689
ce7fcbb4 Add server auth to monerod, and client auth to wallet-cli and wallet-rpc (Lee Clagett)
2017-02-11 00:35:25 +02:00
Miguel Herranz
8277e67f11 Add anchor connections
Based on https://eprint.iacr.org/2015/263.pdf 4. Anchor connections.

Peer list serialisation version bumped to 5.
2017-02-10 23:28:54 +01:00
Riccardo Spagni
9296960081 Merge pull request #1686
bceaf4b7 wallet2: fix transactions not considering rct inputs (moneromooo-monero)
2017-02-11 00:22:17 +02:00
Riccardo Spagni
9781ecaa70 Merge pull request #1685
7549116e Wallet API: Easylogger wrapper for gui (Jaquee)
2017-02-11 00:21:51 +02:00
Riccardo Spagni
003a51d399 Merge pull request #1682
1c782a92 easylogging++: do not disable DEBUG level based on _DEBUG/NDEBUG (moneromooo-monero)
2017-02-11 00:21:31 +02:00
Riccardo Spagni
4feaa790e2 Merge pull request #1680
db0a5392 Clarify in/out connections for users (NanoAkron)
2017-02-11 00:21:12 +02:00
Riccardo Spagni
d1b31c0f45 Merge pull request #1626
8027ce0c extract some basic code from libcryptonote_core into libcryptonote_basic (kenshi84)
2017-02-11 00:20:41 +02:00
moneromooo-monero
cadada2d65 performance_tests: add tests for sc_reduce32 and cn_fast_hash 2017-02-10 18:45:18 +00:00
moneromooo-monero
962c72b624 performance_tests: initialize logging at startup 2017-02-10 18:44:47 +00:00
Dan Miller
7378526393 backtrace_symbols() requires -lexecinfo on dragonflybsd
freebsd also needs -lexecinfo for backtrace()
2017-02-09 11:22:12 -08:00
Timothy D. Prime
dd3485492d make previous change portable
Use cmake's _PREFIX and _SUFFIX to determine the library location.
2017-02-08 13:34:35 -08:00
Timothy D. Prime
32d7d04858 fixes #1688 protect make debug-test from gtest
In simple terms, add_subdirectory() is replaced with ExternalProject_Add().

This change is inspired by https://crascit.com/2015/07/25/cmake-gtest/
with one difference, no download, using the source we already have.

Before this change, make debug-test must be preceded by make clean.
Otherwise, a subsequent build would be polluted by cmake options made
by tests/gtest/.

Also removed the changed compiler flags.  My test build did not have
the affected warnings.
2017-02-08 12:38:41 -08:00
kenshi84
9459f33178 simplewallet: print error when address is wrong 2017-02-08 23:04:48 +09:00
kenshi84
8027ce0c75 extract some basic code from libcryptonote_core into libcryptonote_basic 2017-02-08 22:45:15 +09:00
Riccardo Spagni
99ee3fd17e Merge pull request #1679
4efc926d Wallet API: Catch error from tools::is_local_address (Jaquee)
2017-02-08 12:53:57 +02:00
Riccardo Spagni
8d1562077f Merge pull request #1678
c833a39a cmake set atomic for android (MoroccanMalinois)
2017-02-08 12:53:19 +02:00
Riccardo Spagni
d30b64f457 Merge pull request #1674
92978b2c common: fix link error on at least one platform (no clue which one) (moneromooo-monero)
2017-02-08 12:51:11 +02:00
Riccardo Spagni
30e38cd6a3 Merge pull request #1683
bab1e9a3  bugfix: infinite recursion in get_account_address_from_str_or_url (kenshi84)
2017-02-08 12:48:54 +02:00
Lee Clagett
6ea3e3ccc7 Fix race in setThreadName/getThreadName 2017-02-07 21:33:26 -05:00
Howard Chu
27c3a0ea9f ITS#8582 keep mutex at end of struct
since it's variable size on Linux/glibc
2017-02-07 15:12:05 +00:00
moneromooo-monero
bceaf4b788 wallet2: fix transactions not considering rct inputs
I broke this very recently in 2bf029be17
and didn't notice in time
2017-02-06 20:20:22 +00:00
Lee Clagett
ce7fcbb4ae Add server auth to monerod, and client auth to wallet-cli and wallet-rpc 2017-02-06 01:15:41 -05:00
MoroccanMalinois
5d00659e1d disable ELPP_STACKTRACE_ON_CRASH for android 2017-02-06 05:14:15 +00:00
Jaquee
7549116ec3 Wallet API: Easylogger wrapper for gui 2017-02-05 20:12:01 +01:00
kenshi84
bab1e9a397 bugfix: infinite recursion in get_account_address_from_str_or_url 2017-02-05 23:20:16 +09:00
moneromooo-monero
1c782a923d easylogging++: do not disable DEBUG level based on _DEBUG/NDEBUG 2017-02-05 12:47:53 +00:00
Riccardo Spagni
3473af00ad Merge pull request #1655
b14d109b update wallet api tests (Jaquee)
0cc50bdd GUI: Improved refresh performance (Jaquee)
805625b5 wallet api: Remove initAsync() and don't start refresh automatically on init (Jaquee)
031b060a wallet2::init() - disconnect before init if connected Makes it possible for GUI to reinit with new daemon without closing and reopening wallet. (Jaquee)
2017-02-05 13:42:41 +02:00
NanoAkron
db0a5392a5 Clarify in/out connections for users 2017-02-05 11:15:51 +00:00
moneromooo-monero
92978b2c0f common: fix link error on at least one platform (no clue which one)
Bug and fix reported by tdprime
2017-02-05 10:55:55 +00:00
Jaquee
4efc926d28 Wallet API: Catch error from tools::is_local_address 2017-02-05 11:08:05 +01:00
MoroccanMalinois
c833a39a4d cmake set atomic for android 2017-02-05 04:33:33 +01:00
Jaquee
b14d109bae update wallet api tests 2017-02-04 23:25:10 +01:00
Jaquee
0cc50bdd11 GUI: Improved refresh performance 2017-02-04 23:25:05 +01:00
Jaquee
805625b541 wallet api: Remove initAsync() and don't start refresh automatically on init 2017-02-04 23:25:03 +01:00
Jaquee
031b060af0 wallet2::init() - disconnect before init if connected
Makes it possible for GUI to reinit with new daemon without closing and reopening wallet.
2017-02-04 23:10:20 +01:00
Riccardo Spagni
e56bf442c3 Merge pull request #1669
4f5b130d wallet_rpc_server: add address book RPC calls (moneromooo-monero)
2017-02-04 17:28:53 +02:00
Riccardo Spagni
9547e79af5 Merge pull request #1670
c3d7a198 mlog: probable fix for gmtime_r not being available on windows (moneromooo-monero)
2017-02-04 17:28:23 +02:00
Riccardo Spagni
5da4650cba Merge pull request #1671
cd34fc65 Use easylogging++'s stack trace facility where possible (moneromooo-monero)
2017-02-04 17:27:54 +02:00
Riccardo Spagni
602f31d187 Merge pull request #1672
cbdfa757 mlog: fix default logging being not verbose enough (moneromooo-monero)
2017-02-04 17:27:19 +02:00
Riccardo Spagni
c3c281e699 Merge pull request #1666
03ff3639 Fix missing parentheses (Miguel Herranz)
2017-02-04 17:26:19 +02:00
Riccardo Spagni
bcb7b0a9af Merge pull request #1665
34719071 simplewallet: cleanup (moneromooo-monero)
a9a9b64b simplewallet: fix build (unqualified type not in current scope) (moneromooo-monero)
2017-02-04 17:21:11 +02:00
Riccardo Spagni
eb21389953 Merge pull request #1664
b5cb8861 core: fix integrated addresses breaking with auto zero change (moneromooo-monero)
2017-02-04 17:20:02 +02:00
Riccardo Spagni
31cf4e7362 Merge pull request #1640
f97526e6 simplewallet: option to always ask password for any crytical operations (kenshi84)
2017-02-04 17:18:38 +02:00
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
kenshi84
f97526e641 simplewallet: option to always ask password for any crytical operations 2017-02-03 09:38:12 +09:00
Miguel Herranz
03ff363982 Fix missing parentheses 2017-02-02 22:05:31 +01: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
Riccardo Spagni
b01990124e Merge pull request #1663
bbcc3a12 Add missing include (Miguel Herranz)
2017-02-02 22:41:58 +02: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
da9174c8ee Merge pull request #1656
edfd7f6e Workaround VL32 cursor refcounting miscount (Howard Chu)
2017-02-02 21:39:03 +02:00
Riccardo Spagni
f4fe39ca92 Merge pull request #1654
084aef70 Added days uptime to the status message (NanoAkron)
2017-02-02 21:38:15 +02:00
Riccardo Spagni
58c87786ae Merge pull request #1652
fba9332d Changed console output for transaction from L0 to L1 (NanoAkron)
2017-02-02 21:36:56 +02:00
Riccardo Spagni
345396e056 Merge pull request #1651
fc91e6a7 Fixed a deadlock issue with easylogger++ (NanoAkron)
2017-02-02 21:36:07 +02:00
Riccardo Spagni
011c5a8a7c Merge pull request #1647
2bf029be wallet2: fix corner case failing to send a second output (moneromooo-monero)
2017-02-02 21:35:31 +02:00
Riccardo Spagni
3aa008e4c6 Merge pull request #1646
95f3e193 Update and use blockchain data files defines (Miguel Herranz)
2017-02-02 21:34:31 +02:00
Riccardo Spagni
10b625079b Merge pull request #1645
9bd9906e Factor is_address_local code into a tools function (moneromooo-monero)
2017-02-02 21:27:45 +02:00
Riccardo Spagni
614400e5af Merge pull request #1643
69d2ad39 wallet_rpc_server: fix logs going to the wrong file (moneromooo-monero)
2017-02-02 21:26:56 +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
ab2b3480b2 Merge pull request #1639
48aa9cf0 Add change_password for simplewallet (Ashley Perpetual)
2017-02-02 21:22:30 +02:00
Riccardo Spagni
72aa788a0e Merge pull request #1636
cc1462e0 Add concurrency check to rpc mining to ensure not too many threads. number of cores times 4 or 257. (Ashley Perpetual)
2017-02-02 21:12:13 +02:00
Miguel Herranz
bbcc3a125f Add missing include
Fails to build without it.
2017-02-02 19:54:17 +01:00
Riccardo Spagni
5bb95fc613 Merge pull request #1634
99f58437 Fix invalid + of std::string and int (Timothy D. Prime)
2017-02-02 19:43:05 +02:00
Riccardo Spagni
a6f61b8419 Merge pull request #1631
58e82506 Blockfill - Sort tx pool correctly (Alexis Enston)
5f7a8741 Blockfill - Take TX fees into account properly (Alexis Enston)
4ecab0d8 Consider empty block when filling with TXs (Alexis Enston)
2017-02-02 19:41:25 +02:00
Riccardo Spagni
5fb3f97a55 Merge pull request #1629
c02e1cb9 Updates to epee HTTP client code   - http_simple_client now uses std::chrono for timeouts   - http_simple_client accepts timeouts per connect / invoke call   - shortened names of epee http invoke functions   - invoke command functions only take relative path, connection     is not automatically performed (Lee Clagett)
2017-02-02 19:32:01 +02:00
Riccardo Spagni
10bf54bfc9 Merge pull request #1628
66665003 Clear feedback to user when daemon has stopped successfully (NanoAkron)
2017-02-02 18:44:41 +02:00
Riccardo Spagni
ca2e2c2453 Merge pull request #1627
55a8e982 moved get_account_address_from_str_or_url from libcommon to libcryptonote_core (kenshi84)
2017-02-02 18:24:08 +02:00
Riccardo Spagni
cc03036e3e Merge pull request #1624
a39cd745 rpc: fix bc_dyn_stats not setting grace blocks (moneromooo-monero)
2017-02-02 18:20:07 +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
Riccardo Spagni
05de1bc398 Merge pull request #1614
7b6a9e91 Added instructions for getting stack traces with gdb (NanoAkron)
2017-02-02 18:08:18 +02:00
NanoAkron
fc91e6a75a Fixed a deadlock issue with easylogger++
Ubuntu 16.04/GCC 5.4.0/ARMv8 fix to match previous recursive mutex fix for GCC
2017-02-01 10:16:57 +00:00
Howard Chu
edfd7f6e07 Workaround VL32 cursor refcounting miscount
Don't try to deref cursor page if txn's pagelist is empty
2017-01-31 10:38:12 +00:00
NanoAkron
084aef700b Added days uptime to the status message
Also broke down the time calculations for legibility
2017-01-31 09:49:32 +00:00
luigi1111
15eb2bcf6f Merge pull request #1649
aa95619 GUI: Add install target for epee (Jaqueeee)
2017-01-30 17:57:19 -06:00
luigi1111
1cb5905e71 Merge pull request #1637
6b14576 Fix clang build failure, caused by mixing C and C++ (tdprime)
2017-01-30 17:55:52 -06:00
luigi1111
3cef7fbbb6 Merge pull request 1635
774a213 Wallet API: Create wallet from keys (Jaqueeee)
2017-01-30 17:09:38 -06:00
luigi1111
ef987e5e49 Merge pull request 1648
8c8482a wallet_rpc_server: fix short payment id validation in transfer (moneromooo-monero)
2017-01-30 17:03:07 -06:00
Jaquee
aa9561909a GUI: Add install target for epee 2017-01-30 23:29:05 +01:00
Jaquee
774a21394a Wallet API: Create wallet from keys 2017-01-30 23:28:09 +01:00
NanoAkron
fba9332de8 Changed console output for transaction from L0 to L1 2017-01-30 03:24:51 +00:00
moneromooo-monero
8c8482ac98 wallet_rpc_server: fix short payment id validation in transfer 2017-01-29 16:10:20 +00:00
Ashley Perpetual
48aa9cf035 Add change_password for simplewallet 2017-01-29 03:04:17 +08: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
Miguel Herranz
95f3e193f0 Update and use blockchain data files defines 2017-01-28 15:55:14 +01: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
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
Ashley Perpetual
cc1462e0b7 Add concurrency check to rpc mining to ensure not too many threads. number of cores times 4 or 257. 2017-01-28 05:59:56 +08:00
luigi1111
4629ead8c5 Merge pull request #1618 2017-01-27 11:33:26 -06:00
Timothy D. Prime
6b145763f7 Fix clang build failure, caused by mixing C and C++
Easily fixed by moving a C++ header out of 'extern "C" {...}'.

When building with CC=clang CXX=clang++ make,
[ 21%] Building CXX object src/ringct/CMakeFiles/obj_ringct.dir/rctTypes.cpp.o
In file included from /home/tdprime/bitmonero/src/ringct/rctTypes.cpp:31:
In file included from /home/tdprime/bitmonero/src/ringct/rctTypes.h:43:
In file included from /home/tdprime/bitmonero/src/crypto/generic-ops.h:34:
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/cstring:100:3: error: conflicting types for 'memchr'
  memchr(void* __s, int __c, size_t __n)
    ^
	/usr/include/string.h:92:14: note: previous declaration is here
	extern void *memchr (const void *__s, int __c, size_t __n)
	             ^
... and 4 more similar errors
2017-01-26 17:30:00 -08:00
Timothy D. Prime
99f584376e Fix invalid + of std::string and int
These warnings were emitted by clang++, and they are real bugs.
src/rpc/core_rpc_server.cpp:208:58: warning: adding 'uint64_t'
      (aka 'unsigned long') to a string does not append to the string
      [-Wstring-plus-int]
        res.status = "Error retrieving block at height " + height;
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
The obvious intent is achieved by using std::to_string().
2017-01-26 10:11:37 -08:00
Lee Clagett
c02e1cb943 Updates to epee HTTP client code
- http_simple_client now uses std::chrono for timeouts
  - http_simple_client accepts timeouts per connect / invoke call
  - shortened names of epee http invoke functions
  - invoke command functions only take relative path, connection
    is not automatically performed
2017-01-25 15:39:32 -05:00
Alexis Enston
58e825060e Blockfill - Sort tx pool correctly 2017-01-25 12:06:19 +00:00
Alexis Enston
5f7a8741b9 Blockfill - Take TX fees into account properly 2017-01-25 11:59:25 +00:00
Alexis Enston
4ecab0d80c Consider empty block when filling with TXs 2017-01-25 11:59:15 +00:00
NanoAkron
66665003bd Clear feedback to user when daemon has stopped successfully 2017-01-25 00:37:23 +00:00
kenshi84
55a8e982c0 moved get_account_address_from_str_or_url from libcommon to libcryptonote_core 2017-01-24 20:31:03 +09:00
NanoAkron
7b6a9e91eb Added instructions for getting stack traces with gdb 2017-01-23 23:34:15 +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
Riccardo Spagni
ad91ffe7e5 Merge pull request #1622
8141973e Remove unreachable returns (Miguel Herranz)
2017-01-23 08:11:24 -05:00
Riccardo Spagni
6f39ba5909 Merge pull request #1621
feed6175 fixed typo: monero-wallet-cli,log (kenshi84)
2017-01-23 08:11:02 -05:00
Riccardo Spagni
72626a04d8 Merge pull request #1620
98357db4 Update log messages to reflect fact we no longer need to type `exit` to save database before quitting (NanoAkron)
2017-01-23 08:10:26 -05:00
Miguel Herranz
8141973e00 Remove unreachable returns
CATCH_ENTRY_L0 already returns the second value.
2017-01-23 11:29:34 +01:00
kenshi84
feed6175ea fixed typo: monero-wallet-cli,log 2017-01-23 11:44:06 +09: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
=
e92c4fff1a Wallet api: testnet getter 2017-01-22 23:02:01 +01:00
Miguel Herranz
36dd3e238f Replace BOOST_REVERSE_FOREACH with ranged for 2017-01-22 21:47:39 +01:00
Miguel Herranz
629e3101ab Replace BOOST_FOREACH with C++11 ranged for 2017-01-22 21:38:10 +01:00
Riccardo Spagni
daf66621dc Merge pull request #1608
1e8cc676 mlog: allow using numerical level as default prefix (moneromooo-monero)
8028b532 protocol: log received messages in a separate category (moneromooo-monero)
2017-01-22 12:21:28 -05: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
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
cccf4b9889 Merge pull request #1613
13dd102e mlog: fix default level/category mapping (moneromooo-monero)
2017-01-22 11:50:04 -05:00
Riccardo Spagni
17247b23bf Merge pull request #1612
20f71527 wallet2: fix sending a rct tx with a single output available (moneromooo-monero)
2017-01-22 11:49:20 -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
Riccardo Spagni
add98edfc3 Merge pull request #1609
4cdf0a35 p2p: always recreate a new peer id on startup (moneromooo-monero)
2017-01-22 11:47:43 -05:00
Riccardo Spagni
8e79271a19 Merge pull request #1607
f9293b69 unit_tests: fix missing return after batch_start prototype change (moneromooo-monero)
2017-01-22 11:47:02 -05:00
Riccardo Spagni
f798a2ab85 Merge pull request #1606
f8b97aef p2p: show ban/unban logs by default again (moneromooo-monero)
2017-01-22 11:43:11 -05:00
Riccardo Spagni
ee45b7a6db Merge pull request #1605
7c3f79cb core: early out in handle_incoming_tx if already in pool or blockchain (moneromooo-monero)
6cc7d261 ringct: reorder a bit to check quicker tests first (moneromooo-monero)
2017-01-22 11:42:15 -05:00
Riccardo Spagni
e12f073f65 Merge pull request #1604
a854cec3 Make stack trace show up in log file with default settings (moneromooo-monero)
2017-01-22 11:41:38 -05:00
Riccardo Spagni
036d0d8838 Merge pull request #1601
c3b8ddff streamline (vdo)
2017-01-22 11:40:23 -05:00
Riccardo Spagni
bd068afa44 Merge pull request #1600
1c4d65c0 Rename method to get_random_gray_peer (Miguel Herranz)
03a54ee0 Fix logging that broke after rebasing (Miguel Herranz)
6bdd3a59 Use set_peer_just_seen to keep last_seen updated (Miguel Herranz)
82dbeedd Add gray peer list housekeeping system (Miguel Herranz)
2017-01-22 11:39:00 -05:00
Riccardo Spagni
ab9c287d92 Merge pull request #1597
4d6976fb undelete epee tests.cpp (moneroexamples)
0fd2508b removing some unsed epee files (moneroexamples)
2017-01-22 11:37:46 -05: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
Miguel Herranz
1c4d65c011 Rename method to get_random_gray_peer 2017-01-21 13:04:49 +01:00
Miguel Herranz
03a54ee0c9 Fix logging that broke after rebasing 2017-01-21 11:22:04 +01:00
Miguel Herranz
6bdd3a59b5 Use set_peer_just_seen to keep last_seen updated 2017-01-21 10:11:32 +01:00
Miguel Herranz
82dbeedd1b Add gray peer list housekeeping system
A random peer from the gray peer list is selected and a connection is
made to check if the peer is alive.

If the connection and handshake are successful the peer is promoted to
the white peer list, in case of failure the peer is evicted from the
gray peer list.

The connection is closed after the check in either case.
2017-01-21 10:09:38 +01:00
vdo
c3b8ddff93 streamline 2017-01-21 04:21:00 +01:00
moneroexamples
4d6976fbce undelete epee tests.cpp 2017-01-21 10:00:32 +08:00
Riccardo Spagni
39aaea8e62 Merge pull request #1599
17246d05 wallet: print exception message on get_random_outs_error (moneromooo-monero)
2017-01-20 21:00:01 -05:00
Riccardo Spagni
96a35cd2f4 Merge pull request #1596
7c0c5c17 easylogging++: detect DragonFly BSD as a UNIX (moneromooo-monero)
2017-01-20 20:59:28 -05:00
Riccardo Spagni
3db3a6ee1a Merge pull request #1593
cbcdf8ad Honor depth in get_peerlist_head method (Miguel Herranz)
2017-01-20 20:59:09 -05:00
Riccardo Spagni
4bcd284c76 Merge pull request #1592
78d560a9 simplewallet: use MAKE_CORE_RPC_VERSION(1,4) instead of 0x10004 (kenshi84)
2017-01-20 20:58:55 -05:00
Riccardo Spagni
d5fbba45e8 Merge pull request #1589
87c658f8 wallet2_api: add API to set log categories (moneromooo-monero)
2017-01-20 20:58:39 -05:00
Riccardo Spagni
8698dd36f2 Merge pull request #1587
843769f8 Tweak some msg loglevels (Howard Chu)
2017-01-20 20:56:47 -05:00
Riccardo Spagni
6608531271 Merge pull request #1586
5e61687f mlog: allow overriding log format (moneromooo-monero)
5161f16f easylogging++: enforce recursive mutex (moneromooo-monero)
2017-01-20 20:55:35 -05:00
Riccardo Spagni
d10425025a Merge pull request #1572
0e0e6c5f Reduce to one connection per IP (Miguel Herranz)
3f269e98 Limit incoming connections from the same IP (Miguel Herranz)
2017-01-20 20:54:04 -05:00
moneromooo-monero
17246d051d wallet: print exception message on get_random_outs_error 2017-01-20 18:01:13 +00:00
moneroexamples
0fd2508b89 removing some unsed epee files 2017-01-20 01:05:14 +00:00
moneromooo-monero
7c0c5c1724 easylogging++: detect DragonFly BSD as a UNIX 2017-01-20 00:33:13 +00:00
Miguel Herranz
cbcdf8ad35 Honor depth in get_peerlist_head method
The method returned depth + 2 because:

- push_back was executed before the condition.
- > instead of >= causing one more iteration.
2017-01-18 21:41:52 +01:00
kenshi84
78d560a933 simplewallet: use MAKE_CORE_RPC_VERSION(1,4) instead of 0x10004 2017-01-18 16:11:18 +09:00
moneromooo-monero
87c658f83b wallet2_api: add API to set log categories 2017-01-16 21:14:44 +00:00
Howard Chu
843769f88f Tweak some msg loglevels 2017-01-16 20:42:59 +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
Miguel Herranz
0e0e6c5f39 Reduce to one connection per IP 2017-01-16 18:16:32 +01:00
Riccardo Spagni
71ac698b78 Merge pull request #1585
a480bf6b fixups in logging init calls, and add missing net context in a log (moneromooo-monero)
2017-01-16 08:41:33 -05:00
Riccardo Spagni
deb6728bc3 Merge pull request #1584
990e08f0 Fix PR#1506, off by one in chain height (Howard Chu)
2017-01-16 08:41:15 -05:00
Riccardo Spagni
4b6be1529e Merge pull request #1583
e389bd9e Makefile: remove mistakenly added local custom target (moneromooo-monero)
2017-01-16 08:40:18 -05:00
Riccardo Spagni
f22dbef28b Merge pull request #1536
693c1908 wallet: add a node RPC cache layer for simple RPC calls (moneromooo-monero)
d86ae2be wallet2: reuse fake outs when adjusting fee on transfer (moneromooo-monero)
64da0983 core: don't try to deserialize an empty extra to remove a field (moneromooo-monero)
2017-01-16 08:35:42 -05: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
Howard Chu
990e08f090 Fix PR#1506, off by one in chain height 2017-01-16 10:00:06 +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
Riccardo Spagni
ab69d5b367 Merge pull request #1569
16b8b66a specify restore height by YYYY-MM-DD format (kenshi84)
2017-01-15 20:32:57 -05:00
Riccardo Spagni
ac7df193ca Merge pull request #1522
5833d66f Change logging to easylogging++ (moneromooo-monero)
dc98019b easylogging++: fix logging with static const header only data members (moneromooo-monero)
3b46617b easylogging++: add ELPP_DISABLE_CHECK_MACROS (moneromooo-monero)
6fe39d90 easylogging++: allow clipping a common filename prefix (moneromooo-monero)
43abf6ff easylogging++: add file-only logs (moneromooo-monero)
c313bea4 eayslogging++: Fix bad memory access before opening any files (moneromooo-monero)
0af5d168 easylogging++: avoid creating directory/filename for the builtin default log file (moneromooo-monero)
28362847 easylogging++: allow setting thread names (moneromooo-monero)
ec71ce8d easylogging++: Print thread ID in a nicer way (moneromooo-monero)
2a0bf783 easylogging++: Add logging categories (moneromooo-monero)
c50bbbfe easylogging++: import upstream (moneromooo-monero)
2017-01-15 20:31:16 -05:00
kenshi84
16b8b66adc specify restore height by YYYY-MM-DD format 2017-01-16 10:00:28 +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
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
Riccardo Spagni
e459d8604d Merge pull request #1578
ce866d1c macro to define core RPC version for avoiding future mistake (kenshi84)
2017-01-15 19:13:45 -05:00
Riccardo Spagni
422a36ca2a Merge pull request #1581
6da9335a blockchain_import: fix build after tx_pool::add_tx changes (moneromooo-monero)
2017-01-15 19:13:28 -05:00
Riccardo Spagni
ec323d8c3f Merge pull request #1561
d561f4ad enable clang checks that were disabled (Chris Vickio)
0aefb2f6 remove std::move from return statements (pessimizing-move warning) (Chris Vickio)
629d5b76 change counter from bool to int (deprecated-increment-bool warning) (Chris Vickio)
fb76d439 add extra braces around subobjects (missing-braces warning) (Chris Vickio)
3b6d5f25 make struct/class declarations consistent (mismatched-tags warning) (Chris Vickio)
fcf66925 remove unused fields from network_throttle (unused-private-field warning) (Chris Vickio)
296f8c16 inline unused function (for unused-function warning) (Chris Vickio)
2017-01-15 19:01:08 -05:00
kenshi84
ce866d1cc6 macro to define core RPC version for avoiding future mistake 2017-01-16 07:55:43 +09:00
moneromooo-monero
6da9335a9e blockchain_import: fix build after tx_pool::add_tx changes 2017-01-15 21:52:56 +00:00
Riccardo Spagni
b2e1568335 Merge pull request #1579
f5f4109f mnemonics: fix language detection with checksum word (moneromooo-monero)
2017-01-15 14:58:09 -05:00
Riccardo Spagni
99ffc49740 Merge pull request #1577
feb499aa core: check block version for alt chains too (moneromooo-monero)
2017-01-15 14:57:30 -05: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
c5be70eab4 Merge pull request #1575
b3ca0c62 unit_tests: fix portable serialization tests hardcoded data path (moneromooo-monero)
2017-01-15 14:56:10 -05:00
Riccardo Spagni
9cda94d0aa Merge pull request #1574
d276a165 wallet2: use at least two rct inputs if possible (moneromooo-monero)
2017-01-15 14:55:40 -05:00
Riccardo Spagni
f00797a1f2 Merge pull request #1573
dea53962 fix timeout in check_connection (Jaquee)
2017-01-15 14:55:12 -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
91083a43be Merge pull request #1568
5b5017e2 rpc: add a command to get info about the current blockchain (moneromooo-monero)
2017-01-15 14:48:09 -05:00
Riccardo Spagni
31de98793f Merge pull request #1567
c9f13c5e wallet2: fix tx reroll not updating fee is going up a kB step (moneromooo-monero)
2017-01-15 14:47:44 -05:00
Riccardo Spagni
51baab2112 Merge pull request #1565
50b230d1 core: ensure block size limit is set from the start (moneromooo-monero)
2017-01-15 14:47:17 -05:00
Riccardo Spagni
865f5bef34 Merge pull request #1564
1d317981 Wallet API: add key image import/export functions (Jaquee)
2017-01-15 14:46:52 -05:00
Riccardo Spagni
8bd2c2e551 Merge pull request #1563
36ba311c Prioritize older transactions in the mempool (Miguel Herranz)
2017-01-15 14:46:33 -05:00
Riccardo Spagni
935f50471c Merge pull request #1560
46550c0b Wallet API: add rescanSpent() (Jaquee)
2017-01-15 14:44:49 -05:00
Riccardo Spagni
c23bd75df6 Merge pull request #1552
4a017674 Wallet API: support integrated addresses in address book. (Jaquee)
2017-01-15 14:44:28 -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
Chris Vickio
d561f4ad92 enable clang checks that were disabled 2017-01-15 19:23:33 +03:00
Chris Vickio
0aefb2f60a remove std::move from return statements (pessimizing-move warning) 2017-01-15 19:23:33 +03:00
Chris Vickio
629d5b7689 change counter from bool to int (deprecated-increment-bool warning) 2017-01-15 19:23:33 +03:00
Howard Chu
3ff54bdd7a Check for correct thread before ending batch transaction 2017-01-15 15:51:57 +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
Miguel Herranz
3f269e988c Limit incoming connections from the same IP 2017-01-15 12:11:27 +01:00
Howard Chu
eaf8470b29 Must wait for previous batch to finish before starting new one 2017-01-14 22:43:06 +00:00
Howard Chu
c903c5541e Don't cache block height, always get from DB 2017-01-14 22:43:06 +00: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
Howard Chu
0693cff925 Use batch transactions when syncing
Faster throughput while avoiding corruption. I.e., makes
running with --db-sync-mode safe more tolerable.
2017-01-14 22:43:06 +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
Riccardo Spagni
d98db4868d Merge pull request #1566
176b70a0 account: fix build error involving std::max and different types (moneromooo-monero)
2017-01-14 09:26:59 -05:00
Jaquee
dea53962a3 fix timeout in check_connection 2017-01-14 14:45:30 +01: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
Chris Vickio
fb76d43980 add extra braces around subobjects (missing-braces warning) 2017-01-14 15:06:07 +03:00
Chris Vickio
3b6d5f255d make struct/class declarations consistent (mismatched-tags warning) 2017-01-14 15:06:07 +03:00
Chris Vickio
fcf66925c1 remove unused fields from network_throttle (unused-private-field warning) 2017-01-14 15:06:07 +03:00
Chris Vickio
296f8c160f inline unused function (for unused-function warning) 2017-01-14 13:37:14 +03: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
Jaquee
1d3179816b Wallet API: add key image import/export functions 2017-01-13 23:02:20 +01:00
Jaquee
4a0176740d Wallet API: support integrated addresses in address book. 2017-01-13 22:41:17 +01: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
Jaquee
46550c0b4f Wallet API: add rescanSpent() 2017-01-13 22:05:39 +01:00
Riccardo Spagni
2806842200 Merge pull request #1562
a081b39c Move key image export/import functions to wallet2 (Jaquee)
2017-01-13 14:38:29 -05:00
Riccardo Spagni
2a2f02e375 Merge pull request #1559
db56a03f Wallet2 + API: Callbacks for unconfirmed transfers (Jaquee)
2017-01-13 14:37:12 -05:00
Riccardo Spagni
cbb39b499b Merge pull request #1558
7961878e initialize timestamp to 0 and check for mktime() error (Chris Vickio)
2017-01-13 14:36:42 -05:00
Riccardo Spagni
e75fd059dd Merge pull request #1555
758c0eb7 fix time stats mixin (luigi1111)
2017-01-13 14:36:24 -05:00
Riccardo Spagni
56c44b78b4 Merge pull request #1548
e68ea86c Change logic of testing for libunwind on OSX and ARM (NanoAkron)
2017-01-13 14:35:52 -05:00
Riccardo Spagni
433adee594 Merge pull request #1545
5ae00f0f add msg for donate (luigi1111)
2017-01-13 14:35:34 -05: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
Riccardo Spagni
faa33fc326 Merge pull request #1541
0d3918e1 Wallet api: Update trustedDaemon when daemon is changed (Jaquee)
dbb838f4 GUI cold signing (Jaquee)
afb85a02 Wallet API: functions for supporting/creating view only wallets (Jaquee)
2017-01-13 14:34:55 -05:00
Riccardo Spagni
e51afeb90f Merge pull request #1540
79b4e1f9 Cold signing: make sure short payment id isnt encrypted twice (Jaquee)
2017-01-13 14:34:26 -05:00
Riccardo Spagni
006bb0e957 Merge pull request #1538
aff28178 Remove db-auto-remove-logs (Miguel Herranz)
1229c685 Remove berkeley from db_type initialization (Miguel Herranz)
e3090558 Show available types for db-type command (Miguel Herranz)
046ab33d Remove berkeley from blockchain_db_types (Miguel Herranz)
2017-01-13 14:33:59 -05:00
Riccardo Spagni
36b84ded95 Merge pull request #1526
5eed5b05 Wallet API: functions for supporting/creating view only wallets (Jaquee)
2017-01-13 14:32:26 -05:00
Riccardo Spagni
aeeb24991a Merge pull request #1523
d81cb087 Added (not yet enabled) HTTP client authentication (Lee Clagett)
2017-01-13 14:32:08 -05:00
Riccardo Spagni
71c7577370 Merge pull request #1513
a813ab50 wallet2_api: add solo mining API (moneromooo-monero)
2017-01-13 13:24:45 -05:00
Riccardo Spagni
5738e07fba Merge pull request #1492
f1dde1a4 wallet cli: print originating block heights of mixin keys when making transfer (kenshi84)
2017-01-13 13:22:13 -05:00
Miguel Herranz
36ba311cf4 Prioritize older transactions in the mempool
The transactions are first prioritized by fee and in case the fees are
equal by receive_time.
2017-01-13 16:08:37 +01:00
Jaquee
a081b39c01 Move key image export/import functions to wallet2 2017-01-13 12:49:10 +01:00
Jaquee
db56a03ff2 Wallet2 + API: Callbacks for unconfirmed transfers 2017-01-12 18:25:34 +01:00
Chris Vickio
7961878e81 initialize timestamp to 0 and check for mktime() error 2017-01-12 10:13:58 +03:00
Miguel Herranz
19be7225cc Add start_time to get_info methods and show uptime 2017-01-12 00:15:21 +01:00
Lee Clagett
d81cb08704 Added (not yet enabled) HTTP client authentication 2017-01-11 03:21:17 -05:00
Jaquee
0d3918e15b Wallet api: Update trustedDaemon when daemon is changed 2017-01-10 22:49:30 +01:00
Jaquee
dbb838f4d0 GUI cold signing
fix conflict
2017-01-10 22:49:17 +01:00
Jaquee
afb85a028f Wallet API: functions for supporting/creating view only wallets 2017-01-10 22:49:11 +01:00
Jaquee
5eed5b056b Wallet API: functions for supporting/creating view only wallets 2017-01-10 22:34:46 +01:00
luigi1111
758c0eb79f fix time stats mixin
also add blobsize
2017-01-10 10:15:15 -06:00
Riccardo Spagni
4026e7b7de Merge pull request #1544
db44a909 Fix monero-wallet-cli compile (luigi1111)
2017-01-10 08:23:31 -05: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
Miguel Herranz
e309055819 Show available types for db-type command 2017-01-10 11:44:01 +01:00
Miguel Herranz
046ab33d1b Remove berkeley from blockchain_db_types 2017-01-10 11:17:48 +01:00
NanoAkron
e68ea86cc4 Change logic of testing for libunwind on OSX and ARM 2017-01-09 16:39:44 +00:00
moneromooo-monero
a813ab50fe wallet2_api: add solo mining API 2017-01-09 10:12:55 +00:00
kenshi84
f1dde1a429 wallet cli: print originating block heights of mixin keys when making transfer 2017-01-09 15:10:34 +09:00
luigi1111
5ae00f0ff5 add msg for donate
#1498
2017-01-08 21:05:00 -06:00
luigi1111
db44a909ba Fix monero-wallet-cli compile
Not 100$ sure this is the right fix, nor whether address book entries from URL should be stored as addresses or URLs (or both with a check for change on payment).
2017-01-08 20:26:57 -06:00
Riccardo Spagni
c6ec939626 Merge pull request #1542
60fe1b61 Add parse_uri to wallet2_api (MoroccanMalinois)
2017-01-08 16:47:42 -08:00
Riccardo Spagni
59021496d8 Merge pull request #1537
c2135082 simplewallet: add a show_transfer <txid> command (moneromooo-monero)
19c4041d wallet_rpc_server: new RPC call to get a transfer by txid (moneromooo-monero)
2017-01-08 16:44:29 -08:00
Riccardo Spagni
15dcc5afd3 Merge pull request #1534
1607cb7e tx_pool: better block template filling algorithm (moneromooo-monero)
9731b4e5 rpc: add block size to GET_BLOCK_HEADER RPC (moneromooo-monero)
9188b346 rpc: add current block size to the getinfo call (moneromooo-monero)
2017-01-08 16:43:54 -08:00
Riccardo Spagni
278562d2c2 Merge pull request #1531
9d1d3a45 portable serializer: use signed char for size (kenshi84)
2017-01-08 16:43:35 -08:00
Riccardo Spagni
6cbfe0f849 Merge pull request #1521
21c5af5a wallet2_api: add an address book payment id lookup API (moneromooo-monero)
2017-01-08 16:42:08 -08:00
Riccardo Spagni
ba9744d400 Merge pull request #1515
ada7c7da portable serializer: tests added (kenshi84)
f390a0e2 portable serializer: make signerd/unsigned tx portable, ignore archive version checking (kenshi84)
2017-01-08 16:41:44 -08:00
Riccardo Spagni
866463f37b Merge pull request #1514
fa0ee42c Workarounds for gcc 4.8 (Lee Clagett)
2017-01-08 16:41:03 -08:00
Riccardo Spagni
2a996f492f Merge pull request #1510
80abc3bc Build wallet with Android NDK (MoroccanMalinois)
2017-01-08 16:40:02 -08:00
Riccardo Spagni
da05900524 Merge pull request #1509
29333c41 wallet api: prevent setting refresh height too high (Jaquee)
2017-01-08 16:39:23 -08:00
Riccardo Spagni
13c5da2aa3 Merge pull request #1508
4585ada4 Wallet2: faster exit while refreshing (Jaquee)
2017-01-08 16:39:07 -08:00
Riccardo Spagni
0ce4618bea Merge pull request #1504
5f4ac6b9 wallet2 bugfix: store watch_only flag properly with rewrite() (kenshi84)
2017-01-08 16:38:19 -08:00
Riccardo Spagni
c284b0fff7 Merge pull request #1503
542571f5 simplewallet: remove unnecessary local_args.erase(...) in set_variable() (kenshi84)
2017-01-08 16:38:01 -08:00
Riccardo Spagni
fdb1cda965 Merge pull request #1502
591d8368 core: invalidate difficulty cache when resetting blockchain (moneromooo-monero)
2017-01-08 16:37:31 -08:00
Riccardo Spagni
06de09daf4 Merge pull request #1501
cebae0c5 wallet2: check the node returned the real output when requested (moneromooo-monero)
2017-01-08 16:37:11 -08:00
Riccardo Spagni
1736b7ef6b Merge pull request #1500
c0a0fcaf wallet2_api: some new APIs to access daemon state (moneromooo-monero)
2017-01-08 16:36:46 -08:00
Riccardo Spagni
d655e88b44 Merge pull request #1499
37ed96e6 tx_pool: fix uninitialized "last failed" fields (moneromooo-monero)
94b6feef rpc: fix mixup in tx_info serialization (moneromooo-monero)
2017-01-08 16:35:49 -08:00
Riccardo Spagni
03497f0268 Merge pull request #1497
50511677 wallet2: fix large reorgs failing (moneromooo-monero)
2017-01-08 16:35:14 -08:00
Riccardo Spagni
209a633a3c Merge pull request #1496
adee1644 wallet cli: print unspent outputs with histogram (kenshi84)
2017-01-08 16:34:51 -08:00
Riccardo Spagni
3082e71b5a Merge pull request #1495
f3fdefe0 Fix multiple definition clash on ARMv7 build (Howard Chu)
2017-01-08 16:34:23 -08:00
Riccardo Spagni
c594e578a9 Merge pull request #1494
0020ad7d cmake: link against liblzma when found, for libunwind (moneromooo-monero)
2017-01-08 16:34:08 -08:00
Riccardo Spagni
23cf963332 Merge pull request #1493
0478ac68 blockchain: allow marking "tx not found" without an exception (moneromooo-monero)
2017-01-08 16:33:41 -08:00
Riccardo Spagni
223055a861 Merge pull request #1491
52db01ea Silence CMake policy warning on macos. See: https://cmake.org/cmake/help/v3.0/policy/CMP0042.html (Randi Joseph)
2017-01-08 16:32:30 -08:00
Riccardo Spagni
fc0a2b837b Merge pull request #1490
474c249c cleaner log calc algorithm (fireice-uk)
2017-01-08 16:32:21 -08:00
Riccardo Spagni
f4b3989c61 Merge pull request #1482
38f00d07 wallet cli: viewing and editing address book (kenshi84)
2017-01-08 16:31:55 -08:00
Riccardo Spagni
ff1bb6bc68 Merge pull request #1460
99580adf make openalias also available for solo miner; introduce namespace tools::dns_utils; support integrated address with dns lookup (kenshi84)
2017-01-08 16:31:42 -08:00
MoroccanMalinois
60fe1b61e0 Add parse_uri to wallet2_api 2017-01-08 22:53:24 +00:00
Jaquee
79b4e1f997 Cold signing: make sure short payment id isnt encrypted twice 2017-01-08 21:04:53 +01: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
kenshi84
9d1d3a454e portable serializer: use signed char for size 2017-01-07 11:59:16 +09: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
MoroccanMalinois
80abc3bc4a Build wallet with Android NDK 2017-01-05 01:11:05 +00:00
kenshi84
ada7c7da8f portable serializer: tests added 2017-01-03 09:14:48 +09:00
kenshi84
f390a0e2dc portable serializer: make signerd/unsigned tx portable, ignore archive version checking 2017-01-02 20:04:58 +09:00
moneromooo-monero
21c5af5a8a wallet2_api: add an address book payment id lookup API 2017-01-01 16:06:34 +00:00
Lee Clagett
fa0ee42cc9 Workarounds for gcc 4.8 2016-12-30 02:14:06 -05:00
Jaquee
29333c417e wallet api: prevent setting refresh height too high 2016-12-27 19:38:05 +01:00
Jaquee
4585ada453 Wallet2: faster exit while refreshing 2016-12-27 19:12:18 +01:00
moneromooo-monero
cebae0c510 wallet2: check the node returned the real output when requested 2016-12-27 09:38:10 +00:00
kenshi84
5f4ac6b909 wallet2 bugfix: store watch_only flag properly with rewrite() 2016-12-26 18:33:24 +09:00
kenshi84
adee16440a wallet cli: print unspent outputs with histogram 2016-12-26 16:03:16 +09:00
kenshi84
542571f5cb simplewallet: remove unnecessary local_args.erase(...) in set_variable() 2016-12-26 08:50:37 +09: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
Howard Chu
f3fdefe001 Fix multiple definition clash on ARMv7 build
Broken by d1d6e27ab6
2016-12-23 18:05:11 +00:00
Randi Joseph
52db01ea6d Silence CMake policy warning on macos.
See: https://cmake.org/cmake/help/v3.0/policy/CMP0042.html
2016-12-23 02:54:34 -05:00
fireice-uk
474c249c90 cleaner log calc algorithm 2016-12-22 20:29:41 +00:00
Riccardo Spagni
dd580d7bc7 Merge pull request #1487
37476265 add tx hash to time stats (luigi1111)
2016-12-22 10:59:02 +02:00
luigi1111
374762654e add tx hash to time stats
Also miner tx hash to log level 1 (have you ever tried to find a testnet miner tx hash?)
2016-12-21 19:20:49 -06:00
Riccardo Spagni
a5d0af95b5 Merge pull request #1486
522ab79e Fixed HTTP auth tests for gcc 4.9 (Lee Clagett)
2016-12-21 21:51:46 +02:00
Riccardo Spagni
6f539159e8 Merge pull request #1484
12abe86a core: fix recalculation of emission/fees (moneromooo-monero)
2016-12-21 20:43:31 +02:00
Lee Clagett
522ab79e9c Fixed HTTP auth tests for gcc 4.9 2016-12-21 13:23:15 -05:00
kenshi84
99580adf66 make openalias also available for solo miner; introduce namespace tools::dns_utils; support integrated address with dns lookup 2016-12-21 23:12:15 +09: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
kenshi84
38f00d07f7 wallet cli: viewing and editing address book 2016-12-21 19:27:18 +09:00
Riccardo Spagni
049b7e9a93 Merge pull request #1483
af9a7999 account for API difference between 1.58 & 1.59 (kenshi84)
2016-12-21 10:35:13 +02:00
kenshi84
af9a799925 account for API difference between 1.58 & 1.59 2016-12-21 16:05:31 +09:00
Riccardo Spagni
4fe5c351cd Merge pull request #1479
c31e42e2 simplewallet: bump output file format version (moneromooo-monero)
2016-12-20 23:01:39 +02:00
Riccardo Spagni
04bdce54b7 Merge pull request #1478
1976eddd common: add missing #include <system_error> for std::error_code (moneromooo-monero)
2016-12-20 23:01:12 +02:00
Riccardo Spagni
5a66365cdd Merge pull request #1477
d55e2266 Fixed uninitialized valgrind errors in serialization tests (Lee Clagett)
2016-12-20 23:00:54 +02: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
Lee Clagett
d55e2266ca Fixed uninitialized valgrind errors in serialization tests 2016-12-20 12:51:27 -05:00
Riccardo Spagni
c7f9d0d971 Merge pull request #1475
81702b54 Fixes for google test < 1.8 (Lee Clagett)
2016-12-20 17:48:25 +02:00
Riccardo Spagni
9777de1890 Merge pull request #1474
fc40b3e7 Lower connection timeout in check_connection() (Jaquee)
2016-12-20 17:47:58 +02:00
Riccardo Spagni
e170cbe013 Merge pull request #1473
e3639f5c Removed unused functions (Lee Clagett)
2016-12-20 17:47:16 +02:00
Riccardo Spagni
6847999fb8 Merge pull request #1472
2bddb8eb Refactored password prompting for wallets (Lee Clagett)
2016-12-20 17:46:58 +02:00
Riccardo Spagni
dca146f823 Merge pull request #1469
9e4b3724 simplewallet: add pending/pool/failed in the show_transfers help (moneromooo-monero)
2016-12-20 17:45:47 +02:00
Riccardo Spagni
233ba51ad9 Merge pull request #1468
9a2cd722 wallet2_api: add an API to the OpenAlias resolver (moneromooo-monero)
2016-12-20 17:45:13 +02:00
Riccardo Spagni
f5176cb6e8 Merge pull request #1467
55fa0479 rpc: new function and RPC to get alternative chain info (moneromooo-monero)
2016-12-20 17:44:47 +02:00
Riccardo Spagni
1551ce98f2 Merge pull request #1466
c367d7df README: add note about the donate command (anonimal)
b9a28677 simplewallet: add return type for donate function (anonimal)
d36669fd simplewallet: hardcode Monero's donation address (anonimal)
2016-12-20 17:43:38 +02:00
Riccardo Spagni
b9b9028e50 Merge pull request #1462
07b9138c support importing unportable outputs (kenshi84)
2ac80075 also use portable serializer for boost_serialization_helper.h and net_node.inl, completely adandon boost/archive/binary_oarchive.hpp (kenshi84)
d1d6e27a moved boost cpp into hpp since they're supposed to be header only (kenshi84)
66e6af89 added experimental boost::archive::portable_binary_{i|o}archive (kenshi84)
2016-12-20 17:40:11 +02:00
kenshi84
07b9138cad support importing unportable outputs 2016-12-20 13:26:39 +09:00
kenshi84
2ac8007544 also use portable serializer for boost_serialization_helper.h and net_node.inl, completely adandon boost/archive/binary_oarchive.hpp 2016-12-20 13:04:19 +09:00
kenshi84
d1d6e27ab6 moved boost cpp into hpp since they're supposed to be header only 2016-12-20 12:27:23 +09:00
Lee Clagett
81702b5451 Fixes for google test < 1.8 2016-12-19 20:48:11 -05:00
Lee Clagett
2bddb8ebee Refactored password prompting for wallets 2016-12-19 20:00:43 -05:00
Jaquee
fc40b3e732 Lower connection timeout in check_connection() 2016-12-19 21:19:02 +01:00
Riccardo Spagni
5fcf7c1c18 Merge pull request #1464
427054c3 Enabled HTTP auth support for monero-wallet-rpc (Lee Clagett)
2016-12-19 22:16:22 +02:00
Lee Clagett
e3639f5cc3 Removed unused functions 2016-12-19 14:47:26 -05: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
Lee Clagett
427054c3d5 Enabled HTTP auth support for monero-wallet-rpc 2016-12-16 23:59:46 -05:00
anonimal
c367d7df31 README: add note about the donate command
References #1447
2016-12-17 03:49:52 +00:00
anonimal
b9a28677e2 simplewallet: add return type for donate function
Resolves -Wreturn-type

References #1447 #1451
2016-12-17 03:37:20 +00:00
anonimal
d36669fd75 simplewallet: hardcode Monero's donation address
Closes #1447
References #1451
2016-12-17 02:52:09 +00:00
kenshi84
66e6af89ce added experimental boost::archive::portable_binary_{i|o}archive 2016-12-16 23:46:24 +09:00
Riccardo Spagni
29735c8f8f Merge pull request #1459
b00da61e Preliminary support for DragonFly BSD (Antonio Huete Jimenez)
2016-12-15 14:36:35 +02:00
Riccardo Spagni
527aa3e604 Merge pull request #1458
f7e551d0 Dockerfile : use libssl1.0 (MoroccanMalinois)
2016-12-15 14:36:11 +02:00
Riccardo Spagni
73e50749e2 Merge pull request #1455
4bb0bff2 AddressBook: use unsigned type for row ID's (anonimal)
2016-12-15 14:35:47 +02:00
Riccardo Spagni
c6f26ecae2 Merge pull request #1449
374b58d1 fix MGs json (moneroexamples)
2016-12-15 14:29:40 +02:00
Riccardo Spagni
1e8920c225 Merge pull request #1454
515a2d9f Update info on libzlma and BerkeleyDB in README.md (NanoAkron)
2016-12-15 14:29:18 +02:00
Riccardo Spagni
18c36561f6 Merge pull request #1453
1a2284de Spelling error (Bitcoin Error Log)
2016-12-15 14:28:40 +02:00
Riccardo Spagni
00898fe750 Merge pull request #1452
944b6079 Wallet API: Do not refresh while daemon is syncing + fixed fast refresh when creating wallet offline + improved close wallet logic (make sure refresh thread is stopped) (Jaquee)
2016-12-15 14:28:15 +02:00
Riccardo Spagni
5f5cfdfa77 Merge pull request #1451
2506d51d wallet cli: donate command (Kenshi Takayama)
2016-12-15 14:27:02 +02:00
Riccardo Spagni
aa47ea41a7 Merge pull request #1444
bdc3d749 Adding HTTP Digest Auth (but not yet enabled) (Lee Clagett)
2016-12-15 14:25:49 +02:00
Jaquee
944b6079d9 Wallet API: Do not refresh while daemon is syncing
+ fixed fast refresh when creating wallet offline
+ improved close wallet logic (make sure refresh thread is stopped)
2016-12-15 12:31:09 +01:00
Antonio Huete Jimenez
b00da61eab Preliminary support for DragonFly BSD
- It builds but no further testing has been done.
2016-12-15 02:27:53 -08:00
Kenshi Takayama
2506d51d60 wallet cli: donate command 2016-12-15 19:01:36 +09:00
MoroccanMalinois
f7e551d0b8 Dockerfile : use libssl1.0 2016-12-15 05:50:03 +01:00
anonimal
4bb0bff233 AddressBook: use unsigned type for row ID's
Fixes build warnings and may also prevent future headaches.
2016-12-14 21:37:49 +00:00
NanoAkron
515a2d9fe8 Update info on libzlma and BerkeleyDB in README.md 2016-12-14 21:15:08 +00:00
Bitcoin Error Log
1a2284dea0 Spelling error
"compatibility" spelled incorrectly
2016-12-14 12:27:17 -05:00
moneroexamples
374b58d131 fix MGs json 2016-12-14 09:27:37 +08:00
Riccardo Spagni
b97a2f72db Merge pull request #1445
95b9e85e rename cn_deserialize (Riccardo Spagni)
2016-12-13 19:14:00 +02:00
Riccardo Spagni
183d3657f3 Merge pull request #1446
b2adfa8c Bitmonero namespace renamed Monero. Bitmonero namespace alias added so that third party uses of the wallet api can transition. (Randi Joseph)
2016-12-13 19:13:09 +02:00
Randi Joseph
b2adfa8c51 Bitmonero namespace renamed Monero. Bitmonero namespace alias added so that third party uses of the wallet api can transition. 2016-12-13 10:21:38 -05:00
Riccardo Spagni
95b9e85e2d rename cn_deserialize 2016-12-13 16:39:43 +02:00
Riccardo Spagni
b1bdb4e529 Merge pull request #1437
655eafd1 bump version (Riccardo Spagni)
117194a3 update checkpoints (Riccardo Spagni)
39a9db9e update checkpoints (Riccardo Spagni)
2016-12-13 16:36:43 +02:00
Riccardo Spagni
2f2c6460ae Merge pull request #1442
dd144b14 blockchain: fix reorganizations past a hard fork boundary (moneromooo-monero)
2016-12-13 10:24:25 +02:00
Riccardo Spagni
c03da2b2dd Merge pull request #1441
0fb5dc87 monero-wallet-cli wording changes 'n' stuff (luigi1111)
2016-12-13 10:23:49 +02:00
Riccardo Spagni
c2a9229310 Merge pull request #1439
4299bdf6 Improve language of 'node ahead by' message (NanoAkron)
2016-12-13 10:23:22 +02:00
Riccardo Spagni
9d19e62fa2 Merge pull request #1438
9d906159 Tx verification failing is not an error (luigi1111)
2016-12-13 10:22:56 +02:00
Lee Clagett
bdc3d7496f Adding HTTP Digest Auth (but not yet enabled) 2016-12-13 00:19:54 -05: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
luigi1111
0fb5dc870d monero-wallet-cli wording changes 'n' stuff
Possibly other pedantry. Pedants are people too.
2016-12-12 19:53:28 -06:00
NanoAkron
4299bdf614 Improve language of 'node ahead by' message 2016-12-12 23:24:40 +00:00
luigi1111
9d906159c3 Tx verification failing is not an error
And rangeProofs are on outputs...
2016-12-12 17:01:20 -06:00
Riccardo Spagni
655eafd160 bump version 2016-12-13 00:29:29 +02:00
Riccardo Spagni
117194a397 update checkpoints 2016-12-13 00:26:25 +02:00
Riccardo Spagni
39a9db9eb1 update checkpoints 2016-12-13 00:24:48 +02:00
Riccardo Spagni
1a286061ff Merge pull request #1436
3b4539ee addressbook updates (Jaquee)
2016-12-12 23:46:47 +02:00
Jaquee
3b4539ee7e addressbook updates 2016-12-12 21:50:50 +01:00
Riccardo Spagni
5b7f1fc8e4 Merge pull request #1424
aeb13289 Update cryptonote_protocol_handler.inl (Gingeropolous)
2016-12-12 22:40:41 +02:00
Riccardo Spagni
aa7a926681 Merge pull request #1434
5df92877 GUI address book (Jaquee)
2016-12-12 22:39:38 +02:00
Riccardo Spagni
7e324b7ad7 Merge pull request #1433
66dc23c4 modded minimum and recommended monero versions (Gingeropolous)
2016-12-12 22:39:11 +02:00
Riccardo Spagni
84d3107600 Merge pull request #1431
81c6bb9a thread_group: fix build on older GCC (moneromooo-monero)
2016-12-12 22:38:27 +02:00
Riccardo Spagni
67844f826e Merge pull request #1425
c5c45ca6 wallet: bring forward use of the dynamic fee (moneromooo-monero)
2016-12-12 22:38:05 +02:00
Riccardo Spagni
7141d317df Merge pull request #1423
19585d49 mnemonics: fix misc STL containers leak (moneromooo-monero)
f6fcf0ef oaes_lib: fix a leak on OOM error path (moneromooo-monero)
2016-12-12 22:37:32 +02:00
Jaquee
5df92877c7 GUI address book 2016-12-12 00:43:02 +01:00
Gingeropolous
66dc23c458 modded minimum and recommended monero versions
modified all min and rec versions to v0.10.1 for v4 and v5 forks
2016-12-11 13:12:03 -05: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
Gingeropolous
aeb13289bb Update cryptonote_protocol_handler.inl
Per discussion of #1359, the wording has changed to indicate that no assessment of the blocks validity is made.
2016-12-10 10:22:16 -05: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
Riccardo Spagni
2d0fbaf35b Merge pull request #1422
9b00d80f wallet2: pass by const ref where possible (moneromooo-monero)
2016-12-10 14:49:34 +02:00
Riccardo Spagni
930aceb242 Merge pull request #1419
f4a3ce15 Fix sending outputs from a tx with more than one pubkey (moneromooo-monero)
2016-12-10 14:48:56 +02:00
Riccardo Spagni
0f99423080 Merge pull request #1418
dfbb85b6 blockchain: fix setting non trovial alternate chain as invalid (moneromooo-monero)
2016-12-10 14:48:39 +02:00
Riccardo Spagni
99f725cbe2 Merge pull request #1408
b9c5f29d Revert forcing -fPIC for all ARMv8 builds (NanoAkron)
2016-12-10 14:48:00 +02: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
NanoAkron
b9c5f29d1d Revert forcing -fPIC for all ARMv8 builds 2016-12-09 12:01:16 +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
Riccardo Spagni
12b59460c2 Merge pull request #1417
0b91d825 simplewallet: restore automatically setting trusted local daemon (moneromooo-monero)
2016-12-08 23:45:04 +02:00
Riccardo Spagni
8e1a8c6adc Merge pull request #1415
6c44f5c6 wallet: send 0 change to a random address where necessary with rct (moneromooo-monero)
2016-12-08 23:44:40 +02:00
Riccardo Spagni
e6b05ed95a Merge pull request #1414
3b005275 ringct: add sc_check calls in MLSAG_Ver for ss and cc (moneromooo-monero)
2f1732a7 ringct: guard against bad data exceptions in worker threads (moneromooo-monero)
2016-12-08 23:44:09 +02:00
Riccardo Spagni
22e16e88e3 Merge pull request #1413
648ea6be blockchain: bring the v4 fork height one block forward (luigi1111)
46a0dcc1 ringct: luigi1111's changes to fix and speedup Borromean sigs (luigi1111)
76958fc7 ringct: switch to Borromean signatures (Shen Noether)
2016-12-08 23:43:41 +02:00
Riccardo Spagni
f9503d2789 Merge pull request #1405
d1a75754 Remove infinite loop in refresh code (Jaquee)
2016-12-08 23:43:19 +02:00
Riccardo Spagni
9907fc689c Merge pull request #1387
18462aa0 Added confirmation before binding wallet-rpc to external IP (Lee Clagett)
2016-12-08 23:42:28 +02: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
luigi1111
648ea6bef1 blockchain: bring the v4 fork height one block forward
This will ensure the early 0.10 daemons will barf at the fork
height, and not a bit later, which could be confusing.
2016-12-06 21:59:08 +00:00
Lee Clagett
18462aa065 Added confirmation before binding wallet-rpc to external IP 2016-12-05 21:45:11 -05:00
Jaquee
d1a75754df Remove infinite loop in refresh code
This reverts commit fd181b03bb.
2016-12-05 13:02:45 +01:00
luigi1111
46a0dcc1d2 ringct: luigi1111's changes to fix and speedup Borromean sigs 2016-12-04 21:54:16 +00:00
Shen Noether
76958fc75a ringct: switch to Borromean signatures 2016-12-04 21:54:11 +00:00
Riccardo Spagni
45bb393577 Merge pull request #1403
60633cf6 Spelling in errors (taushet)
2016-12-04 22:30:15 +02:00
Riccardo Spagni
cc73d5000f Merge pull request #1402
bdd3fb85 Spelling in errors. (taushet)
2016-12-04 22:29:55 +02:00
Riccardo Spagni
b500a64524 Merge pull request #1399
73ac3b8e wallet2: avoid possible undefined behavior on empty string (moneromooo-monero)
2016-12-04 22:28:48 +02:00
Riccardo Spagni
f2ea2afb77 Merge pull request #1398
f4772bae Fix a few minor typos (Pierre Boyer)
2016-12-04 22:28:22 +02:00
Riccardo Spagni
8086379680 Merge pull request #1397
3f7d6fb5 Fix delayed exit when syncing (moneromooo-monero)
2016-12-04 22:27:41 +02:00
Riccardo Spagni
4a0be41dfe Merge pull request #1396
7c0dd5e4 net_node: drop connections from banned IPs after looping through connections (moneromooo-monero)
2016-12-04 22:26:12 +02:00
Riccardo Spagni
d59dc59744 Merge pull request #1395
59443bf9 ringct: fix MGs serialization to JSON (moneromooo-monero)
2016-12-04 22:25:24 +02:00
Riccardo Spagni
daf5dbebb0 Merge pull request #1393
0e18f465 db_lmdb: add info in an error message when we can't get an output (moneromooo-monero)
c96f9b02 db_lmdb: guard against going out of sync on unexpected db results (moneromooo-monero)
bef51e67 db_lmdb: minor pedantic tweaks (moneromooo-monero)
3465c4eb db_lmdb: set same packing format for output_data_t and pre_rct_output_data_t (moneromooo-monero)
2016-12-04 22:23:34 +02:00
Riccardo Spagni
416f7fbd5f Merge pull request #1392
204b1bff blockchain: use high bound block reward on error where appropriate (moneromooo-monero)
2016-12-04 22:23:03 +02:00
Riccardo Spagni
98150be7d8 Merge pull request #1389
4adde042 p2p: possibly fix crash in relay_blocks (moneromooo-monero)
2016-12-04 22:22:07 +02:00
Riccardo Spagni
977dd9b76c Merge pull request #1385
5783dd8c tests: add unit tests for uri parsing (moneromooo-monero)
82ba2108 wallet: add API and RPC to create/parse monero: URIs (moneromooo-monero)
d9001b43 epee: add functions to convert from URL format (ie, %XX values) (moneromooo-monero)
2016-12-04 22:19:06 +02:00
Riccardo Spagni
836c748366 Merge pull request #1388
fcd178ef wallet_api: add a few daemon related getters (moneromooo-monero)
2016-12-04 22:17:48 +02:00
Riccardo Spagni
2fd43e25ee Merge pull request #1386
8f6ec90c blockchain: reject invalid pubkeys from v4 (moneromooo-monero)
2016-12-04 22:15:36 +02:00
Riccardo Spagni
3c05aeda1b Merge pull request #1384
8b0e04cb monero.supp: add a suppression for noisy boost cond var signalling (moneromooo-monero)
c3527daf epee: signal cond var before unlocking (moneromooo-monero)
2016-12-04 22:14:01 +02:00
Riccardo Spagni
42d07e865f Merge pull request #1383
00592189 change 'invalid address format' loglevel (Jaquee)
2016-12-04 22:02:58 +02:00
Riccardo Spagni
3d533d1037 Merge pull request #1380
657a70e0 wallet: add a getter for the filename path (moneromooo-monero)
2016-12-04 22:02:40 +02:00
Riccardo Spagni
fe89782512 Merge pull request #1379
d6086f5b Improve daemon RPC version handling (moneromooo-monero)
2016-12-04 22:01:49 +02:00
Riccardo Spagni
35e5909a10 Merge pull request #1378
91ffb61c Added command_line::is_yes (Lee Clagett)
2016-12-04 22:01:07 +02:00
Riccardo Spagni
6e3a96bc4a Merge pull request #1365
1df0fc71 Fix formatting of RPi2 build instructions (NanoAkron)
2016-12-04 21:55:22 +02:00
taushet
60633cf674 Spelling in errors 2016-12-04 20:12:40 +01:00
taushet
bdd3fb85d6 Spelling in errors. 2016-12-04 20:10:43 +01:00
moneromooo-monero
73ac3b8e26 wallet2: avoid possible undefined behavior on empty string 2016-12-04 14:56:06 +00: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
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
Jaquee
0059218908 change 'invalid address format' loglevel 2016-11-27 14:44:19 +01: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
Lee Clagett
91ffb61c25 Added command_line::is_yes 2016-11-25 21:57:27 -05:00
Riccardo Spagni
c36cb54340 Merge pull request #1372
17b6bd6 Fix DNS failures in offline mode preventing daemon startup (moneromooo-monero)
2016-11-24 13:01:35 +02:00
Riccardo Spagni
4248d5131c Merge pull request #1371
8dadf02 Fixed undefined behavior in TestDB (Lee Clagett)
2016-11-24 13:01:05 +02:00
Riccardo Spagni
2497a2d547 Merge pull request #1369
6d76072 simplewallet: remove double confirmation when submitting signed tx (moneromooo-monero)
92dea04 wallet2: fix wrong change being recorded for cold signed txes (moneromooo-monero)
2016-11-24 13:00:32 +02:00
Riccardo Spagni
7f7d7cab5d Merge pull request #1368
f6660e1 Updated GPG key for Jaquee (Jaquee)
2016-11-24 13:00:10 +02:00
Riccardo Spagni
b1a5d4bd5d Merge pull request #1366
67e910a Instructions for debugging LMDB crashes taken from #1360 (NanoAkron)
2016-11-24 12:59:27 +02:00
Riccardo Spagni
ce8a2315cf Merge pull request #1364
f025198 Added task_region - a fork/join task implementation (Lee Clagett)
2016-11-24 12:58:09 +02:00
Riccardo Spagni
694efaaf28 Merge pull request #1362
ab7b56e tests: fix uninitialized data valgrind reports in levin tests (moneromooo-monero)
73e8a76 tests: fix uninitialized data valgrind reports in serialization tests (moneromooo-monero)
2016-11-24 12:57:45 +02:00
Riccardo Spagni
3fa1b6623a Merge pull request #1361
1d9e223 rpc: do not include output indices for pool txes (moneromooo-monero)
e227d6e rpc: bump version after RPC changes (moneromooo-monero)
2c0173c Add a get_outs (fully text based) version of get_outs.bin (moneromooo-monero)
e05907b rpc: add output indices to gettransactions (moneromooo-monero)
2016-11-24 12:57:00 +02:00
Riccardo Spagni
a26b27f66e Merge pull request #1358
7abfc54 wallet: fix exporting outputs and key images with txes with two pubkeys (moneromooo-monero)
2016-11-24 12:55:14 +02:00
Riccardo Spagni
25369df4d8 Merge pull request #1357
5fc36f9 wallet2_api: fix history leak on destruction (moneromooo-monero)
2016-11-24 12:54:25 +02:00
Riccardo Spagni
f801dc8567 Merge pull request #1356
69b188c wallet2_api: fix payment ids from integrated addresses being ignored (moneromooo-monero)
2016-11-24 12:53:59 +02:00
Riccardo Spagni
52175502de Merge pull request #1353
452aeca epee: blind attempt to fix exit hang on windows (moneromooo-monero)
2016-11-24 12:53:35 +02:00
Riccardo Spagni
570acdc686 Merge pull request #1352
d01f5c7 wallet2: fix illegal memory access removing newlines from password (moneromooo-monero)
2016-11-24 12:53:14 +02:00
Riccardo Spagni
2121f3b2f0 Merge pull request #1351
e6264a2 wallet2: fix decrypting a bit too much in authenticated mode (moneromooo-monero)
2016-11-24 12:52:54 +02:00
Riccardo Spagni
d094c45822 Merge pull request #1197
fd181b0 Clamp refresh from height to blockchain height. (Dion Ahmetaj)
2016-11-24 12:51:17 +02:00
moneromooo-monero
17b6bd6d35 Fix DNS failures in offline mode preventing daemon startup 2016-11-23 23:14:49 +00:00
Lee Clagett
8dadf02c4f Fixed undefined behavior in TestDB 2016-11-23 17:22:35 -05: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
Lee Clagett
f025198f19 Added task_region - a fork/join task implementation 2016-11-23 14:41:25 -05: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
Jaquee
f6660e1851 Updated GPG key for Jaquee 2016-11-23 19:48:09 +01: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
NanoAkron
1df0fc719e Fix formatting of RPi2 build instructions 2016-11-21 23:21:58 +00:00
NanoAkron
67e910a1a0 Instructions for debugging LMDB crashes taken from #1360 2016-11-21 23:00:20 +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
Dion Ahmetaj
fd181b03bb Clamp refresh from height to blockchain height. 2016-11-18 13:40:55 -05: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
Riccardo Spagni
dbf2ab56c5 Merge pull request #1346
4eb7347 wallet: return fee in transfer RPC (moneromooo-monero)
2016-11-17 16:40:37 +02:00
Riccardo Spagni
5df6f0be80 Merge pull request #1318
4fca34d Wallet2: calculate approximate blockchain height on offline creation (Jacob Brydolf)
2016-11-17 16:37:30 +02:00
Riccardo Spagni
2988e1be8c Merge pull request #1344
a0131c8 wallet: auto sync outputs and key images in cold signing files (moneromooo-monero)
f806611 wallet2: fill key image and pubkey maps when importing outputs (moneromooo-monero)
5fe363c wallet: cast indices to string in logs to be nice to CLANG (moneromooo-monero)
11ae187 wallet2: try all tx keys when scanning a new transaction (moneromooo-monero)
072d646 wallet2: fill in key image map when importing key images (moneromooo-monero)
23d80b1 core: remove any tx pubkey from extra before adding one (moneromooo-monero)
d72376d simplewallet: add a verbose flag to incoming_transfers (moneromooo-monero)
47413a5 simplewallet: spell out change when signing a transfer (moneromooo-monero)
14cb088 simplewallet: print public keys too on spendkey/viewkey commands (moneromooo-monero)
a99ab49 wallet: fix serialization of new m_key_image_known member (moneromooo-monero)
2016-11-17 16:36:12 +02:00
Riccardo Spagni
e2816fefc5 Merge pull request #1337
18772a3 tests: fix another fee test on 32 bit (moneromooo-monero)
2016-11-17 16:30:14 +02:00
Riccardo Spagni
b7b54b6cff Merge pull request #1336
bd4da18 simplewallet: include amount sent in transfer confirmation (moneromooo-monero)
2016-11-17 16:26:49 +02:00
Riccardo Spagni
9e3cedce87 Merge pull request #1335
d48f2e9 wallet: fix serialization of new m_key_image_known member (moneromooo-monero)
2016-11-17 16:26:04 +02: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
moneromooo-monero
23d80b15fd core: remove any tx pubkey from extra before adding one
This will happen when signing a transaction from a cold wallet,
and we don't want the placeholder the hot wallet put in it.
2016-11-15 21:20:02 +00:00
moneromooo-monero
d72376d467 simplewallet: add a verbose flag to incoming_transfers
Prints pubkey and key image as well
2016-11-13 18:20:46 +00:00
moneromooo-monero
47413a5626 simplewallet: spell out change when signing a transfer
Also catch change to multiple addresses, this is unexpected
2016-11-13 17:48:45 +00:00
moneromooo-monero
14cb088300 simplewallet: print public keys too on spendkey/viewkey commands 2016-11-13 17:24:53 +00:00
moneromooo-monero
a99ab49dd5 wallet: fix serialization of new m_key_image_known member 2016-11-13 16:38:29 +00:00
moneromooo-monero
18772a3ba9 tests: fix another fee test on 32 bit 2016-11-13 12:21:52 +00:00
moneromooo-monero
bd4da18525 simplewallet: include amount sent in transfer confirmation 2016-11-13 12:12:22 +00:00
moneromooo-monero
d48f2e9bc6 wallet: fix serialization of new m_key_image_known member 2016-11-13 12:02:29 +00:00
Riccardo Spagni
9363b2ac19 Merge pull request #1334
265e460 Fixed generate-from-json bug introduced in 358e068 (Lee Clagett)
2016-11-13 11:32:43 +02:00
Riccardo Spagni
56c4514486 Merge pull request #1331
e1dd15b Don't build monero-wallet-rpc when building the GUI (iDunk5400)
2016-11-13 11:32:24 +02:00
Lee Clagett
265e4605ec Fixed generate-from-json bug introduced in 358e068 2016-11-12 21:55:08 -05:00
Jacob Brydolf
4fca34ddb4 Wallet2: calculate approximate blockchain height on offline creation
Wallet API: add approximateBlockChainHeight()
2016-11-13 03:36:44 +01:00
iDunk5400
e1dd15b050 Don't build monero-wallet-rpc when building the GUI 2016-11-12 19:22:19 +01:00
Riccardo Spagni
eb6d66e4fc Merge pull request #1330
70d4915 wallet: add version dependency to the wallet target (moneromooo-monero)
2016-11-12 17:51:53 +02:00
Riccardo Spagni
41b2886795 Merge pull request #1329
cd929b8 levin: fix wrong value passed as return code to remote call (moneromooo-monero)
2016-11-12 17:51:25 +02:00
Riccardo Spagni
696fcba2a0 Merge pull request #1327
77e5bec added cmd to compile gtest (Gingeropolous)
2016-11-12 17:50:57 +02:00
Riccardo Spagni
fd4342097a Merge pull request #1325
2078cb6 tests: fix tests builds after fluffy blocks merge (moneromooo-monero)
2016-11-12 17:50:26 +02:00
Riccardo Spagni
300cb7b27b Merge pull request #1322
65528ae Always compile Position Independent Code on 64-bit ARMv8 systems (NanoAkron)
2016-11-12 17:49:31 +02:00
moneromooo-monero
70d4915980 wallet: add version dependency to the wallet target 2016-11-12 12:55:19 +00:00
moneromooo-monero
cd929b89b0 levin: fix wrong value passed as return code to remote call
When receiving an answer packet, the command code was passed
to the callback instead of the error code. This was hiding
the "command not found" failure from the peer, and in turn
causing the code to attempt to deserialize a non existent
reply string.
2016-11-12 10:12:23 +00:00
Gingeropolous
77e5bec0ab added cmd to compile gtest 2016-11-11 23:50:24 -05:00
NanoAkron
65528aef4e Always compile Position Independent Code on 64-bit ARMv8 systems 2016-11-12 00:26:49 +00:00
moneromooo-monero
2078cb6f2f tests: fix tests builds after fluffy blocks merge 2016-11-11 18:17:16 +00:00
Riccardo Spagni
6a2bb62827 Merge pull request #1316
358e068 Created monero-wallet-rpc, moving functionality from monero-wallet-cli (Lee Clagett)
2016-11-11 12:48:39 +02:00
Riccardo Spagni
524ff61ad5 Merge pull request #1321
0e418d2 rpc: bump RPC version (moneromooo-monero)
2016-11-11 12:38:01 +02:00
Riccardo Spagni
797fbbca2b Merge pull request #1319
c27c0fe tests: fix fee unit tests on 32 bit (moneromooo-monero)
2016-11-11 12:37:22 +02:00
Riccardo Spagni
a3cd7230f8 Merge pull request #1315
9150a16 Wallet API: use stored refresh height when rebuilding cache (Jacob Brydolf)
2016-11-11 12:35:47 +02:00
Riccardo Spagni
3fd13080b7 Merge pull request #1314
63772e4 wallet: fix corner case of no recent outputs available (moneromooo-monero)
2016-11-11 12:35:25 +02:00
Riccardo Spagni
0e0bf432a4 Merge pull request #1313
1669621 wallet2_api: support for sweeping all (moneromooo-monero)
2016-11-11 12:35:04 +02:00
Riccardo Spagni
5f568533aa Merge pull request #1263
d61bd81 add lightweight block propagation ("fluffy blocks") (Dion Ahmetaj)
2016-11-11 12:34:43 +02:00
moneromooo-monero
0e418d2a58 rpc: bump RPC version
I forgot to bump it previously when changing RPC, most notably
for the addition of the unlocked field in the histogram RPC.
This causes new wallets to not realize when they're talking to
an older daemon, and get confused trying to get outputs to use
as fake outs. This otherwise gratuitous bump ensures than old
daemons will be detected by wallets using this code.
2016-11-10 23:00:24 +00:00
Lee Clagett
358e068e87 Created monero-wallet-rpc, moving functionality from monero-wallet-cli 2016-11-10 16:39:27 -05:00
moneromooo-monero
c27c0feb3d tests: fix fee unit tests on 32 bit 2016-11-10 20:40:06 +00:00
moneromooo-monero
1669621937 wallet2_api: support for sweeping all 2016-11-09 19:32:37 +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
Jacob Brydolf
9150a16ed1 Wallet API: use stored refresh height when rebuilding cache 2016-11-09 18:46:03 +01:00
moneromooo-monero
63772e4048 wallet: fix corner case of no recent outputs available
Also clarify related logs
2016-11-09 14:01:54 +00:00
Riccardo Spagni
38727f7d2f Merge pull request #1312
acf908c thread_group: fix build with asserts enabled (moneromooo-monero)
2016-11-09 14:13:35 +02:00
Riccardo Spagni
7931cb19ef Merge pull request #1311
5c4cb96 cryptonote_protocol: drop connection when find_blockchain_supplement fails (moneromooo-monero)
2016-11-09 14:13:06 +02:00
Riccardo Spagni
dc5e0e45cd Merge pull request #1310
40a68e2 wallet2_api: add API for create_unmixable_sweep_transactions (moneromooo-monero)
2016-11-09 14:11:57 +02:00
Riccardo Spagni
56c594a8fe Merge pull request #1309
c441a61 wallet2_api: API to sign and verify a message (moneromooo-monero)
2016-11-09 14:10:39 +02:00
Riccardo Spagni
06ca304b06 Merge pull request #1307
4dcb74f wallet_api: PendingTransaction::txCount - number of split transactions (Ilya Kitaev)
2016-11-09 14:10:12 +02:00
Riccardo Spagni
144a7f090a Merge pull request #1305
c80f4d4 wallet: fix output collision detection for view wallets (moneromooo-monero)
2016-11-09 14:08:34 +02:00
moneromooo-monero
acf908c834 thread_group: fix build with asserts enabled
See https://github.com/monero-project/monero/pull/1291
2016-11-09 11:29:06 +00:00
moneromooo-monero
5c4cb96cfb cryptonote_protocol: drop connection when find_blockchain_supplement fails
This will be when we can't find common ground between the peer's
short chain history and our blockchain.

This fixes bad peers claiming a higher blockchain height from never
dropped, and keeping the node in synchronizing state forever, since
we will never get blocks from that peer.
2016-11-09 11:04:20 +00:00
moneromooo-monero
c441a61ef6 wallet2_api: API to sign and verify a message 2016-11-08 21:21:08 +00:00
Ilya Kitaev
4dcb74f97f wallet_api: PendingTransaction::txCount - number of split transactions 2016-11-09 00:13:18 +03:00
Riccardo Spagni
e8a55db29d Merge pull request #1308
0c530de Wallet API: Pause refresh while creating transaction (Jacob Brydolf)
2016-11-08 22:57:04 +02:00
Riccardo Spagni
18fdd8116e Merge pull request #1306
8aba0d4 wallet: encrypt outputs and key images files with the view key (moneromooo-monero)
2016-11-08 22:55:56 +02:00
Riccardo Spagni
7c7a6cf2f8 Merge pull request #1302
63fe6fd wallet2_api: allow connection to return "yes, but wrong version" (moneromooo-monero)
2016-11-08 22:53:13 +02:00
Riccardo Spagni
96e0138ebf Merge pull request #1301
35da3cb Wallet API: added getTxKey() (Jacob Brydolf)
2016-11-08 22:50:13 +02:00
Jacob Brydolf
35da3cb074 Wallet API: added getTxKey() 2016-11-08 21:48:26 +01:00
Riccardo Spagni
c57ce06a97 Merge pull request #1300
eb19492 wallet2_api: do not copy the whole pending tx when iterating (moneromooo-monero)
2016-11-08 22:48:04 +02:00
Riccardo Spagni
af2ceb29fa Merge pull request #1298
97288a5 wallet2_api: add API for tx notes (moneromooo-monero)
2016-11-08 22:45:54 +02:00
Riccardo Spagni
c05cecf036 Merge pull request #1297
af8a260 wallet_api: txkey checking functions for the GUI (moneromooo.monero)
2016-11-08 22:44:15 +02:00
Riccardo Spagni
3bd0456144 Merge pull request #1296
e59caf8 performance_tests: re-enable them... (moneromooo-monero)
2016-11-08 22:41:32 +02:00
Riccardo Spagni
dce47d52af Merge pull request #1291
64094e5 adding thread_group for managing async tasks (Lee Clagett)
2016-11-08 22:37:43 +02:00
Riccardo Spagni
6523694581 Merge pull request #1287
7edf76f CONTRIBUTING: add something about testing and bug reporting (moneromooo-monero)
2016-11-08 22:36:18 +02:00
Riccardo Spagni
4c44d896d3 Merge pull request #1285
a970a4e refresh speedup (luigi1111)
2016-11-08 22:34:26 +02:00
Riccardo Spagni
04003fe8e2 Merge pull request #1284
bc9b498 README: update coverity project number (anonimal)
9d9ab38 README: update armv8 link, add more coverage types (anonimal)
6f7f21f README: update build matrix (distro and ordering) (anonimal)
6711b98 README: add Freenode custom webchat link (anonimal)
b57d1e1 README: add build matrix like that in Kovri (anonimal)
38dc0bf README/Repo: remove Travis CI (anonimal)
2016-11-08 22:33:52 +02:00
Riccardo Spagni
0fa6cbef3f Merge pull request #1276
18f66f4 wallet: use the dynamic per kB fee (moneromooo-monero)
e6deb8a rpc: add a dynamic fee estimation RPC call (moneromooo-monero)
82dbba1 core: dynamic fee algorithm from ArticMine (moneromooo-monero)
2016-11-08 22:33:13 +02:00
moneromooo-monero
40a68e22fa wallet2_api: add API for create_unmixable_sweep_transactions 2016-11-08 20:03:07 +00:00
Jacob Brydolf
0c530de057 Wallet API: Pause refresh while creating transaction 2016-11-08 13:20:42 +01:00
moneromooo-monero
8aba0d4b4c wallet: encrypt outputs and key images files with the view key
This key is available to both cold and hot wallet.
Authenticated encryption will guard against interception and/or
modification of the file.
2016-11-07 20:01:05 +00:00
moneromooo-monero
c80f4d416d wallet: fix output collision detection for view wallets
View wallets do not have the spend secret key, and are thus
unable to derive key images for incoming outputs. Moreover,
a previous patch set key images to zero as a means to mark
an output as having an unknown key image, so they could be
filled in when importing key images at a later time. That
later patch caused spurious collisions. We now use public
keys to detect duplicate outputs. Public keys obtained from
the blockchain are checked to be identical to the ones
derived locally, so can't be spoofed.
2016-11-07 18:59:30 +00:00
moneromooo-monero
63fe6fd9ba wallet2_api: allow connection to return "yes, but wrong version" 2016-11-07 12:00:29 +00:00
anonimal
bc9b498598 README: update coverity project number 2016-11-06 18:21:08 +00:00
anonimal
9d9ab38fcd README: update armv8 link, add more coverage types
- Fixes armv8 build link
- Adds coverage matrix, coverity and license badges
2016-11-06 18:11:16 +00:00
moneromooo-monero
eb194925ec wallet2_api: do not copy the whole pending tx when iterating 2016-11-06 10:36:08 +00:00
moneromooo-monero
97288a5ce2 wallet2_api: add API for tx notes 2016-11-05 21:19:08 +00:00
moneromooo.monero
af8a2600aa wallet_api: txkey checking functions for the GUI 2016-11-05 15:24:05 +00:00
Riccardo Spagni
1372f255af Merge pull request #1295
b5d6faa wallet: fix bad amounts/fees again (moneromooo-monero)
2016-11-05 10:28:25 +02:00
anonimal
6f7f21f4e9 README: update build matrix (distro and ordering) 2016-11-05 01:17:08 +00:00
moneromooo-monero
e59caf87d3 performance_tests: re-enable them...
I think I'm the only one to review things here...
2016-11-04 11:11:45 +00:00
Lee Clagett
64094e5f4e adding thread_group for managing async tasks 2016-11-02 19:21:55 -04:00
moneromooo-monero
b5d6faada3 wallet: fix bad amounts/fees again
m_amount_out was sometimes getting initialized with the sum of
an transaction's outputs, and sometimes with the sum of outputs
that were not change. This caused confusion and bugs. We now
always set it to the sum of outputs. This reverts an earlier
fix for bad amounts as this used the other semantics. The wallet
data should be converted automatically in a percentage of cases
that I'm hesitant to estimate. In any case, restoring from seed
or keys or rebuilding the cache will get it right.
2016-11-02 23:11:30 +00:00
Riccardo Spagni
d51f1af75f Merge pull request #1272
48b57d8 monero.supp: valgrind suppressions file (moneromooo-monero)
ffd8c41 ringct: check the size of amount_keys is the same as destinations (moneromooo-monero)
836669d ringct: always shutdown the boost io service (moneromooo-monero)
2016-11-01 21:49:30 +02:00
luigi1111
a970a4e3cf refresh speedup
Compute derivation only once per tx, instead of once per output. Approx 33% faster while using 75% as much CPU on my machine. Note old functions in cryptonote_core (lookup_acc_outs and is_out_to_acc) are still used by tests.
2016-11-01 11:24:04 -05:00
Riccardo Spagni
b06c1abaa6 Merge pull request #1278
43ec2d0 Wallet API: added walletExists logic (Jacob Brydolf)
2016-11-01 15:29:44 +02:00
Riccardo Spagni
6f85b20d92 Merge pull request #1283
4869db7 adding static_assert to pod functions in string tools (Lee Clagett)
2016-11-01 15:13:10 +02:00
Riccardo Spagni
f189fe51ac Merge pull request #1282
f5ccfa4 core: fix removal of extra nonce using wrong type (moneromooo-monero)
3c2cad2 Revert "remove cn_deserialize" (moneromooo-monero)
2016-11-01 15:12:30 +02:00
Riccardo Spagni
d53bc2eddf Merge pull request #1281
bb560dd wallet: new import_outputs/export_outputs commands (moneromooo-monero)
2016-11-01 15:12:03 +02:00
Riccardo Spagni
95e0010fbb Merge pull request #1277
7e6d3cf wallet: set incoming outputs' key image to 0 on view wallets (moneromooo-monero)
1f9e6a4 wallet: print tx overview on submit_transfer too (moneromooo-monero)
2016-11-01 15:06:51 +02:00
Riccardo Spagni
77284c026f Merge pull request #1275
4bfb81a simplewallet: remove destinations with zero amount in sign_transfer (moneromooo-monero)
2016-11-01 15:03:08 +02:00
Riccardo Spagni
1e153c2fc6 Merge pull request #1273
f71b067 Changed to ..._HASHBITS everywhere for consistency (NanoAkron)
2016-11-01 15:01:02 +02:00
Riccardo Spagni
703999b21a Merge pull request #1260
092f7c5 utils: add anonimal's GPG key (anonimal)
2016-11-01 14:55:19 +02:00
moneromooo-monero
7edf76f92a CONTRIBUTING: add something about testing and bug reporting 2016-11-01 10:18:51 +00:00
anonimal
6711b982e7 README: add Freenode custom webchat link
Replaces irc:// link which is not always rendered
2016-10-31 21:00:50 +00:00
anonimal
b57d1e1efb README: add build matrix like that in Kovri 2016-10-31 20:55:57 +00:00
anonimal
38dc0bf497 README/Repo: remove Travis CI
We use Buildbot now: https://build.getmonero.org/
2016-10-31 20:41:29 +00:00
Lee Clagett
4869db702a adding static_assert to pod functions in string tools 2016-10-31 13:22:21 -04:00
moneromooo-monero
18f66f44ef wallet: use the dynamic per kB fee 2016-10-31 08:38:06 +00:00
moneromooo-monero
e6deb8abda rpc: add a dynamic fee estimation RPC call 2016-10-31 08:38:00 +00:00
moneromooo-monero
82dbba10d4 core: dynamic fee algorithm from ArticMine
The fee will vary based on the base reward and the current
block size limit:

fee = (R/R0) * (M0/M) * F0

R: base reward
R0: reference base reward (10 monero)
M: block size limit
M0: minimum block size limit (60000)
F0: 0.002 monero

Starts applying at v4
2016-10-31 08:37:08 +00:00
moneromooo-monero
f5ccfa4001 core: fix removal of extra nonce using wrong type 2016-10-30 20:44:45 +00:00
moneromooo-monero
3c2cad2d46 Revert "remove cn_deserialize"
This is useful (to me).

This reverts commit f968ccb9d3.
2016-10-30 20:34:48 +00:00
moneromooo-monero
bb560dd814 wallet: new import_outputs/export_outputs commands
The intended use is to export outputs from a hot wallet, which
can scan incoming transfers from the network, and import them
in the cold wallet, which can't. The cold wallet can then compute
key images for those outputs, which can then be exported with
export_key_images, etc.
2016-10-30 19:37:09 +00:00
Jacob Brydolf
43ec2d002a Wallet API: added walletExists logic 2016-10-30 15:34:50 +01:00
moneromooo-monero
7e6d3cf441 wallet: set incoming outputs' key image to 0 on view wallets
This allows rescan_spent to know the daemon response to those
is not valid.
2016-10-30 12:14:33 +00:00
moneromooo-monero
1f9e6a46d8 wallet: print tx overview on submit_transfer too
This is on the potentially compromised wallet, but still guards
against stupid mistakes.
2016-10-30 10:49:22 +00:00
moneromooo-monero
4bfb81a7f5 simplewallet: remove destinations with zero amount in sign_transfer
This will happen when sending to another address, after removing
the fee.
2016-10-30 09:15:04 +00:00
NanoAkron
f71b06770b Changed to ..._HASHBITS everywhere for consistency 2016-10-29 14:59:06 +01:00
moneromooo-monero
48b57d813c monero.supp: valgrind suppressions file
Seeded with a spurious problem when inspecting stack trace
2016-10-29 13:34:24 +01:00
moneromooo-monero
ffd8c41f36 ringct: check the size of amount_keys is the same as destinations 2016-10-29 13:33:48 +01:00
moneromooo-monero
836669d276 ringct: always shutdown the boost io service
Even if no worker threads were started, it needs shutting down
or it will cause an invalid access in the io service thread
2016-10-29 13:31:53 +01:00
Riccardo Spagni
83b0511731 Merge pull request #1270
fdef09f Wallet API: make sure path exists before searching for wallets (Jacob Brydolf)
2016-10-29 11:35:48 +02:00
Riccardo Spagni
1710a7dbc2 Merge pull request #1269
145d0b7 Add instructions to README.md for building on the Raspberry Pi 2 (NanoAkron)
2016-10-29 11:35:17 +02:00
Riccardo Spagni
726e8e7676 Merge pull request #1268
54c9400 Changed ARM6/7/8 to ARMv6/7/8 to be nice to peronero (NanoAkron)
2016-10-29 11:34:38 +02:00
Riccardo Spagni
2746cceeea Merge pull request #1267
d28db23 Unkonown -> unknown (NanoAkron)
2016-10-29 11:33:19 +02:00
Riccardo Spagni
3e43732455 Merge pull request #1264
a269f03 Report Boost library version during compilation (NanoAkron)
2016-10-29 11:32:26 +02:00
Riccardo Spagni
6b3b23cc30 Merge pull request #1262
56b07f7 tests: add performance test for keypair::generate (moneromooo-monero)
2016-10-29 11:31:16 +02:00
Riccardo Spagni
3365f770dd Merge pull request #1261
069d688 simplewallet: log transactions to submit in submit_transfer (moneromooo-monero)
31abac4 wallet: fix pre-rct cold wallet signing not splitting change (moneromooo-monero)
2016-10-29 11:30:21 +02:00
Riccardo Spagni
6a303b9a3a Merge pull request #1254
eb4ecd4 daemon: fix min/max tracking using the wrong size (moneromooo-monero)
2016-10-29 11:23:08 +02:00
Riccardo Spagni
971f3ae031 Merge pull request #1251
59f0d4b ringct: some more small optimizations (moneromooo-monero)
2016-10-29 11:22:27 +02:00
Riccardo Spagni
b9149d4d00 Merge pull request #1249
c93c1ad Added guzzi key (guzzi_jones)
2016-10-29 11:21:47 +02:00
Jacob Brydolf
fdef09f11c Wallet API: make sure path exists before searching for wallets 2016-10-28 22:29:33 +02:00
NanoAkron
145d0b78ef Add instructions to README.md for building on the Raspberry Pi 2 2016-10-28 16:02:25 +01:00
NanoAkron
54c9400fbe Changed ARM6/7/8 to ARMv6/7/8 to be nice to peronero 2016-10-27 23:22:07 +01:00
NanoAkron
d28db2368e Unkonown -> unknown 2016-10-27 23:07:37 +01:00
NanoAkron
a269f03e5d Report Boost library version during compilation 2016-10-27 21:38:29 +01:00
moneromooo-monero
56b07f7b89 tests: add performance test for keypair::generate 2016-10-26 22:10:05 +01:00
moneromooo-monero
069d688cf7 simplewallet: log transactions to submit in submit_transfer
Not as trustworthy as this is in the view wallet, the one
that's considered compromised.
2016-10-26 13:17:29 +01:00
moneromooo-monero
31abac4daf wallet: fix pre-rct cold wallet signing not splitting change
Re-creating the transaction on the cold wallet was not splitting
the change, causing the transaction to be rejected by the network.
This worked on testnet since amounts do not have to be split.

Also add selected_transfers, which can now be saved since they're
size_t rather than iterators. This allows the view wallet to
properly set the sent outputs as spent and update balance.

Bump transfer file version numbers to match.
2016-10-25 21:44:31 +01:00
anonimal
092f7c528d utils: add anonimal's GPG key 2016-10-25 18:53:30 +00:00
moneromooo-monero
eb4ecd442d daemon: fix min/max tracking using the wrong size
Reported by iDunk
2016-10-23 23:18:34 +01:00
Riccardo Spagni
18e406a0e6 Merge pull request #1253
3094670 daemon: even when switching branches, compile the damn thing ffs (moneromooo-monero)
2016-10-23 21:25:32 +02:00
moneromooo-monero
30946700a3 daemon: even when switching branches, compile the damn thing ffs 2016-10-23 20:21:00 +01:00
Riccardo Spagni
6fa35e3539 Merge pull request #1252
2f4f6c7 daemon: do not divide by 0 when the pool is empty (moneromooo-monero)
2016-10-23 21:08:47 +02:00
moneromooo-monero
2f4f6c7c26 daemon: do not divide by 0 when the pool is empty 2016-10-23 20:05:13 +01:00
Riccardo Spagni
6a2157b610 Merge pull request #1245
ff88252 simplewallet: factor locked_transfer, and fix a few rough edges (moneromooo-monero)
2016-10-23 19:27:09 +02:00
Riccardo Spagni
a0975e59ed Merge pull request #1250
839280d daemon: add a print_pool_stats daemon command (moneromooo-monero)
2016-10-23 19:25:33 +02:00
moneromooo-monero
ff8825210d simplewallet: factor locked_transfer, and fix a few rough edges
Factor locked_transfer into transfer_main, which brings various
improvements for free (multiple addresses, proper detection of
multiple payment ids, obeying the prompt settings).

Also fix a few things, such as using uint64_t instead of int
for block heights, actually checking whether getting blockchain
height succeeded, etc.
2016-10-23 18:21:30 +01:00
Riccardo Spagni
854abeb3bb Merge pull request #1247
10a79ea daemon: report transaction relay status in print_pool* commands (moneromooo-monero)
1e16366 core: notify the txpool when transactions are relayed (moneromooo-monero)
f3c374f tx_pool: set relayed flag on relay (moneromooo-monero)
2016-10-23 19:16:30 +02:00
Riccardo Spagni
4e98d2958c Merge pull request #1246
372f338 wallet: sanity check on selected transfer indices in signed ptx (moneromooo-monero)
2016-10-23 19:09:18 +02:00
Riccardo Spagni
31ceb830e5 Merge pull request #1239
12d8616 perf_timer: format string fix for 32 bits (moneromooo-monero)
2016-10-23 19:05:44 +02:00
Riccardo Spagni
13187379cc Merge pull request #1232
bfc1de7 CONTRIBUTING: somes notes about how to contribute (moneromooo-monero)
2016-10-23 19:04:37 +02:00
Riccardo Spagni
92095104fe Merge pull request #1230
06b642d wallet_api: add address validation functions (moneromooo-monero)
2016-10-23 19:04:01 +02:00
moneromooo-monero
839280d5fc daemon: add a print_pool_stats daemon command
Helps see what's going on now that Monero is getting used
2016-10-23 16:11:20 +01:00
moneromooo-monero
59f0d4b574 ringct: some more small optimizations 2016-10-23 16:10:17 +01:00
moneromooo-monero
10a79eae24 daemon: report transaction relay status in print_pool* commands 2016-10-23 00:32:55 +01:00
moneromooo-monero
1e163666f3 core: notify the txpool when transactions are relayed 2016-10-23 00:32:49 +01:00
guzzi_jones
c93c1ad0e5 Added guzzi key 2016-10-22 23:16:16 +00:00
Riccardo Spagni
4f6ea2eb6a Merge pull request #1229
b6b86ab wallet2_api: recognize full size payment ids as valid (moneromooo-monero)
2016-10-22 22:19:43 +02:00
Riccardo Spagni
b3d4505ae1 Merge pull request #1228
2bf65df wallet_api: do not override invalid payment id (moneromooo-monero)
2016-10-22 22:18:36 +02:00
Riccardo Spagni
09f62ed33e Merge pull request #1225
04da979 Always confirm transfers defaults to ON/YES (NanoAkron)
2016-10-22 22:16:39 +02:00
Riccardo Spagni
f800390ccc Merge pull request #1224
8231997 simplewallet: fix sweep_all misreporting sweeped amount for rct outputs (moneromooo-monero)
985f61a wallet: force 0 mixin transactions to use pre-rct txes (moneromooo-monero)
2016-10-22 22:15:50 +02:00
Riccardo Spagni
7c5431624e Merge pull request #1223
0950be9 wallet: speed up output selection, and fix bug with relatedness calculation (moneromooo-monero)
0eba133 wallet: fix mixup between mixin 2 and 4 before/after v5 (moneromooo-monero)
2016-10-22 22:15:16 +02:00
Riccardo Spagni
b9f31bbc10 Merge pull request #1222
5e10fb0 rpc: add blockchain cumulative difficulty to getinfo call (moneromooo-monero)
2016-10-22 22:14:35 +02:00
Riccardo Spagni
7426b5374f Merge pull request #1221
094f4c8 rpc: add missing top block hash to json getinfo call (moneromooo-monero)
2016-10-22 22:13:24 +02:00
Riccardo Spagni
9feb358e46 Merge pull request #1220
e76dcdd wallet: improve error messages when not enough money for transfer (moneromooo-monero)
2016-10-22 22:12:17 +02:00
Riccardo Spagni
e48ef1684c Merge pull request #1219
2d7083c wallet_api: fix wrong amount in tx history (moneromooo-monero)
b5f2001 simplewallet: fix wrong amount in show_transfers (moneromooo-monero)
2016-10-22 22:11:12 +02:00
Riccardo Spagni
2bb0bdc8b8 Merge pull request #1218
3429bfb ringct: thread verRct and verRctSimple (moneromooo-monero)
e06a4da ringct: remove unneeded type conversions (moneromooo-monero)
afc70df ringct: reserve space in vectors to avoid excessive reallocation (moneromooo-monero)
9ebf7b6 ringct: avoid unnecessary memcpy (moneromooo-monero)
1fe75c1 ringct: add a few consts where possible (moneromooo-monero)
ab002a1 ringct: pass vectors by const ref where possible (moneromooo-monero)
2016-10-22 22:10:01 +02:00
Riccardo Spagni
af2b1ec606 Merge pull request #1216
9c73128 Change default dust threshold to equal fee per kb (AwfulCrawler)
2016-10-22 22:08:31 +02:00
Riccardo Spagni
b53c9e5549 Merge pull request #1200
a3748f4 Rewrote add_wallet_create_if_needed for clearer flow and behaviour (NanoAkron)
2016-10-22 22:07:38 +02:00
moneromooo-monero
f3c374fe08 tx_pool: set relayed flag on relay 2016-10-22 20:46:19 +01:00
moneromooo-monero
372f338682 wallet: sanity check on selected transfer indices in signed ptx 2016-10-22 18:07:26 +01:00
moneromooo-monero
12d861694d perf_timer: format string fix for 32 bits 2016-10-20 18:43:33 +01:00
Riccardo Spagni
0b93dd39db Merge pull request #1237
4fd56a5 unit_tests: fix build after get_output_histogram signature change (moneromooo-monero)
2016-10-20 17:08:20 +02:00
moneromooo-monero
4fd56a52bc unit_tests: fix build after get_output_histogram signature change 2016-10-19 09:34:12 +01:00
Riccardo Spagni
d63fabdc62 Merge pull request #1215
a6bc110 patched parameter type bug that was causing failure on 32 bit (Dion Ahmetaj)
2016-10-18 12:22:22 +02:00
Riccardo Spagni
0a41b03fc7 Merge pull request #1082
88faec7 wallet: select part of the fake outs from recent outputs (moneromooo-monero)
2016-10-18 12:21:11 +02:00
moneromooo-monero
bfc1de7aa2 CONTRIBUTING: somes notes about how to contribute 2016-10-17 23:18:34 +01:00
moneromooo-monero
06b642dfe4 wallet_api: add address validation functions
The payment id from integrated addresses is also parsed
2016-10-16 16:52:45 +01:00
moneromooo-monero
b6b86ab347 wallet2_api: recognize full size payment ids as valid 2016-10-16 13:54:53 +01:00
moneromooo-monero
2bf65dfb8d wallet_api: do not override invalid payment id
Instead, return an empty string to mark the error
2016-10-16 13:17:29 +01:00
NanoAkron
a3748f40ea Rewrote add_wallet_create_if_needed for clearer flow and behaviour 2016-10-15 22:29:28 +01:00
NanoAkron
04da979f46 Always confirm transfers defaults to ON/YES 2016-10-15 20:38:07 +01:00
moneromooo-monero
8231997b66 simplewallet: fix sweep_all misreporting sweeped amount for rct outputs
RingCT outputs will be 0 in the vin, so we need to get the actual
amount from elsewhere.
2016-10-15 19:18:52 +01:00
moneromooo-monero
985f61a4ec wallet: force 0 mixin transactions to use pre-rct txes
rct transactions does not support 0 mixin, and those are
now typically dust sweep transactions, for which a lower
fee is a must.
2016-10-15 18:42:04 +01:00
moneromooo-monero
88faec75fe wallet: select part of the fake outs from recent outputs
25% of the outputs are selected from the last 5 days (if possible),
in order to avoid the common case of sending recently received
outputs again. 25% and 5 days are subject to review later, since
it's just a wallet level change.
2016-10-15 18:17:16 +01:00
moneromooo-monero
0950be9e34 wallet: speed up output selection, and fix bug with relatedness calculation 2016-10-15 16:32:08 +01:00
moneromooo-monero
0eba1335be wallet: fix mixup between mixin 2 and 4 before/after v5 2016-10-15 16:07:18 +01:00
moneromooo-monero
5e10fb042d rpc: add blockchain cumulative difficulty to getinfo call 2016-10-15 15:00:21 +01:00
moneromooo-monero
094f4c8cc6 rpc: add missing top block hash to json getinfo call 2016-10-15 14:35:29 +01:00
moneromooo-monero
e76dcdd810 wallet: improve error messages when not enough money for transfer 2016-10-15 14:31:40 +01:00
moneromooo-monero
2d7083ca56 wallet_api: fix wrong amount in tx history 2016-10-15 13:56:25 +01:00
moneromooo-monero
b5f20012d3 simplewallet: fix wrong amount in show_transfers 2016-10-15 13:56:09 +01:00
moneromooo-monero
3429bfb71d ringct: thread verRct and verRctSimple 2016-10-15 13:32:13 +01:00
moneromooo-monero
e06a4daf33 ringct: remove unneeded type conversions 2016-10-15 11:58:39 +01:00
moneromooo-monero
afc70df7ea ringct: reserve space in vectors to avoid excessive reallocation 2016-10-15 11:58:34 +01:00
moneromooo-monero
9ebf7b6dcf ringct: avoid unnecessary memcpy 2016-10-15 11:58:29 +01:00
moneromooo-monero
1fe75c1ea7 ringct: add a few consts where possible 2016-10-15 11:58:24 +01:00
moneromooo-monero
ab002a1d97 ringct: pass vectors by const ref where possible 2016-10-15 11:58:18 +01:00
Dion Ahmetaj
a6bc1103fd patched parameter type bug that was causing failure on 32 bit 2016-10-14 10:37:10 -04:00
AwfulCrawler
9c73128835 Change default dust threshold to equal fee per kb 2016-10-12 14:04:26 +13:00
Riccardo Spagni
34fcfcd7cc Merge pull request #1203
4038e86 Add performance timers for ringct tx verification (moneromooo-monero)
74dfdb0 perf_timer: new class and macros to make performance logs easier (moneromooo-monero)
2016-10-11 10:31:26 +02:00
Riccardo Spagni
3db0ebafe5 Merge pull request #1204
7db29d6 print_coinbase_tx_sum now breaks output into fee and emission components (Dion Ahmetaj)
dd6c443 changed params from start/end index to height/count (Dion Ahmetaj)
e95d3f3 attempted to remove whitespace spam (Dion Ahmetaj)
412da63 added print_coinbase_tx_sum option (Dion Ahmetaj)
2016-10-11 10:30:53 +02:00
Riccardo Spagni
9ea25cc866 Merge pull request #1205
eeb7ecf Hard fork info in the Readme (Gingeropolous)
2016-10-11 10:30:14 +02:00
Gingeropolous
eeb7ecfd81 Hard fork info in the Readme
With dashes in the dates and the markdown code aligned to make cows happy. :)
2016-10-10 23:22:13 -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
e95d3f359b attempted to remove whitespace spam 2016-10-10 16:41:24 -04:00
moneromooo-monero
4038e86527 Add performance timers for ringct tx verification 2016-10-10 21:24:21 +01:00
moneromooo-monero
74dfdb0b30 perf_timer: new class and macros to make performance logs easier
Call PERF_TIMER(name), which is scoped.
2016-10-10 21:24:15 +01:00
Dion Ahmetaj
412da63622 added print_coinbase_tx_sum option 2016-10-10 15:45:51 -04:00
Riccardo Spagni
304c087dd0 Merge pull request #1201
a8cd656 Wallet API: added setRecoveringFromSeed(); (Jacob Brydolf)
2016-10-10 20:42:21 +02:00
Jacob Brydolf
a8cd65646c Wallet API: added setRecoveringFromSeed(); 2016-10-10 19:37:10 +02:00
Riccardo Spagni
0673db16ad Merge pull request #1195
697ce1d libwallet_api: reverted deleted curly brace (Ilya Kitaev)
bb9094f libwallet_api: fixes for transaction history (Ilya Kitaev)
62b3708 libwallet_api: do not signal on sent/received tx until wallet completely synchronized (Ilya Kitaev)
11fab41 libwallet_api: TransactionHistory: read/write syncchronization (Ilya Kitaev)
559f379 libwallet_api: test: adjusted mixin_count=4 as it's minumum allowed (Ilya Kitaev)
8b0cb8c libwallet_api: some renamings (Ilya Kitaev)
db3282c Initialize transaction history if empty (Ilya Kitaev)
85f5e73 libwallet_api: fixes for transaction history (Ilya Kitaev)
2016-10-09 14:34:59 +02:00
Riccardo Spagni
fe43461c2b Merge pull request #1194
3126ba7 ringct: use const refs as parameters where appropriate (moneromooo-monero)
d8eae67 tests: add performance test for ge_frombytes_vartime (moneromooo-monero)
3cb2436 core: remove some unused code (moneromooo-monero)
1eaa3e8 tests: add performance tests for rct signatures (moneromooo-monero)
2016-10-09 14:34:38 +02:00
Riccardo Spagni
8cd01bc378 Merge pull request #1192
36a89ab libwallet_api: Added option to restore from specific height (Jacob Brydolf)
2016-10-09 14:33:17 +02:00
Riccardo Spagni
0589209eb4 Merge pull request #1191
9f31e2d wallet: do not announce pool txes as money spent/received (yet) (moneromooo-monero)
2016-10-09 14:29:16 +02:00
moneromooo-monero
3126ba7425 ringct: use const refs as parameters where appropriate 2016-10-08 22:16:23 +01:00
moneromooo-monero
d8eae67ef2 tests: add performance test for ge_frombytes_vartime
At luigi1111's request
2016-10-08 19:35:47 +01:00
moneromooo-monero
3cb2436528 core: remove some unused code 2016-10-08 19:35:40 +01:00
moneromooo-monero
1eaa3e8040 tests: add performance tests for rct signatures 2016-10-08 19:35:34 +01:00
Jacob Brydolf
36a89ab435 libwallet_api: Added option to restore from specific height 2016-10-08 00:57:09 +02:00
Riccardo Spagni
9798bde11e Merge pull request #1182
2f51969 Add iDunk's GPG key (iDunk5400)
2016-10-07 21:01:53 +02:00
Riccardo Spagni
b9c8c0db06 Merge pull request #1121
4e6d708 wallet: better implementation of sweep_unmixable (moneromooo-monero)
2016-10-07 21:01:16 +02:00
moneromooo-monero
9f31e2d8c0 wallet: do not announce pool txes as money spent/received (yet) 2016-10-07 19:52:05 +01:00
Riccardo Spagni
ea95b22009 Merge pull request #1120
2a0ad8b simplewallet: add mixin and payment id to sweep_all help (moneromooo-monero)
2016-10-07 20:07:31 +02:00
Ilya Kitaev
697ce1d435 libwallet_api: reverted deleted curly brace 2016-10-07 00:43:45 +03:00
Ilya Kitaev
a4390dae07 resolved conflict with 'develop' of https://github.com/mbg033/monero 2016-10-07 00:36:36 +03:00
Ilya Kitaev
62b3708ea5 libwallet_api: do not signal on sent/received tx until wallet completely
synchronized
2016-10-07 00:29:13 +03:00
Ilya Kitaev
11fab41c36 libwallet_api: TransactionHistory: read/write syncchronization 2016-10-06 23:25:43 +03:00
Ilya Kitaev
559f379327 libwallet_api: test: adjusted mixin_count=4 as it's minumum allowed 2016-10-06 16:35:03 +03:00
Ilya Kitaev
8b0cb8caa4 libwallet_api: some renamings 2016-10-06 15:47:29 +03:00
Ilya Kitaev
db3282cdf0 Initialize transaction history if empty 2016-10-06 15:47:29 +03:00
Ilya Kitaev
85f5e73d9c libwallet_api: fixes for transaction history 2016-10-06 15:47:29 +03:00
Ilya Kitaev
bb9094f1fe libwallet_api: fixes for transaction history 2016-10-04 23:11:19 +03:00
iDunk5400
2f5196937b Add iDunk's GPG key 2016-10-04 21:54:06 +02:00
moneromooo-monero
4e6d70808d wallet: better implementation of sweep_unmixable
This was still using the old transaction creation algorithm,
coupled with a deterministic output selection scheme, which
made it ill suited to the job, since it'd loop indefinitely
in case the fee increased between the test tx and adding the
fee.
2016-10-04 17:44:56 +01:00
moneromooo-monero
2a0ad8b2fe simplewallet: add mixin and payment id to sweep_all help 2016-10-04 17:44:30 +01:00
Riccardo Spagni
80c5de9fa0 Merge pull request #1180
79bb5a6 Fix build after spelling corrections in core_rpc_server (Jacob Brydolf)
2016-10-04 15:01:50 +02:00
Jacob Brydolf
79bb5a670a Fix build after spelling corrections in core_rpc_server 2016-10-04 13:55:55 +02:00
Riccardo Spagni
ae987907c6 Merge pull request #1179
714ee99 Fix description for locked_transfer (Oyvind Kvanes)
71538f3 Rename to lockblocks and add max value (Oyvind Kvanes)
68ac060 Fix locked_transfer (Oyvind Kvanes)
7d020bd Add locked_transfer (Oyvind Kvanes)
d5f918a Revert transfer_main in simplewallet (Oyvind Kvanes)
3451963 Add motifications to test out locked_transfer (Oyvind Kvanes)
e5e6d88 Add more information to transaction in wallet (Oyvind Kvanes)
9b8a062 Make a small test change (Oyvind Kvanes)
2016-10-04 12:18:55 +02:00
Riccardo Spagni
a8e03344e5 Merge pull request #1177
3644aa9 blockchain: avoid using a reference to a temporary (moneromooo-monero)
2016-10-04 12:17:28 +02:00
Riccardo Spagni
bd43d8add2 Merge pull request #1175
b673830 Add NanoAkron's GPG key (NanoAkron)
2016-10-04 12:17:05 +02:00
Riccardo Spagni
07c5907c32 Merge pull request #1174
a4044df add Jaquees GPG key (Jacob Brydolf)
2016-10-04 12:16:38 +02:00
Riccardo Spagni
2723cd12e1 Merge pull request #1173
65ea836 wallet2_api: added Wallet::daemonBlockChainTargetHeight() libwallet_api: Wallet::blockChainTargetHeight (Jacob Brydolf)
2016-10-04 12:15:02 +02:00
Riccardo Spagni
e72b6a7ade Merge pull request #1165
e57379a p2p: drop any existing connection to a banned IP (moneromooo-monero)
2016-10-04 12:14:41 +02:00
Riccardo Spagni
ab60c0503c Merge pull request #1164
179b1f4 daemon: implement missing print_bc and matching RPC (moneromooo-monero)
2016-10-04 12:14:12 +02:00
Riccardo Spagni
bfdac4b5ff Merge pull request #1160
80b4da3 wallet: wallet option to confirm transfers with no payment id (moneromooo-monero)
2016-10-04 12:11:32 +02:00
Riccardo Spagni
4cb1348548 Merge pull request #1139
01ec195 Update CMakeLists.txt (codehalo)
446ebbc Update CMakeLists.txt (codehalo)
bd773e7 Update CMakeLists.txt (codehalo)
3627cea Cleanup. Dropped "bit" from bitmonero. (Randi Joseph)
2a51396 Dropped "bit" from bitmonero. (Randi Joseph)
78b13d6 Cleanup. Dropped "bit" from bitmonero. (Randi Joseph)
1e6aedb Cleanup. Dropped "bit" from bitmonero. (Randi Joseph)
9e54616 Dropped "bit" from bitmonero. (Randi Joseph)
2016-10-04 12:11:03 +02: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
60e527f1c2 Merge pull request #1125
7b09e9f wallet: update min mixin for sweep_unmixable on v4 (moneromooo-monero)
2016-10-04 12:06:04 +02:00
Riccardo Spagni
895d20f901 Merge pull request #1123
0d036be blockchain: do not reject chain histories matching only genesis (moneromooo-monero)
2016-10-04 12:05:11 +02:00
Oyvind Kvanes
714ee99678 Fix description for locked_transfer 2016-10-04 11:46:44 +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
Riccardo Spagni
fa1d5efb5a Merge pull request #1168
10be903 Brackets to prevent premature return (NanoAkron)
fb1785a Brackets to ensure doesn't function prematurely return (NanoAkron)
8ed0d72 Moved logging to target functions rather than caller (NanoAkron)
442bfd1 Added messages at log level 2 to reflect deactivation procedure (NanoAkron)
2016-10-04 11:41:13 +02:00
Riccardo Spagni
1be1e4a47d Merge pull request #1167
2e20ca9 Update README.md (lethos3)
2016-10-04 11:40:34 +02:00
Riccardo Spagni
0f3c865a98 Merge pull request #1163
1eae905 Small typo in README.i18n (Jkat)
2016-10-04 11:40:18 +02:00
Riccardo Spagni
36d80b4475 Merge pull request #1162
e5f8642 Update minimum mixin in transfer_original help text (TedTheFicus)
ea45d61 Update minimum mixin in transfer_original help text (TedTheFicus)
2016-10-04 11:38:35 +02:00
Riccardo Spagni
db90a16f03 Merge pull request #1152
8b20cbf libwallet_api: do not use fast-refresh on recovery (Ilya Kitaev)
10fe626 libwallet_api: fast-refresh in case of opening non-synced wallet (Ilya Kitaev)
0019e31 libwallet_api: fix unhandled exception on address check (Ilya Kitaev)
1f73f80 libwallet_api: fast-refresh for new wallet (Ilya Kitaev)
4789347 libwallet_api: test for create/init wallet on mainnet (Ilya Kitaev)
2016-10-04 11:37:18 +02:00
Riccardo Spagni
298a0723e8 Merge pull request #1149
25be1d3 Noticed two spellings of the word 'response' in the codebase, one 'responce' and the other 'response'. (NanoAkron)
2016-10-04 11:34:53 +02:00
Riccardo Spagni
8a67e3c95e Merge pull request #1145
8438fb4 Improving daemon startup log message (NanoAkron)
2016-10-04 11:29:46 +02:00
Riccardo Spagni
2ef81914b5 Merge pull request #1140
bba6af9 wallet: cold wallet transaction signing (moneromooo-monero)
9872dcb wallet: fix log confusion between bytes and kilobytes (moneromooo-monero)
d9b0bf9 cryptonote_core: make extra field removal more generic (moneromooo-monero)
98f19d4 serialization: add support for serializing std::pair and std::list (moneromooo-monero)
2016-10-04 11:27:38 +02:00
Riccardo Spagni
2f683291f4 Merge pull request #1159
baa3e80 tests: fix build after addition of cryptonote_core::get_block_sync_size (moneromooo-monero)
2016-10-04 11:26:45 +02:00
Oyvind Kvanes
71538f3240 Rename to lockblocks and add max value 2016-10-04 11:13:26 +02:00
NanoAkron
10be9036da Brackets to prevent premature return 2016-10-04 01:13:04 +01:00
NanoAkron
fb1785ab94 Brackets to ensure doesn't function prematurely return 2016-10-04 01:10:12 +01:00
moneromooo-monero
3644aa94f3 blockchain: avoid using a reference to a temporary 2016-10-03 23:20:50 +01:00
NanoAkron
b67383055a Add NanoAkron's GPG key 2016-10-03 22:28:05 +01:00
NanoAkron
8ed0d72b12 Moved logging to target functions rather than caller 2016-10-03 22:11:00 +01:00
Jacob Brydolf
65ea8364f8 wallet2_api: added Wallet::daemonBlockChainTargetHeight()
libwallet_api: Wallet::blockChainTargetHeight

Signed-off-by: Jacob Brydolf <jacob@brydolf.net>
2016-10-03 20:47:41 +02:00
Jacob Brydolf
a4044df923 add Jaquees GPG key
Signed-off-by: Jacob Brydolf <jacob@brydolf.net>
2016-10-03 20:42:21 +02: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
lethos3
2e20ca9009 Update README.md
mnemonic wallets have 25 words.
2016-10-03 06:41:56 +09:00
moneromooo-monero
e57379a819 p2p: drop any existing connection to a banned IP 2016-10-02 19:23:35 +01:00
moneromooo-monero
179b1f43af daemon: implement missing print_bc and matching RPC 2016-10-02 10:21:21 +01:00
Jkat
1eae90512a Small typo in README.i18n 2016-10-01 23:52:41 -04:00
TedTheFicus
e5f8642f52 Update minimum mixin in transfer_original help text
Changed the wording from "from 0 to maximum available" to "from 2 to maximum available".

May I also suggest putting in a number rather than "maximum available" and also clarifying that mixin = 0 is still allowed if the user has unmixable outputs (dust), which he wants to "undust" using sweep_unmixable (comment from dEBRUYNE-1 ).
2016-10-01 12:59:55 -06:00
TedTheFicus
ea45d61f5d Update minimum mixin in transfer_original help text
Changed the wording from "from 0 to maximum available" to "from 2 to maximum available".

May I also suggest putting in a number rather than "maximum available" and also clarifying that mixin = 0 is still allowed if the user has unmixable outputs (dust), which he wants to "undust" using sweep_unmixable (comment from dEBRUYNE-1 ).
2016-10-01 12:55:54 -06:00
Ilya Kitaev
8b20cbfa7d libwallet_api: do not use fast-refresh on recovery 2016-10-01 21:04:49 +03:00
moneromooo-monero
80b4da3330 wallet: wallet option to confirm transfers with no payment id
set confirm-missing-payment-id 0|1

Defaults to true.
2016-10-01 17:03:53 +01:00
moneromooo-monero
baa3e80140 tests: fix build after addition of cryptonote_core::get_block_sync_size 2016-10-01 10:09:51 +01:00
Ilya Kitaev
10fe626e13 libwallet_api: fast-refresh in case of opening non-synced wallet 2016-09-30 22:42:15 +03:00
Ilya Kitaev
0019e3106b libwallet_api: fix unhandled exception on address check 2016-09-30 21:43:57 +03:00
Ilya Kitaev
1f73f80c94 libwallet_api: fast-refresh for new wallet 2016-09-30 02:11:28 +03:00
Riccardo Spagni
8f94fcf6a3 Merge pull request #1124
8b4e7c6 daemon: report status at 99.9% rather than 100% when not quite synced (moneromooo-monero)
2016-09-29 22:17:51 +02:00
Riccardo Spagni
63321bbbae Merge pull request #1127
1325842 This file is for rlwrap for monero 0.10 (zveda)
8d4674b This file is for rlwrap for monero 0.10 (zveda)
2016-09-29 22:16:52 +02:00
Riccardo Spagni
995dde4f95 Merge pull request #1128
d2e11f3 db_lmdb: do not error if dropping a non existent hard fork table (moneromooo-monero)
2016-09-29 22:16:15 +02:00
Riccardo Spagni
af831bed5c Merge pull request #1129
5e3e362 core: make the sync chunk block count overridable (moneromooo-monero)
2016-09-29 22:15:21 +02:00
Riccardo Spagni
f195a447cc Merge pull request #1136
2dacb19 wallet2: wallet2::get_daemon_blockchain_height() clean error message on success (Ilya Kitaev)
25e5efc libwallet_api: Wallet::setAutoRefreshInterval sanity check (Ilya Kitaev)
a668820 libwallet_api: explicitly return 0 in Wallet::daemonBlockChainHeight() on error (Ilya Kitaev)
aef92f2 libwallet_api: tests: fixed WalletCallbackReceived test (Ilya Kitaev)
15c0882 libwallet_api: tests: test fixed according implementation (Ilya Kitaev)
a7882da libwallet_api: tests: compilation errors fixed (Ilya Kitaev)
cda4cb9 formatting: 2-spaces indentation (Ilya Kitaev)
545a48f formatting: 2-spaces indentation (Ilya Kitaev)
3079c57 wallet2_api: milliseconds resolution for auto-refresh interval (Ilya Kitaev)
7b4a85b wallet2_api: added Wallet::daemonBlockChainHeight() (Ilya Kitaev)
9de3ec3 libwallet_api: Wallet::blockChainHeight, WalletListener::newBlock (Ilya Kitaev)
2016-09-29 22:13:49 +02:00
Riccardo Spagni
0b9888a4ee Merge pull request #1137
5360316 removed deprecated update-core (Adriaan Joubert)
2016-09-29 22:10:18 +02:00
Riccardo Spagni
1b23f1b224 Merge pull request #1141
7d7f684 add luigi1111's gpg key (luigi1111)
2016-09-29 22:06:56 +02:00
NanoAkron
25be1d3ed4 Noticed two spellings of the word 'response' in the codebase, one 'responce' and the other 'response'.
Fixed to the standard spelling 'response'. This may fix some functionality - some calls had mixed spellings.
2016-09-29 14:38:12 +01:00
Oyvind Kvanes
68ac0607da Fix locked_transfer 2016-09-28 16:44:43 +02:00
Oyvind Kvanes
7d020bde5e Add locked_transfer 2016-09-28 16:27:45 +02:00
Oyvind Kvanes
d5f918a0b1 Revert transfer_main in simplewallet 2016-09-28 15:20:37 +02:00
Oyvind Kvanes
3451963855 Add motifications to test out locked_transfer 2016-09-28 14:58:14 +02:00
Oyvind Kvanes
e5e6d88655 Add more information to transaction in wallet 2016-09-28 13:04:26 +02:00
Oyvind Kvanes
9b8a06203b Make a small test change 2016-09-28 11:01:20 +02:00
NanoAkron
8438fb4ae3 Improving daemon startup log message 2016-09-28 01:47:45 +01:00
Ilya Kitaev
4789347b27 libwallet_api: test for create/init wallet on mainnet 2016-09-28 01:36:49 +03:00
Ilya Kitaev
2dacb193d0 wallet2: wallet2::get_daemon_blockchain_height() clean error message on
success
2016-09-28 00:39:06 +03:00
Ilya Kitaev
25e5efc238 libwallet_api: Wallet::setAutoRefreshInterval sanity check 2016-09-28 00:35:10 +03:00
Ilya Kitaev
a6688200fb libwallet_api: explicitly return 0 in Wallet::daemonBlockChainHeight()
on error
2016-09-28 00:31:21 +03:00
Ilya Kitaev
aef92f27d9 libwallet_api: tests: fixed WalletCallbackReceived test 2016-09-28 00:02:35 +03:00
Ilya Kitaev
15c0882f4e libwallet_api: tests: test fixed according implementation 2016-09-27 23:47:50 +03:00
Ilya Kitaev
a7882da2f6 libwallet_api: tests: compilation errors fixed 2016-09-27 23:45:03 +03:00
moneromooo-monero
bba6af9064 wallet: cold wallet transaction signing
This change adds the ability to create a new unsigned transaction
from a watch only wallet, and save it to a file. This file can
then be moved to another computer/VM where a cold wallet may load
it, sign it, and save it. That cold wallet does not need to have
a blockchain nor daemon. The signed transaction file can then be
moved back to the watch only wallet, which can load it and send
it to the daemon.

Two new simplewallet commands to use it:
sign_transfer (on the cold wallet)
submit_transfer (on the watch only wallet)

The transfer command used on a watch only wallet now writes an
unsigned transaction set in a file called 'unsigned_monero_tx'
instead of submitting the tx to the daemon as a normal wallet does.
The signed tx file is called 'signed_monero_tx'.
2016-09-27 07:46:39 +01:00
codehalo
01ec1959c3 Update CMakeLists.txt 2016-09-27 02:11:23 -04:00
codehalo
446ebbcd7b Update CMakeLists.txt 2016-09-27 02:11:04 -04:00
codehalo
bd773e7805 Update CMakeLists.txt 2016-09-27 02:10:30 -04:00
luigi1111
7d7f684c9f add luigi1111's gpg key 2016-09-26 18:37:56 -05:00
moneromooo-monero
9872dcbbe3 wallet: fix log confusion between bytes and kilobytes 2016-09-26 23:12:43 +01:00
moneromooo-monero
d9b0bf9f35 cryptonote_core: make extra field removal more generic 2016-09-26 23:12:38 +01:00
moneromooo-monero
98f19d40aa serialization: add support for serializing std::pair and std::list 2016-09-26 23:12:28 +01:00
Randi Joseph
cfd71e6bde Cleanup. Dropped "bit" from bitmonero. 2016-09-26 17:47:57 -04:00
Randi Joseph
78b13d6dac Cleanup. Dropped "bit" from bitmonero. 2016-09-26 17:35:10 -04:00
Randi Joseph
1e6aedba8b Cleanup. Dropped "bit" from bitmonero. 2016-09-26 17:22:30 -04:00
Randi Joseph
9e54616924 Dropped "bit" from bitmonero. 2016-09-26 17:22:30 -04:00
Adriaan Joubert
53603163bd removed deprecated update-core
Functionality handled by pacman
2016-09-26 23:01:51 +02:00
Randi Joseph
3627cea34a Cleanup. Dropped "bit" from bitmonero. 2016-09-26 16:47:07 -04:00
Ilya Kitaev
cda4cb969a formatting: 2-spaces indentation 2016-09-26 23:46:07 +03:00
Ilya Kitaev
545a48f098 formatting: 2-spaces indentation 2016-09-26 23:29:53 +03:00
Ilya Kitaev
3079c5756b wallet2_api: milliseconds resolution for auto-refresh interval 2016-09-26 23:19:25 +03:00
Ilya Kitaev
7b4a85b309 wallet2_api: added Wallet::daemonBlockChainHeight() 2016-09-26 23:19:25 +03:00
Ilya Kitaev
9de3ec3e2a libwallet_api: Wallet::blockChainHeight, WalletListener::newBlock 2016-09-26 23:19:25 +03:00
Riccardo Spagni
e01a9ea507 Merge pull request #1117
fc855c1 Made error message consistent with other, more helpful, message (Will Skinner)
2016-09-26 17:34:26 +02:00
Riccardo Spagni
cf74a137f3 Merge pull request #1116
2e18e10 libwallet_api: simple documentation on testing environment (Ilya Kitaev)
69c9824 libwallet_api: tests: env variables for WALLETS_ROOT_DIR and TESTNET_DAEMON_ADDRESS (Ilya Kitaev)
1f8a70c libwallet_api: tests: changed testwallets path, uncommitted all tests (Ilya Kitaev)
d5d0856 wallet2_api: getter and setter for "refresh interval" (Ilya Kitaev)
cdb6c96 wallet2_api: fixed deadlock while closing wallet (Ilya Kitaev)
2016-09-26 17:34:06 +02:00
Riccardo Spagni
90f818b646 Merge pull request #1113
12427dd Fix minor typo in "need resize" message. (Myagui)
2016-09-26 17:33:08 +02:00
Riccardo Spagni
2025e8241c Merge pull request #1105
344e96c remove check for certain clang versions (Dan Miller)
b73bed2 Don't define stdc++ on FreeBSD (Dan Miller)
2016-09-26 17:32:14 +02:00
Riccardo Spagni
5a9fa3736b Merge pull request #1104
7f009bb Remove redundant "default" in set mixin help desc (J Ryan Littlefield)
2016-09-26 17:31:52 +02:00
Riccardo Spagni
179d89f111 Merge pull request #1103
b8fb9d1 Fix test for 'ARM_ID' as caught by @radfish in #1088 (NanoAkron)
2016-09-26 17:31:27 +02:00
Randi Joseph
2a5139644a Dropped "bit" from bitmonero. 2016-09-26 10:42:29 -04: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
moneromooo-monero
d2e11f374a db_lmdb: do not error if dropping a non existent hard fork table 2016-09-24 16:15:50 +01:00
zveda
13258422ba This file is for rlwrap for monero 0.10 2016-09-25 00:45:01 +10:00
zveda
8d4674bd85 This file is for rlwrap for monero 0.10 2016-09-25 00:41:45 +10:00
moneromooo-monero
7b09e9ff77 wallet: update min mixin for sweep_unmixable on v4 2016-09-24 14:48:34 +01:00
moneromooo-monero
8b4e7c6c9c daemon: report status at 99.9% rather than 100% when not quite synced
Less confusing for users.
2016-09-24 11:45:19 +01:00
moneromooo-monero
0d036bec26 blockchain: do not reject chain histories matching only genesis
This is fine if our local chain is so small that it is entirely
contained within the last jump in the peer's short chain history.
2016-09-24 11:19:00 +01:00
Ilya Kitaev
2e18e10beb libwallet_api: simple documentation on testing environment 2016-09-23 23:35:57 +03:00
Will Skinner
fc855c1a21 Made error message consistent with other, more helpful, message 2016-09-22 21:06:39 -07:00
Ilya Kitaev
69c9824fc0 libwallet_api: tests: env variables for WALLETS_ROOT_DIR and
TESTNET_DAEMON_ADDRESS
2016-09-22 20:32:57 +03:00
Ilya Kitaev
1f8a70c03a libwallet_api: tests: changed testwallets path, uncommitted all tests 2016-09-22 19:07:12 +03:00
Myagui
12427dd8d3 Fix minor typo in "need resize" message.
Message observed while synchronizing a node from scratch.
"LMDB memory map needs resized"
Proposing a change to:
"LMDB memory map needs to be resized"
2016-09-21 20:40:07 +01:00
Dan Miller
344e96cc08 remove check for certain clang versions 2016-09-21 06:42:21 -07:00
Ilya Kitaev
d5d0856ce6 wallet2_api: getter and setter for "refresh interval" 2016-09-20 20:40:58 +03:00
Ilya Kitaev
cdb6c96f89 wallet2_api: fixed deadlock while closing wallet 2016-09-20 20:08:33 +03:00
Dan Miller
b73bed2992 Don't define stdc++ on FreeBSD 2016-09-19 16:19:54 -07:00
J Ryan Littlefield
7f009bb7e2 Remove redundant "default" in set mixin help desc 2016-09-19 16:09:31 -06:00
NanoAkron
b8fb9d1919 Fix test for 'ARM_ID' as caught by @radfish in #1088 2016-09-18 22:56:38 +01:00
Riccardo Spagni
53e18cafdf Merge pull request #1102
eeb2bbc epee: optionally restrict HTTP service to a configurable user agent (moneromooo-monero)
2016-09-18 21:38:46 +02:00
Riccardo Spagni
5866d91b82 Merge pull request #1101
56ff099 fixed tag detector (Riccardo Spagni)
2016-09-18 21:38:21 +02:00
moneromooo-monero
eeb2bbc0fc epee: optionally restrict HTTP service to a configurable user agent
This is intended to catch traffic coming from a web browser,
so we avoid issues with a web page sending a transfer RPC to
the wallet. Requiring a particular user agent can act as a
simple password scheme, while we wait for 0MQ and proper
authentication to be merged.
2016-09-18 20:32:02 +01:00
Riccardo Spagni
56ff099956 fixed tag detector 2016-09-18 21:21:13 +02:00
Riccardo Spagni
68e6678ab7 Merge pull request #1099
c2faab5 fix v5 height (Riccardo Spagni)
70bd7d8 remove dead backup seed nodes, add new ones (Riccardo Spagni)
cebbcf0 fix v5 fork date description (Riccardo Spagni)
eb60fa2 update version (Riccardo Spagni)
c41098a updated fork heights for v4 and v5 (Riccardo Spagni)
c69b8a1 update block headers (Riccardo Spagni)
f148af2 add checkpoints (Riccardo Spagni)
c15da0e switch wallet API from std thread/mutex to boost (Riccardo Spagni)
8a274ea switch wallet API from std thread/mutex to boost (Riccardo Spagni)
2016-09-18 20:26:39 +02:00
Riccardo Spagni
f00c2dc1ec Merge branch 'NanoAkron-armv8-march-crypto' 2016-09-18 20:24:32 +02:00
Riccardo Spagni
da6f7d99f8 fix conflict 2016-09-18 20:22:43 +02:00
Riccardo Spagni
952030831b Merge pull request #1100
d0fa9e7 gpg_keys: update my keys' expiration dates (moneromooo-monero)
2016-09-18 20:20:39 +02:00
moneromooo-monero
d0fa9e74fb gpg_keys: update my keys' expiration dates 2016-09-18 19:17:47 +01:00
Riccardo Spagni
c2faab5e1a fix v5 height 2016-09-18 20:13:47 +02:00
Riccardo Spagni
70bd7d8871 remove dead backup seed nodes, add new ones 2016-09-18 20:10:46 +02:00
Riccardo Spagni
cebbcf0f64 fix v5 fork date description 2016-09-18 19:35:36 +02:00
Riccardo Spagni
eb60fa2cff update version 2016-09-18 19:20:29 +02:00
Riccardo Spagni
c41098aacf updated fork heights for v4 and v5 2016-09-18 19:18:16 +02:00
Riccardo Spagni
c69b8a188b update block headers 2016-09-18 19:05:47 +02:00
Riccardo Spagni
f148af235a add checkpoints 2016-09-18 18:40:43 +02:00
Riccardo Spagni
6b744c349f Merge pull request #1098
1dd5b0b wallet: keep change dest separate from other dests (moneromooo-monero)
2016-09-18 17:42:32 +02:00
Riccardo Spagni
a6914c140c Merge pull request #1097
5f5d727 wallet: fix empty tx in corner case sending nothing (moneromooo-monero)
2016-09-18 17:42:10 +02:00
Riccardo Spagni
85220103e8 Merge pull request #1096
c2491b9 README: make TORSOCKS_ALLOW_INBOUND optional (moneromooo-monero)
2016-09-18 17:41:47 +02:00
Riccardo Spagni
0a0e801f49 Merge branch 'master' of https://github.com/fluffypony/monero 2016-09-18 17:37:56 +02:00
Riccardo Spagni
8a274eab3f switch wallet API from std thread/mutex to boost 2016-09-18 17:37:47 +02:00
Riccardo Spagni
c15da0e708 switch wallet API from std thread/mutex to boost 2016-09-18 17:36:40 +02:00
moneromooo-monero
1dd5b0b7df wallet: keep change dest separate from other dests
This fixes misreporting of amount/fee in rct txes, as the rct
tx construction code was lumping all dests (whether change or
not) in the same dests vector, while the pre-rct code was
keeping it separate.
2016-09-18 12:04:23 +01:00
Riccardo Spagni
c45595a02e Merge pull request #1095
f06882f README: mention --max-concurrency 1 for Mac (moneromooo-monero)
2016-09-18 11:45:35 +02:00
moneromooo-monero
5f5d7279b6 wallet: fix empty tx in corner case sending nothing 2016-09-18 10:44:32 +01:00
Riccardo Spagni
4a03a8a1da Merge pull request #1094
06bb692 cmake: support BUILD_SHARED_LIBS built-in option (redfish)
e1c7af3 cmake: transitive deps and remove deprecated LINK_* (redfish)
54010b9 crypto: armv7: slow-hash: remove redundant source include (redfish)
2016-09-18 11:44:08 +02:00
Riccardo Spagni
14f88f6b98 Merge pull request #1093
e86c5b9 miner: do not try to save config if the path isn't set (moneromooo-monero)
2016-09-18 11:40:52 +02:00
Riccardo Spagni
788b23d13c Merge pull request #1092
98b8043 readme: deps: fix libunwind Debian/Ubuntu package name (redfish)
2016-09-18 11:40:08 +02:00
Riccardo Spagni
35cdbe2eb2 Merge pull request #1089
368485d simplewallet: do not expose the details of tx splitting to the user (moneromooo-monero)
2016-09-18 11:36:30 +02:00
Riccardo Spagni
1db3be3e90 Merge pull request #1086
c791040 cmake: quotes around ARCH_ID string (redfish)
2016-09-18 11:36:05 +02:00
moneromooo-monero
c2491b91c0 README: make TORSOCKS_ALLOW_INBOUND optional 2016-09-18 10:34:45 +01:00
Riccardo Spagni
2c57885225 Merge pull request #1085
9250863 simplewallet: fix wrong amount in show_transfers for pending transactions (moneromooo-monero)
2016-09-18 11:32:59 +02:00
moneromooo-monero
f06882f1bc README: mention --max-concurrency 1 for Mac 2016-09-18 10:23:02 +01:00
moneromooo-monero
e86c5b9b53 miner: do not try to save config if the path isn't set
This saves on an exception dump when trying to write to /
after finding a block.
2016-09-18 09:57:42 +01:00
redfish
06bb6923c3 cmake: support BUILD_SHARED_LIBS built-in option
Support building internal libraries as shared. This reduces
development time by eliminating the need to re-link all
binaries every time non-interface code in the library changes.
Instead, can hack on libxyz, then `make libxyz`, and re-run
monerod.

By default BUILD_SHARED_LIBS is OFF in release build type,
and ON in debug build type, but can be overriden with -D.
2016-09-18 02:56:26 -04:00
redfish
e1c7af35d4 cmake: transitive deps and remove deprecated LINK_*
Keep the immediate direct deps at the library that depends on them,
declare deps as PUBLIC so that targets that link against that library
get the library's deps as transitive deps.

Break dep cycle between blockchain_db <-> crytonote_core.
No code refactoring, just hide cycle from cmake so that
it doesn't complain (cycles are allowed only between
static libs, not shared libs).

This is in preparation for supproting BUILD_SHARED_LIBS cmake
built-in option for building internal libs as shared.
2016-09-18 02:56:26 -04:00
redfish
54010b97b4 crypto: armv7: slow-hash: remove redundant source include
aesb.c is already present in libcrypto as a standalone object.
Tested: builds and runs fine on armv7, static and dynamic.
2016-09-18 02:56:26 -04:00
redfish
98b8043f4c readme: deps: fix libunwind Debian/Ubuntu package name 2016-09-18 02:50:09 -04:00
NanoAkron
7f00a4abf4 +crypto for ARMv8 now tests and modifies ${ARCH$ 2016-09-18 03:26:18 +01:00
NanoAkron
fd82635396 Updated +crypto option for ARMv8 to modify ${ARCH} instead 2016-09-18 03:23:15 +01:00
moneromooo-monero
368485d518 simplewallet: do not expose the details of tx splitting to the user
They're confusing, as people think it reports their balance.
2016-09-17 22:23:03 +01:00
NanoAkron
d76aec6121 Add +crypto flag for ARMv8-a 2016-09-17 22:13:39 +01:00
redfish
c79104086c cmake: quotes around ARCH_ID string
It's only blank only if somebody running cmake in MSYS/MinGW (Windows)
manually forgets to add -D ARCH, but when it is blank, without quotes
those lines are invalid cmake syntax.
2016-09-17 15:36:15 -04:00
moneromooo-monero
925086346a simplewallet: fix wrong amount in show_transfers for pending transactions
Change was not taken into consideration
2016-09-17 17:18:24 +01:00
Riccardo Spagni
77224bbf48 Merge pull request #1084
5850122 remove errant target_link_libraries (Riccardo Spagni)
58abc09 don't build any miniupnpc executables (Riccardo Spagni)
114e368 don't build miniupnpc test executables (Riccardo Spagni)
bb69371 updated miniupnp (Riccardo Spagni)
f62ebc5 update rapidjson (Riccardo Spagni)
2016-09-17 17:39:06 +02:00
Riccardo Spagni
198de8e3ec Merge pull request #1083
297e583 README: mention rlwrap pitfall when inputting seed and private keys (moneromooo-monero)
2016-09-17 17:01:18 +02:00
moneromooo-monero
297e5836ca README: mention rlwrap pitfall when inputting seed and private keys 2016-09-17 15:55:27 +01:00
Riccardo Spagni
58501229e3 remove errant target_link_libraries 2016-09-17 10:47:50 +02:00
Riccardo Spagni
58abc096f4 don't build any miniupnpc executables 2016-09-17 10:42:35 +02:00
Riccardo Spagni
114e36888b don't build miniupnpc test executables 2016-09-17 10:37:48 +02:00
Riccardo Spagni
bb69371f66 updated miniupnp 2016-09-17 10:11:02 +02:00
Riccardo Spagni
f62ebc5c81 update rapidjson 2016-09-17 09:35:49 +02:00
Riccardo Spagni
2846d0850d Merge pull request #1081
aa9a645 cmake: remove redundant checks around CMAKE_{AR,RANLIB} (redfish)
2016-09-17 07:49:03 +02:00
Riccardo Spagni
a1e6fb8243 Merge pull request #1080
423776f daemon: log version when starting (moneromooo-monero)
2016-09-17 07:48:46 +02:00
Riccardo Spagni
0edcbf6716 Merge pull request #1079
9c7b0cb wallet: change priority/fee to ArticMine's recommendation (moneromooo-monero)
2016-09-17 07:48:22 +02:00
redfish
aa9a64556d cmake: remove redundant checks around CMAKE_{AR,RANLIB}
Those are always set, no point in checking. #1065
2016-09-17 00:04:08 -04:00
moneromooo-monero
423776f9b1 daemon: log version when starting
Helps with investigating bug reports
2016-09-16 20:47:52 +01:00
moneromooo-monero
9c7b0cb28e wallet: change priority/fee to ArticMine's recommendation
We keep 1, 2, 3 multipliers till the fee decrase from 0.01/kB
to 0.002/kB, where we start using 1, 20, 166 multipliers.
This ensures the higher multiplier will compensate for the
block reward penalty when pushing past 100% of the past median.

The fee-multiplier wallet setting is now rename to priority,
since it keeps its [0..3] range, but maps to different multiplier
values.
2016-09-16 11:50:52 +01:00
Riccardo Spagni
e06530e2d9 Merge pull request #1077
69b5918 Add ARMv8-A AES support (Howard Chu)
2016-09-16 08:42:59 +02:00
Riccardo Spagni
c2f15e966c Merge pull request #1076
e29e8b1 compile errors fixed when PER_BLOCK_CHECKPOINT not defined (rckngOpossum)
e49c161 compile errors fixed when DEBUG_CREATE_BLOCK_TEMPLATE defined (rckngOpossum)
2016-09-16 08:42:26 +02:00
Howard Chu
69b59186f3 Add ARMv8-A AES support
More than twice as fast as plain C code. Note that both ARMv7 and
ARMv8 can be further improved with better use of NEON.

Also tweak ARMv7 multiplier
2016-09-16 01:45:49 +01:00
rckngOpossum
e29e8b1b99 compile errors fixed when PER_BLOCK_CHECKPOINT not defined 2016-09-15 15:55:07 -05:00
rckngOpossum
e49c161987 compile errors fixed when DEBUG_CREATE_BLOCK_TEMPLATE defined 2016-09-15 15:36:16 -05:00
Riccardo Spagni
7c899ec33a Merge pull request #1074
cd01bae Decrease minimum fee from 0.01/kB to 0.002/kB (moneromooo-monero)
2016-09-15 15:23:49 +02:00
Riccardo Spagni
efc9f8ff4a Merge pull request #1072
bb9ed3e Fix homebrew formula for OS X (Mike C)
2016-09-15 15:22:46 +02:00
Riccardo Spagni
d4a533a800 Merge pull request #1068
a5af33d Add libminiupnpc and libunwind to snap. (Casey Marshall)
823843e Fix portability issues discovered with fresh snap install. (Casey Marshall)
0a56d83 Add snap packaging. (Casey Marshall)
2016-09-15 15:20:38 +02:00
Riccardo Spagni
ce53674520 Merge pull request #1067
70b78bb wallet: fix misdetection of duplicates (moneromooo-monero)
7d413f6 rct: rework serialization to avoid storing vector sizes (moneromooo-monero)
0ce79ef core: cleanup some typecasting (moneromooo-monero)
2016-09-15 15:19:54 +02:00
Riccardo Spagni
1d6cb94c9b Merge pull request #1066
f138138 Daemon: fix hashrate display in diff command output (iDunk5400)
2016-09-15 15:19:01 +02:00
Riccardo Spagni
23d99930b8 Merge pull request #1065
1855213 Attempt to fix broken compilation on some systems caused by #1074 (iDunk5400)
2016-09-15 15:18:21 +02:00
moneromooo-monero
cd01bae735 Decrease minimum fee from 0.01/kB to 0.002/kB
The wallet will start using that fee about two weeks after hard
fork 3, when most people will likely have updated their daemons.
2016-09-15 09:28:33 +01:00
Mike C
bb9ed3e806 Fix homebrew formula for OS X
bitmonero --> monero
2016-09-14 13:40:36 -06:00
moneromooo-monero
70b78bb2c8 wallet: fix misdetection of duplicates 2016-09-14 20:23:28 +01:00
moneromooo-monero
7d413f635f rct: rework serialization to avoid storing vector sizes 2016-09-14 20:23:06 +01:00
moneromooo-monero
0ce79ef10e core: cleanup some typecasting 2016-09-14 20:22:16 +01:00
Casey Marshall
a5af33d33b Add libminiupnpc and libunwind to snap. 2016-09-11 21:54:43 -05:00
Casey Marshall
823843eadb Fix portability issues discovered with fresh snap install.
ARCH=native fixes SIGILL issues on other amd64 processors.
Static library dependencies where supported.
Package libunbound2 in the snap.
2016-09-11 18:14:38 -05:00
Casey Marshall
0a56d83d3d Add snap packaging.
This adds [snap](https://snapcraft.io) packaging to the project. See the
link for more information on snaps. Snap packages install on all Linux
distributions. On Ubuntu, snap confinement with apparmor and seccomp
provide an additional layer of security.

This snap sets up monerod as a systemd service, which should start
immediately on install. To access the wallet CLI, simply run `monero`
(/snap/bin/monero). I think it's a really quick & easy way to get
started with monero.

I've made some opinionated decisions in the packaging just to kick this
off, but I'm happy to iterate on this stuff.
2016-09-11 11:17:12 -05:00
iDunk5400
f1381388ec Daemon: fix hashrate display in diff command output 2016-09-10 23:16:25 +02:00
iDunk5400
1855213c8f Attempt to fix broken compilation on some systems caused by #1074 2016-09-10 22:56:40 +02:00
Riccardo Spagni
0fde289e2f Merge pull request #1053
13c5dc6 Update README.md (jw)
44f1191 Update README.md (jw)
f4ffe7f Update MSYS2 build instructions. (jw)
2016-09-10 15:18:34 +02:00
Riccardo Spagni
baa6d9afbc Merge pull request #1050
f5d03bb tests: block reward: disable 64-bit-only tests on 32-bit systems (redfish)
2016-09-10 15:14:12 +02:00
Riccardo Spagni
391d6d0cf8 Merge pull request #1049
24d9337 crypto,cmake: enable ASM mul impl on ARM; add cmake opt (redfish)
2016-09-10 15:13:33 +02:00
Riccardo Spagni
5c8c1d1968 Merge pull request #1048
533eafa readme: make section on docs more concise (redfish)
2016-09-10 15:11:44 +02:00
Riccardo Spagni
1d0578f8d3 Merge pull request #1047
0f94f61 cmake: handle dists which prefix gcc binaries wth arch triplet (redfish)
2016-09-10 15:11:16 +02:00
Riccardo Spagni
94df1f4d84 Merge pull request #1044
b1d5189 cmake: fix def propagation, fixes 32-bit build (redfish)
2016-09-10 15:10:43 +02:00
Riccardo Spagni
7bebbbe5fe Merge pull request #1040
77fa663 cmake: split BUILD_GUI_DEPS option into two (redfish)
2016-09-10 15:10:08 +02:00
jw
13c5dc6839 Update README.md 2016-09-05 07:58:45 -07:00
jw
44f1191ee4 Update README.md 2016-09-05 07:55:30 -07:00
jw
f4ffe7f30c Update MSYS2 build instructions.
Describe process for building on Windows using current version of MSYS2.
2016-09-05 07:54:25 -07:00
redfish
f5d03bb22d tests: block reward: disable 64-bit-only tests on 32-bit systems
Issue #1008
2016-09-04 03:36:10 -04:00
redfish
24d93370ad crypto,cmake: enable ASM mul impl on ARM; add cmake opt
This was disabled earlier as part of diagnosing failing tests
on ARM, which turned out to be due to aliasing, fixed by
adding -fno-strict-aliasing. So, re-enabling it back.
2016-09-04 06:46:35 +00:00
redfish
533eafa90e readme: make section on docs more concise 2016-09-03 22:03:27 -04:00
redfish
b1d5189ae1 cmake: fix def propagation, fixes 32-bit build
32-bit build would fail to link with 'mdb_env_create undefined' (because
for 32-bit build, mdb_env_create_vl32 is defined instead).

This bug was introduced with the recent change to virtual object
libraries. The problem is that the COMPILE_DEFINITIONS property
was not propagated from dependee target (lmdb) to depedent
target's (blockchain_db) virtual object lib (obj_blockchain_db).
This patch makes that happen.

I chose to include INTERFACE_COMPILE_DEFINITIONS because there
should not be a need to propagate private defs, but it doesn't
make a difference in this case.
2016-09-03 17:44:28 -04:00
Riccardo Spagni
afe3cce7fe Merge pull request #1041
011e42f fix nigglies, as pointed out by moneromooo-monero (Riccardo Spagni)
df63e07 fix remaining bitmonero and simplewallet bits (Riccardo Spagni)
04b120f fix blockchain utilities readme (Riccardo Spagni)
f1d4e4a readme fixes, small Docker fix (Riccardo Spagni)
9a525e0 rename systemd bits to monero (Riccardo Spagni)
011c94c change CMake project name (Riccardo Spagni)
50dc4fb update Dockerfile bitmonero refs (Riccardo Spagni)
2016-09-03 23:06:05 +02: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
Riccardo Spagni
04b120fb39 fix blockchain utilities readme 2016-09-03 21:54:10 +02:00
Riccardo Spagni
f1d4e4a3f2 readme fixes, small Docker fix 2016-09-03 21:47:00 +02:00
Riccardo Spagni
9a525e0d20 rename systemd bits to monero 2016-09-03 21:44:00 +02:00
Riccardo Spagni
011c94c622 change CMake project name 2016-09-03 21:38:20 +02:00
Riccardo Spagni
50dc4fbd26 update Dockerfile bitmonero refs 2016-09-03 21:33:47 +02:00
Riccardo Spagni
c45912e1df Merge pull request #1039
883d651 remove blockchain_dump (Riccardo Spagni)
7825386 fix leftover add_directory (Riccardo Spagni)
face573 rename simplewallet (Riccardo Spagni)
2e984bc rename Monero daemon (Riccardo Spagni)
b6973b8 rename blockchain utils (Riccardo Spagni)
f968ccb remove cn_deserialize (Riccardo Spagni)
7a38e4e removed simpleminer (Riccardo Spagni)
2016-09-03 19:59:41 +02:00
redfish
77fa663e94 cmake: split BUILD_GUI_DEPS option into two
The split is to make this software more packageable. 'make install'
is used by the package building scripts, and should not be installing
vendored dependencies onto the system.
2016-09-03 12:55:20 -04:00
Riccardo Spagni
aa996e3a60 Merge pull request #1038
43677f9 gui/libwallet_merged: libunbound is one more dependency (Ilya Kitaev)
2016-09-03 14:11:26 +02:00
Riccardo Spagni
883d651c3b remove blockchain_dump 2016-09-03 14:07:17 +02:00
Riccardo Spagni
7825386468 fix leftover add_directory 2016-09-03 13:51:07 +02:00
Riccardo Spagni
face57309b rename simplewallet 2016-09-03 13:48:38 +02:00
Riccardo Spagni
2e984bc23c rename Monero daemon 2016-09-03 13:46:41 +02:00
Riccardo Spagni
b6973b8053 rename blockchain utils 2016-09-03 13:45:18 +02:00
Riccardo Spagni
f968ccb9d3 remove cn_deserialize 2016-09-03 13:20:53 +02:00
Riccardo Spagni
7a38e4e65d removed simpleminer 2016-09-03 13:20:00 +02:00
Ilya Kitaev
43677f9d68 gui/libwallet_merged: libunbound is one more dependency 2016-09-03 13:32:06 +03:00
Riccardo Spagni
04906e67ba Merge pull request #1034
98d223a confirming PR #1033 was correct in spite of the lack of signature, will fix this issue going forward (Riccardo Spagni)
2016-09-01 23:29:57 +02:00
Riccardo Spagni
98d223a694 confirming PR #1033 was correct in spite of the lack of signature, will fix this issue going forward 2016-09-01 23:29:01 +02:00
Riccardo Spagni
6c608c352c Merge pull request #1033
4d17949 wallet_merged: ringct added to dependencies (Ilya Kitaev)
2016-09-01 23:00:21 +02:00
Riccardo Spagni
05418fdaf9 Merge pull request #1032
34bb789 Re-add s to rangesigs (luigi1111)
dbf017a Fix some rct tx size calculations (luigi1111)
2016-09-01 22:59:10 +02:00
Ilya Kitaev
4d17949d4f wallet_merged: ringct added to dependencies 2016-09-01 23:06:36 +03:00
luigi1111
34bb78956f Re-add s to rangesigs
Whoops.
2016-09-01 13:53:53 -05:00
luigi1111
dbf017a5f7 Fix some rct tx size calculations
Some variance is still expected
2016-09-01 13:14:31 -05:00
Riccardo Spagni
9c709bec19 Merge pull request #1031
0d7ce00 epee: do not try network resolution if loopback worked (moneromooo-monero)
2016-09-01 20:02:31 +02:00
Riccardo Spagni
59b7f51766 Merge pull request #1010
3398515 cmake: exclude tests from running (redfish)
e374ae7 cmake: option+target for profiling for coverage (redfish)
2016-09-01 20:01:16 +02:00
moneromooo-monero
0d7ce00793 epee: do not try network resolution if loopback worked
Fixes the wallet being unable to connect to the daemon
when there is no NIC.
2016-09-01 18:12:39 +01:00
redfish
3398515dd4 cmake: exclude tests from running
Minimize special cases in cmake script, likely to be forgotten.
2016-09-01 11:17:44 -04:00
Riccardo Spagni
c09daf2d40 Merge pull request #1029
f1d87c8 simplewallet: add magic and public keys to key image export file (moneromooo-monero)
f4e894a simplewallet: make the key image export format binary (moneromooo-monero)
2016-09-01 17:11:49 +02:00
Riccardo Spagni
fb2dd1eddf Merge pull request #1015
fbfdf59 readme: organize deps into table (redfish)
2016-09-01 17:10:50 +02:00
Riccardo Spagni
14198f3620 Merge pull request #1030
214240c confirming PR #1028 merge was accidentally unsigned, but correct (Riccardo Spagni)
2016-09-01 17:09:42 +02:00
Riccardo Spagni
214240c597 confirming PR #1028 merge was accidentally unsigned, but correct 2016-09-01 17:08:55 +02:00
Riccardo Spagni
ac5f29e463 Merge pull request #1028
9397254 Added basic docker file (eiabea)
2016-09-01 16:57:41 +02:00
redfish
e374ae7eeb cmake: option+target for profiling for coverage 2016-09-01 10:47:43 -04:00
redfish
fbfdf59a10 readme: organize deps into table 2016-09-01 10:46:26 -04:00
moneromooo-monero
f1d87c8064 simplewallet: add magic and public keys to key image export file
This ensures it's hard to mix files up
2016-09-01 11:32:44 +01:00
moneromooo-monero
f4e894a526 simplewallet: make the key image export format binary
Saves on space, and on some pointless hex conversions
2016-09-01 11:04:53 +01:00
Riccardo Spagni
e0d78858e4 Merge pull request #1022
b8c03a5 Remove blocks_per_sync limits (Howard Chu)
2016-09-01 11:32:27 +02:00
Riccardo Spagni
27c8713f56 Merge pull request #1027
85dc0ce wallet: sanity check on histogram response (moneromooo-monero)
2016-09-01 11:31:58 +02:00
Riccardo Spagni
badd77068b Merge pull request #1021
1d5ba65 Fix incorrect help usage for the threads option to start_mining (Quanah Gibson-Mount)
2016-09-01 11:29:57 +02:00
Riccardo Spagni
d3994f1df0 Merge pull request #1018
6cf8ca2 core: faster find_blockchain_supplement (moneromooo-monero)
2016-09-01 11:29:22 +02:00
Riccardo Spagni
e858c4c745 Merge pull request #1016
3112e24 wallet: interpret 0 fee multiplier as default for sweep_all too (moneromooo-monero)
2016-09-01 11:28:29 +02:00
Riccardo Spagni
e33e74a69b Merge pull request #1012
c2941cb Show correct amount of days behind/ahead while syncing (tobiasw2)
2016-09-01 11:26:58 +02:00
Riccardo Spagni
e389a9cd8f Merge pull request #1009
640a934 tests: cmake: fix building with system gtest (redfish)
4a9e949 tests: cmake: use a list for enabled tests (redfish)
dbd9a26 cmake: tests: gtest target is not always defined #983 (redfish)
2016-09-01 11:25:37 +02:00
Riccardo Spagni
9b579773d7 Merge pull request #1007
1de812a cmake: merge libs via virtual object libraries (redfish)
a7498ad cmake: comply with the new policy CMP0026 (redfish)
2016-09-01 11:21:38 +02:00
Riccardo Spagni
1032255a0e Merge pull request #1003
cf10e05 Add ARMv8 Handling to CMakeLists.txt - version 2 (NanoAkron)
2016-09-01 11:21:14 +02:00
eiabea
93972546c0 Added basic docker file
finalized dockerfile
2016-09-01 11:17:17 +02:00
moneromooo-monero
85dc0ce3a5 wallet: sanity check on histogram response 2016-09-01 09:04:45 +01:00
redfish
0f94f61805 cmake: handle dists which prefix gcc binaries wth arch triplet
Issue #1026
2016-08-31 22:21:22 -04:00
moneromooo-monero
6cf8ca2a7f core: faster find_blockchain_supplement
Since this queries block heights for blocks that may or may not
exist, queries for non existing blocks would throw an exception,
and that would slow down the loop a lot. 7 seconds to go through
a 30 hash list.

Fix this by adding an optional return block height to block_exists
and using this instead. Actual errors will still throw an
exception.

This also cuts down on log exception spam.
2016-08-31 10:03:32 +01:00
redfish
640a934d5f tests: cmake: fix building with system gtest
Issues #980 #983
2016-08-30 23:04:53 -04:00
redfish
1de812a92a cmake: merge libs via virtual object libraries
CMake issued a warming about policy CMP0026: access of LOCATION
target property at config time was disallowed. Offending code
was the code that merged static libraries to generate
libwallet_merged.a.

This patch does that same merge task in a much simpler way. And,
since it doesn't violate the policy, the warning went away.
2016-08-30 23:01:48 -04:00
redfish
a7498adc03 cmake: comply with the new policy CMP0026
Access to LOCATION property at config time was disallowed by this
policy. This patch updates the offending code to comply with the policy
and thereby gets rid of the warning printed by cmake.

The fix is to use generator expressions instead of that property.

NOTE: Had to remove support for multiconfig (only affects MSVC which is
not supported anyway; and mutliconf is an IDE thing in any case),
because could not see how to support it with generator expressions.
2016-08-30 23:01:43 -04:00
redfish
4a9e94944c tests: cmake: use a list for enabled tests
Avoid replicating common logic.
2016-08-30 22:56:14 -04:00
redfish
dbd9a2606c cmake: tests: gtest target is not always defined #983 2016-08-30 22:55:53 -04: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
Quanah Gibson-Mount
1d5ba65f3d Fix incorrect help usage for the threads option to start_mining 2016-08-30 14:59:28 -07:00
tobiasw2
c2941cb30a Show correct amount of days behind/ahead while syncing 2016-08-30 23:50:45 +02:00
moneromooo-monero
3112e24aa7 wallet: interpret 0 fee multiplier as default for sweep_all too 2016-08-30 13:19:20 +01:00
NanoAkron
a9f9536a43 Merge branch 'master' of https://github.com/monero-project/bitmonero into update-cmakelists-armv8 2016-08-30 02:04:55 +01:00
NanoAkron
cf10e05cc6 Add ARMv8 Handling to CMakeLists.txt - version 2
Adds 64-bit ARMv8 handling to CMakeLists.txt and implements GCC flags for two errata on the Cortex-A53 present on every chip in revision 0:

https://developer.arm.com/docs/epm048406/latest/arm-processor-cortex-a53-mpcore-product-revision-r0-software-developers-errata-notice

835769 affects 64-bit multiply accumulate

843419 affects internal page addressing

Rewritten to build on @radfish's changes

Updated to address @radfish's points
2016-08-30 00:57:55 +01:00
Riccardo Spagni
c3ba844f03 Merge pull request #1014
1cdba42 db_lmdb: fix reorg with "halfway rct" coinbase outputs (moneromooo-monero)
2016-08-30 00:10:06 +02:00
Riccardo Spagni
05c2a17d30 Merge pull request #1011
73b9b4b wallet: fix not finding enough rct fake outputs (moneromooo-monero)
2016-08-30 00:09:35 +02:00
moneromooo-monero
1cdba42a77 db_lmdb: fix reorg with "halfway rct" coinbase outputs 2016-08-29 22:44:17 +01:00
moneromooo-monero
73b9b4ba34 wallet: fix not finding enough rct fake outputs
If picking coinbase outputs, those are locked for a longer time
than other outputs, so we ask for more of those
2016-08-29 20:51:21 +01:00
Riccardo Spagni
69f200c7fb Merge pull request #1006
5bba2fd More for PR#999 (Howard Chu)
2016-08-29 17:06:11 +02:00
Riccardo Spagni
770486785d Merge pull request #1005
57bc33b Prevent core_tests from building under Travis (Jacob Torrey)
2016-08-29 17:05:38 +02:00
Howard Chu
5bba2fdbb0 More for PR#999 2016-08-29 15:58:56 +01:00
Jacob Torrey
57bc33b4d3 Prevent core_tests from building under Travis 2016-08-29 06:14:27 -06:00
Riccardo Spagni
51f0ac09c6 Merge pull request #1004
adca903 wallet_rpc_server: return payment id in make_integrated_address RPC (moneromooo-monero)
2016-08-29 13:23:19 +02:00
moneromooo-monero
adca903589 wallet_rpc_server: return payment id in make_integrated_address RPC
It is useful, especially when requesting a random one
2016-08-29 12:18:22 +01:00
Riccardo Spagni
c915bffa51 Merge pull request #1002
91ca0b4 core: allow empty global indices for txes with empty vout (moneromooo-monero)
2016-08-29 10:42:14 +02:00
moneromooo-monero
91ca0b4065 core: allow empty global indices for txes with empty vout 2016-08-29 09:28:32 +01:00
Riccardo Spagni
16e9dbc3f8 Merge pull request #998
442adfb cmake: define a default build type (redfish)
2016-08-29 01:40:53 +02:00
redfish
442adfbfaa cmake: define a default build type
Lets 'cmake .. && make' be sufficient to build.
2016-08-28 19:39:00 -04:00
Riccardo Spagni
e40d982bf6 Merge pull request #1000
d321c02 minor README changes, also I wanted to grab PR #1000 (Riccardo Spagni)
2016-08-28 22:56:17 +02: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
Riccardo Spagni
53a0997a26 Merge pull request #997
1c7d3b0 cmake: define ARM var for all ARM arch variants (redfish)
6fe543d cmake: ARM: exclude libunwind in static build (redfish)
397b720 make: remove NO_AES from arm targets (redfish)
57ca3f3 make: make the ARM release targets statically linked (redfish)
43c07a1 readme: editted install/build instructions for clarity (redfish)
a0d4058 Revert "makefile: remove unnecessary ARM-specific targets" (redfish)
c2bc34b Revert "Interpret x86_64 as x86-64 for architecture" (redfish)
c54b9a1 cmake: don't set ARCH from CMAKE_SYSTEM_PROCESSOR (redfish)
2016-08-28 22:49:09 +02:00
Riccardo Spagni
c706035c12 Merge pull request #995
94de4b0 cmake: pass -static when STATIC=ON on Windows (redfish)
2016-08-28 22:48:09 +02:00
Riccardo Spagni
e714803987 Merge pull request #994
ff6b8f2 Build: move Travis IRC notification channel (anonimal)
2016-08-28 22:47:21 +02:00
Riccardo Spagni
e9d4d224e3 Merge pull request #992
f1ba51c remove -Wall from coverage arguments (Jacob Torrey)
f017fec Build the core_tests under Travis (Jacob Torrey)
e0bf02a Streamline release-test target (Jacob Torrey)
baf4574 Update badge to point to monero's coveralls (Jacob Torrey)
d1dc2c3 Re-enable Travis IRC notifications (Jacob Torrey)
9c71b9e Silence coveralls to prevent 4MB logs (Jacob Torrey)
65041fb Disabled libwallet_api_test until Issue #895 resolved (Jacob Torrey)
a450138 Disable core_tests on Travis-CI (Jacob Torrey)
650afac Added -j2 to Makefile and clean up matrix (Jacob Torrey)
256dec0 Streamline test building target (Jacob Torrey)
14915c2 Ensure tests are built prior to testing (Jacob Torrey)
fe4992b Added coverage g++ commands (Jacob Torrey)
497b24f Update .travis.yml (Jacob Torrey)
678467d Update for the current make environment (Jacob Torrey)
abcac26 Fixed tab/space issue on YAML (Jacob Torrey)
7351a11 Converted to a build matrix for testing and release (Jacob Torrey)
342dbfb Prep for coveralls (Jacob Torrey)
2016-08-28 22:44:37 +02:00
Riccardo Spagni
fe2b0f55fe Merge pull request #990
cf6654c contrib: example systemd service and config file (redfish)
2016-08-28 22:43:33 +02:00
Riccardo Spagni
8a5b766d17 Merge pull request #961
887db9f blockchain: testnet heights for v3, v4, and v5 (moneromooo-monero)
f24ab58 ringct: remove unused code (moneromooo-monero)
b38452b ringct: pass structure by const ref, not value (moneromooo-monero)
fd11271 ringct: use memcpy/memset instead of handwritten loop where appropriate (moneromooo-monero)
5d38206 ringct: remove spurious copies (moneromooo-monero)
16732a8 rct: faster Cryptonote/rct conversions (moneromooo-monero)
fbd7c35 wallet: fix some "may be used uninitialized" warnings (moneromooo-monero)
4a41dd4 wallet: do not generate 0 change (moneromooo-monero)
a0925e6 core: use full rct signatures if just one input (moneromooo-monero)
94fd881 rct: early out on failure on verRange (moneromooo-monero)
45349b6 wallet: do not ask for duplicate histograms (moneromooo-monero)
b951bc8 wallet: transfer_selected_rct now also selects fake outs (moneromooo-monero)
4f887de increase minimum mixin to 4 on hard fork 5 (moneromooo-monero)
0815c72 core: allow v1 txes after HF 5 when sweeping unmixable outputs (moneromooo-monero)
f782d45 tests: hard fork list must end with a 0 (moneromooo-monero)
074e602 ringct: use Cryptonote serialization to hash non prunable data (moneromooo-monero)
c3b3260 New "Halfway RingCT" outputs for coinbase transactions (moneromooo-monero)
6f526cd rct: log why verification fails (moneromooo-monero)
d4b8991 rct: serialize txnFee as varint (moneromooo-monero)
d4b62a1 rct amount key modified as per luigi1111's recommendations (moneromooo-monero)
93f5c62 rct: rework v2 txes into prunable and non prunable data (moneromooo-monero)
d93746b rct: rework the verification preparation process (moneromooo-monero)
3ab2ab3 rct: change the simple flag to a type (moneromooo-monero)
c5be4b0 rct: avoid the need for the last II element (Shen Noether)
a47ceee wallet: do not store signatures in the wallet cache (moneromooo-monero)
0263dd2 core: add some locking around pool use (moneromooo-monero)
2c9d951 wallet2: factor m_spent changes (moneromooo-monero)
1303cda wallet: always use new algorithm for RPC transfers (moneromooo-monero)
b337aea rct: do not serialize senderPk - it is not used anymore (moneromooo-monero)
e5a9a47 core_tests: fix a couple pre-rct tests using rct (moneromooo-monero)
230fca2 wallet: use the prefered rct case only when enough rct outs exist (moneromooo-monero)
c27194a wallet: do not try to use rct txes a few blocks before the fork (moneromooo-monero)
1bf0698 tx_pool: log why a transaction was rejected for version checks (moneromooo-monero)
37bdf6e change fork settings to allow pre-rct txes for one more fork cycle (moneromooo-monero)
cc85cc6 simplewallet: better check_tx_key feedback (moneromooo-monero)
9b70856 rct: make the amount key derivable by a third party with the tx key (moneromooo-monero)
cf33e1a rct: do not serialize public keys in outPk (moneromooo-monero)
83ab315 wallet2_api: zero amounts are now allowed with rct (moneromooo-monero)
096ac06 wallet2_api: update on_money_{received,spent} prototypes for rct changes (moneromooo-monero)
3cb2ede rpc: send global indices along with blocks/transacions on refresh (moneromooo-monero)
414b424 core: always use the new simple rct variant (moneromooo-monero)
ce5de8b tests: add tests for wallet output selection (moneromooo-monero)
84c82cd wallet: better tx input selection (moneromooo-monero)
1e21651 rct: use the already defined H where possible (moneromooo-monero)
07d353d wallet: handle 0 change properly (moneromooo-monero)
e81a2b2 port get_tx_key/check_tx_key to rct (moneromooo-monero)
e06faef tests: add basic tests for simple rct api (moneromooo-monero)
a4d4d61 integrate simple rct api (moneromooo-monero)
1e8d37e serialization: add override for serializing bool (moneromooo-monero)
dbb5f2d ringct: optimization/cleanup of hash functions (Shen Noether)
4fd01f2 ringct: "simple" ringct variant (Shen Noether)
37c895e wallet: rct specific output selection (moneromooo-monero)
1181c57 wallet: make sweep_all work with rct txes too (moneromooo-monero)
c2ec6d3 mixable transactions must be rct for v3 (moneromooo-monero)
1017a75 wallet: factor transfer_rct code with transfer code (moneromooo-monero)
f5465d8 Condition v2 txes on v3 hard fork (moneromooo-monero)
59a66e2 move the rct commitments to the output_amounts database (moneromooo-monero)
6d0e471 rct: add the tx prefix hash into the MLSAG (moneromooo-monero)
35dce5c ringct: fix size unit mismatch calling keccak (moneromooo-monero)
20e50ec ringct: do not serialize what can be reconstructed (moneromooo-monero)
106e3dc Add rct core tests (moneromooo-monero)
ada5275 Use the supplied hard fork version in validate_miner_transaction (moneromooo-monero)
acbe06d wallet: update spent status when an accepted tx disappears (moneromooo-monero)
089df4a wallet: reset output spent status on blockchain reorg (moneromooo-monero)
73d59f1 ringct: catch errors from ge_frombytes_vartime (moneromooo-monero)
161551e tests: test for ringct rctSig data sizes (moneromooo-monero)
359f469 ringct: add missing size check for ecdhInfo (moneromooo-monero)
229968e ringct: change asserts to return false for boolean functions (moneromooo-monero)
dc4aad7 add rct to the protocol (moneromooo-monero)
211d1db db_lmdb: update reset for recent db changes (moneromooo-monero)
dee42d6 ringct: add functions to commit to an amount (moneromooo-monero)
cc7f449 make rct tx serialization work (moneromooo-monero)
e70e8a6 crypto: error out where appropriate (moneromooo-monero)
54f7429 ringct: allow no outputs, and add tests for this and fees (moneromooo-monero)
e99904a ringct: make fee optional (moneromooo-monero)
f8c04ad ringct: txn fee stuff (Shen Noether)
66f9626 ringct: new {gen,decode}Rct APIs for convenience (moneromooo-monero)
789b2e2 ringct: add more convenience functions (moneromooo-monero)
9856443 core: link against libringct (moneromooo-monero)
4258dab core: new /getrandom_rctouts.bin binary RPC call (moneromooo-monero)
c3a2e14 ringct: add convenience functions to bridge ringct and cryptonote (moneromooo-monero)
eb56d0f blockchain_db: add functions for adding/removing/getting rct commitments (moneromooo-monero)
82072e7 ringct: restore verRange check in debug mode (moneromooo-monero)
63856ca ringct: add check for destinations/amount size being equal (moneromooo-monero)
e816a09 ringct: fix off by 1 in mixin usage (moneromooo-monero)
09c5ea4 ringct: simplify random key generation (moneromooo-monero)
53cdf4d tests: new ringct test for checking H2 values (Shen Noether)
56f6549 ringct: cosmetic fixes (Shen Noether)
55ff136 ringct: changes to hashToPointSimple to calcualte H2 values (Shen Noether)
63733b1 ringct: compare keys with bitwise equality, not crypto ops (Shen Noether)
98f4c6f ringct: fix size argument to cn_fast_hash (Shen Noether)
720ac85 tests: zero inputs/outputs are in fact supposed to be accepted (moneromooo-monero)
84948ea ringct: add a test for prooveRange being non deterministic (moneromooo-monero)
09fb9f4 Fix sc_0 to skGen in ProveRange (Shen Noether)
d37c1db ringct: add a few consts where appropriate (moneromooo-monero)
700248f tests: more ringct range proof tests (moneromooo-monero)
d02f999 rct: add serialization machinery to rct types (moneromooo-monero)
0ff8305 serialization: declare do_serialize specializations before use (moneromooo-monero)
8b135e7 Added note on generating H2 (Shen Noether)
4d639d9 Fixed missing last index H2 (Shen Noether)
9e82b69 remove original Cryptonote blockchain_storage blockchain format (moneromooo-monero)
86b4426 ringct: lock access to the PRNG (moneromooo-monero)
4d7f073 ringct: add simple input validation (moneromooo-monero)
57779ab tests: add some more ringct building block tests (moneromooo-monero)
b656001 ringct: add convenience operators to key (moneromooo-monero)
2d6303f tests: add Shen Noether's basic ringct tests (moneromooo-monero)
9b1afe5 ringct: import of Shen Noether's ring confidential transactions (moneromooo-monero)
2016-08-28 22:41:12 +02:00
moneromooo-monero
887db9f936 blockchain: testnet heights for v3, v4, and v5 2016-08-28 21:30:54 +01:00
moneromooo-monero
f24ab58d18 ringct: remove unused code 2016-08-28 21:30:53 +01:00
moneromooo-monero
b38452bd55 ringct: pass structure by const ref, not value 2016-08-28 21:30:51 +01:00
moneromooo-monero
fd11271eea ringct: use memcpy/memset instead of handwritten loop where appropriate 2016-08-28 21:30:49 +01:00
moneromooo-monero
5d38206fcc ringct: remove spurious copies 2016-08-28 21:30:47 +01:00
moneromooo-monero
16732a85d7 rct: faster Cryptonote/rct conversions 2016-08-28 21:30:45 +01:00
moneromooo-monero
fbd7c359ee wallet: fix some "may be used uninitialized" warnings
The compiler can't always work out the _found booleans are
set iff the value is initialized.
2016-08-28 21:30:44 +01:00
moneromooo-monero
4a41dd4068 wallet: do not generate 0 change 2016-08-28 21:30:42 +01:00
moneromooo-monero
a0925e628e core: use full rct signatures if just one input
It is slightly smaller, but requires all rings to have the real
input on the same index, so can only be used for single input txes.
2016-08-28 21:30:40 +01:00
moneromooo-monero
94fd881f74 rct: early out on failure on verRange 2016-08-28 21:30:38 +01:00
moneromooo-monero
45349b6f7c wallet: do not ask for duplicate histograms 2016-08-28 21:30:36 +01:00
moneromooo-monero
b951bc8780 wallet: transfer_selected_rct now also selects fake outs 2016-08-28 21:30:34 +01:00
moneromooo-monero
4f887dea6e increase minimum mixin to 4 on hard fork 5 2016-08-28 21:30:33 +01:00
moneromooo-monero
0815c72df7 core: allow v1 txes after HF 5 when sweeping unmixable outputs 2016-08-28 21:30:31 +01:00
moneromooo-monero
f782d45827 tests: hard fork list must end with a 0 2016-08-28 21:30:29 +01:00
moneromooo-monero
074e602609 ringct: use Cryptonote serialization to hash non prunable data 2016-08-28 21:30:28 +01:00
moneromooo-monero
c3b3260ae5 New "Halfway RingCT" outputs for coinbase transactions
When RingCT is enabled, outputs from coinbase transactions
are created as a single output, and stored as RingCT output,
with a fake mask. Their amount is not hidden on the blockchain
itself, but they are then able to be used as fake inputs in
a RingCT ring. Since the output amounts are hidden, their
"dustiness" is not an obstacle anymore to mixing, and this
makes the coinbase transactions a lot smaller, as well as
helping the TXO set to grow more slowly.

Also add a new "Null" type of rct signature, which decreases
the size required when no signatures are to be stored, as
in a coinbase tx.
2016-08-28 21:30:26 +01:00
moneromooo-monero
6f526cdff8 rct: log why verification fails
and remove some unnecessary variables in the checking code
2016-08-28 21:30:23 +01:00
moneromooo-monero
d4b8991e44 rct: serialize txnFee as varint 2016-08-28 21:30:21 +01:00
moneromooo-monero
d4b62a1e29 rct amount key modified as per luigi1111's recommendations
This allows the key to be not the same for two outputs sent to
the same address (eg, if you pay yourself, and also get change
back). Also remove the key amounts lists and return parameters
since we don't actually generate random ones, so we don't need
to save them as we can recalculate them when needed if we have
the correct keys.
2016-08-28 21:30:19 +01:00
moneromooo-monero
93f5c625f0 rct: rework v2 txes into prunable and non prunable data
Nothing is pruned, but this allows easier changes later.
2016-08-28 21:30:18 +01:00
moneromooo-monero
d93746b6d3 rct: rework the verification preparation process
The whole rct data apart from the MLSAGs is now included in
the signed message, to avoid malleability issues.

Instead of passing the data that's not serialized as extra
parameters to the verification API, the transaction is modified
to fill all that information. This means the transaction can
not be const anymore, but it cleaner in other ways.
2016-08-28 21:30:16 +01:00
moneromooo-monero
3ab2ab3e76 rct: change the simple flag to a type
for future expansion
2016-08-28 21:30:14 +01:00
Shen Noether
c5be4b0bea rct: avoid the need for the last II element
This element is used in the generation of the MLSAG, but isn't
needed in verification.
Also misc changes in the cryptonote code to match, by mooo.
2016-08-28 21:30:12 +01:00
moneromooo-monero
a47ceee83b wallet: do not store signatures in the wallet cache
Saves some substantial space.
Also avoid calculating tx hashes we don't need.
2016-08-28 21:30:10 +01:00
moneromooo-monero
0263dd2d23 core: add some locking around pool use 2016-08-28 21:30:08 +01:00
moneromooo-monero
2c9d9519f1 wallet2: factor m_spent changes
Makes it easier to track what is going on.
2016-08-28 21:30:04 +01:00
moneromooo-monero
1303cda646 wallet: always use new algorithm for RPC transfers
This ensures we get rct transactions when appropriate
2016-08-28 21:30:03 +01:00
moneromooo-monero
b337aea6cc rct: do not serialize senderPk - it is not used anymore 2016-08-28 21:30:01 +01:00
moneromooo-monero
e5a9a4755b core_tests: fix a couple pre-rct tests using rct 2016-08-28 21:29:58 +01:00
moneromooo-monero
230fca2d56 wallet: use the prefered rct case only when enough rct outs exist 2016-08-28 21:29:55 +01:00
moneromooo-monero
c27194a444 wallet: do not try to use rct txes a few blocks before the fork 2016-08-28 21:29:53 +01:00
moneromooo-monero
1bf069825b tx_pool: log why a transaction was rejected for version checks 2016-08-28 21:29:51 +01:00
moneromooo-monero
37bdf6ebe3 change fork settings to allow pre-rct txes for one more fork cycle 2016-08-28 21:29:50 +01:00
moneromooo-monero
cc85cc6a3f simplewallet: better check_tx_key feedback
Print number of confirmations if the tx is in the blockchain,
or a warning if it's in the pool.
2016-08-28 21:29:48 +01:00
moneromooo-monero
9b70856ccb rct: make the amount key derivable by a third party with the tx key
Scheme design from luigi1114.
2016-08-28 21:29:46 +01: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
83ab3151e8 wallet2_api: zero amounts are now allowed with rct 2016-08-28 21:29:41 +01:00
moneromooo-monero
096ac06521 wallet2_api: update on_money_{received,spent} prototypes for rct changes 2016-08-28 21:29:40 +01:00
moneromooo-monero
3cb2edec66 rpc: send global indices along with blocks/transacions on refresh
This plugs a privacy leak, where the wallet tells the daemon
which transactions contain outputs for the wallet by asking
for additional information for that particular transaction.

As a nice bonus, this actually makes refresh slightly faster.
2016-08-28 21:29:38 +01:00
moneromooo-monero
414b424d32 core: always use the new simple rct variant 2016-08-28 21:29:36 +01:00
moneromooo-monero
ce5de8b430 tests: add tests for wallet output selection 2016-08-28 21:29:34 +01:00
moneromooo-monero
84c82cd775 wallet: better tx input selection
We try to avoid related inputs, when possible
2016-08-28 21:29:32 +01:00
moneromooo-monero
1e21651f24 rct: use the already defined H where possible
Found by luigi1111w
2016-08-28 21:29:29 +01:00
moneromooo-monero
07d353dfc6 wallet: handle 0 change properly
With RCT, we allow 0 size outputs, to try and encourage txes
with two inputs and two outputs. Consolidation would then
have two non zero inputs, one zero output, and one larger
output.
2016-08-28 21:29:27 +01:00
moneromooo-monero
e81a2b2cfa port get_tx_key/check_tx_key to rct 2016-08-28 21:29:24 +01:00
moneromooo-monero
e06faefde4 tests: add basic tests for simple rct api 2016-08-28 21:29:22 +01:00
moneromooo-monero
a4d4d6194b integrate simple rct api 2016-08-28 21:29:20 +01:00
moneromooo-monero
1e8d37e7d8 serialization: add override for serializing bool 2016-08-28 21:29:19 +01:00
Shen Noether
dbb5f2d6a3 ringct: optimization/cleanup of hash functions 2016-08-28 21:29:16 +01:00
Shen Noether
4fd01f2bee ringct: "simple" ringct variant
Allows the fake outs to be in different positions for each ring.
For rct inputs only.
2016-08-28 21:29:14 +01:00
moneromooo-monero
37c895e5e3 wallet: rct specific output selection
Before the normal selection, we attempt to find either one or two
suitable outputs to use as inputs to the rct tx. The intent is that
most rct txes will have one or two inputs, and we want all to look
the same if possible.
When two outputs are needed, we try to find a pair which are not
related (ie, by being from the same or similar block height).
2016-08-28 21:29:11 +01:00
moneromooo-monero
1181c57967 wallet: make sweep_all work with rct txes too 2016-08-28 21:29:09 +01:00
moneromooo-monero
c2ec6d35b9 mixable transactions must be rct for v3 2016-08-28 21:29:07 +01:00
moneromooo-monero
1017a75460 wallet: factor transfer_rct code with transfer code
The "transfer" simplewallet command is renamed to "transfer_original".
"transfer_new" is renamed "transfer", "transfer_rct" is removed,
and the new "transfer" now selects rct or non rct transactions
based on the current block height.
2016-08-28 21:29:05 +01:00
moneromooo-monero
f5465d8246 Condition v2 txes on v3 hard fork 2016-08-28 21:29:04 +01:00
moneromooo-monero
59a66e209a move the rct commitments to the output_amounts database
Since these are needed at the same time as the output pubkeys,
this is a whole lot faster, and takes less space. Only outputs
of 0 amount store the commitment. When reading other outputs,
a fake commitment is regenerated on the fly. This avoids having
to rewrite the database to add space for fake commitments for
existing outputs.

This code relies on two things:

- LMDB must support fixed size records per key, rather than
per database (ie, all records on key 0 are the same size, all
records for non 0 keys are same size, but records from key 0
and non 0 keys do have different sizes).

- the commitment must be directly after the rest of the data
in outkey and output_data_t.
2016-08-28 21:29:02 +01:00
moneromooo-monero
6d0e47148b rct: add the tx prefix hash into the MLSAG
to protect the non-signatures parts of the tx from tampering.
2016-08-28 21:28:58 +01:00
moneromooo-monero
35dce5c70c ringct: fix size unit mismatch calling keccak 2016-08-28 21:28:57 +01:00
moneromooo-monero
20e50ec7f7 ringct: do not serialize what can be reconstructed
The mixRing (output keys and commitments) and II fields (key images)
can be reconstructed from vin data.
This saves some modest amount of space in the tx.
2016-08-28 21:28:55 +01:00
moneromooo-monero
106e3dc3d4 Add rct core tests 2016-08-28 21:28:53 +01:00
moneromooo-monero
ada527558f Use the supplied hard fork version in validate_miner_transaction
rather than using the current one. No functional changes, but may
save some bugs in the future.
2016-08-28 21:28:51 +01:00
moneromooo-monero
acbe06d8e9 wallet: update spent status when an accepted tx disappears 2016-08-28 21:28:49 +01:00
moneromooo-monero
089df4af83 wallet: reset output spent status on blockchain reorg
If the blockchain gets reorganized, all outputs spent in the part
of the blockchain that's blown away need to be reset to unspent
(they may end up spent again on the blocks that replace the blocks
that are removed, however).
2016-08-28 21:28:47 +01:00
moneromooo-monero
73d59f17e1 ringct: catch errors from ge_frombytes_vartime 2016-08-28 21:28:45 +01:00
moneromooo-monero
161551e13b tests: test for ringct rctSig data sizes
ie, more data or less data than expected in various fields
2016-08-28 21:28:42 +01:00
moneromooo-monero
359f46901e ringct: add missing size check for ecdhInfo 2016-08-28 21:28:41 +01:00
moneromooo-monero
229968eafc ringct: change asserts to return false for boolean functions 2016-08-28 21:28:39 +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
211d1db762 db_lmdb: update reset for recent db changes
- we need to drop the new m_tx_indices database
- we reset the version to current version

This fixes the core tests failing to initialize.
2016-08-28 21:28:35 +01:00
moneromooo-monero
dee42d6dac ringct: add functions to commit to an amount
One to commit to an amount with zero key (for use with fake
commitments for pre-rct outputs), and one with an arbitrary
key (for rct outputs).
2016-08-28 21:28:33 +01:00
moneromooo-monero
cc7f449d57 make rct tx serialization work
It may be suboptimal, but it's a pain to have to rebuild everything
when some of this changes.
Also, no clue why there seems to be two different code paths for
serializing a tx...
2016-08-28 21:28:31 +01:00
moneromooo-monero
e70e8a69f4 crypto: error out where appropriate 2016-08-28 21:28:29 +01:00
moneromooo-monero
54f7429cf6 ringct: allow no outputs, and add tests for this and fees 2016-08-28 21:28:27 +01:00
moneromooo-monero
e99904ac31 ringct: make fee optional 2016-08-28 21:28:25 +01:00
Shen Noether
f8c04ad94f ringct: txn fee stuff 2016-08-28 21:28:23 +01:00
moneromooo-monero
66f96260b2 ringct: new {gen,decode}Rct APIs for convenience
A new version of genRct takes the mixRing as parameter, instead
of the inPk. inPk are part of the mixRing, and it is cleaner to
pass the mixRing data than to fetch it from the RingCT code.

A new version of decodeRct also returns the mask.

Also, failure to decode throws, so errors are properly detected.
2016-08-28 21:28:21 +01:00
moneromooo-monero
789b2e21f6 ringct: add more convenience functions 2016-08-28 21:28:20 +01:00
moneromooo-monero
98564439f8 core: link against libringct 2016-08-28 21:28:18 +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
c3a2e1450a ringct: add convenience functions to bridge ringct and cryptonote 2016-08-28 21:28:14 +01:00
moneromooo-monero
eb56d0f994 blockchain_db: add functions for adding/removing/getting rct commitments 2016-08-28 21:28:11 +01:00
moneromooo-monero
82072e701a ringct: restore verRange check in debug mode 2016-08-28 21:28:08 +01:00
moneromooo-monero
63856cad29 ringct: add check for destinations/amount size being equal 2016-08-28 21:28:07 +01:00
moneromooo-monero
e816a09292 ringct: fix off by 1 in mixin usage 2016-08-28 21:28:04 +01:00
moneromooo-monero
09c5ea43a2 ringct: simplify random key generation 2016-08-28 21:28:03 +01:00
Shen Noether
53cdf4df5e tests: new ringct test for checking H2 values
Ported from Shen's RingCT repo
2016-08-28 21:28:01 +01:00
Shen Noether
56f6549962 ringct: cosmetic fixes
Ported from Shen's RingCT repo
2016-08-28 21:27:59 +01:00
Shen Noether
55ff136e12 ringct: changes to hashToPointSimple to calcualte H2 values
Ported from Shen's RingCT repo
2016-08-28 21:27:57 +01:00
Shen Noether
63733b1785 ringct: compare keys with bitwise equality, not crypto ops
Ported from Shen's RingCT repo
2016-08-28 21:27:56 +01:00
Shen Noether
98f4c6f7eb ringct: fix size argument to cn_fast_hash
Ported from Shen's RingCT repo
2016-08-28 21:27:54 +01:00
moneromooo-monero
720ac85553 tests: zero inputs/outputs are in fact supposed to be accepted 2016-08-28 21:27:52 +01:00
moneromooo-monero
84948eabae ringct: add a test for prooveRange being non deterministic 2016-08-28 21:27:50 +01:00
Shen Noether
09fb9f4b75 Fix sc_0 to skGen in ProveRange 2016-08-28 21:27:48 +01:00
moneromooo-monero
d37c1db032 ringct: add a few consts where appropriate 2016-08-28 21:27:45 +01:00
moneromooo-monero
700248f59e tests: more ringct range proof tests 2016-08-28 21:27:43 +01:00
moneromooo-monero
d02f9995a8 rct: add serialization machinery to rct types 2016-08-28 21:27:41 +01:00
moneromooo-monero
0ff8305426 serialization: declare do_serialize specializations before use
This lets my gcc picks those instead of the generic template
where appropriate (and then fail since std::vector<something>
does not have a serialize method.
2016-08-28 21:27:38 +01:00
Shen Noether
8b135e7aa3 Added note on generating H2 2016-08-28 21:27:36 +01:00
Shen Noether
4d639d90ca Fixed missing last index H2 2016-08-28 21:27:34 +01:00
moneromooo-monero
9e82b694da remove original Cryptonote blockchain_storage blockchain format 2016-08-28 21:27:32 +01:00
moneromooo-monero
86b4426191 ringct: lock access to the PRNG 2016-08-28 21:27:30 +01:00
moneromooo-monero
4d7f073491 ringct: add simple input validation
Throw when inputs aren't the expected size.
2016-08-28 21:27:28 +01:00
moneromooo-monero
57779abe27 tests: add some more ringct building block tests 2016-08-28 21:27:26 +01:00
moneromooo-monero
b656001030 ringct: add convenience operators to key 2016-08-28 21:27:24 +01:00
moneromooo-monero
2d6303fb2c tests: add Shen Noether's basic ringct tests 2016-08-28 21:27:19 +01:00
moneromooo-monero
9b1afe5f2d ringct: import of Shen Noether's ring confidential transactions 2016-08-28 21:26:54 +01:00
Howard Chu
dc411ea3b7 Change default db-sync-mode to fast, not fastest 2016-08-28 16:20:22 +01:00
redfish
1c7d3b05a9 cmake: define ARM var for all ARM arch variants
This is refactoring only. No behavior change.
2016-08-28 12:55:33 +00:00
Riccardo Spagni
d321c02830 minor README changes, also I wanted to grab PR #1000 2016-08-28 14:13:52 +02:00
redfish
6fe543dcd4 cmake: ARM: exclude libunwind in static build
Else error in build with STATIC=ON:

cd /home/redfish/bitmonero/build/release/src/miner && /usr/bin/cmake -E
cmake_link_script CMakeFiles/simpleminer.dir/link.txt --verbose=1
/usr/bin/c++    -std=c++11 -D_GNU_SOURCE  -Wall -Wextra -Wpointer-arith
-Wundef -Wvla -Wwrite-strings -Wno-error=extra
-Wno-error=deprecated-declarations -Wno-unused-parameter
-Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef
-Wno-error=uninitialized -Wlogical-op -Wno-error=maybe-uninitialized
-Wno-reorder -Wno-missing-field-initializers -march=armv7-a
-fno-strict-aliasing -mfloat-abi=hard -DNDEBUG -O2  -flto
-ffat-lto-objects   -static-libgcc -static-libstdc++
-Wl,--wrap=__cxa_throw CMakeFiles/simpleminer.dir/simpleminer.cpp.o  -o
../../bin/simpleminer -rdynamic -Wl,-Bstatic -lrt -Wl,-Bdynamic -ldl
../cryptonote_core/libcryptonote_core.a ../common/libcommon.a
-Wl,-Bstatic -lboost_filesystem -lboost_program_options -lboost_regex
-lboost_chrono -lboost_system -lboost_thread -Wl,-Bdynamic -pthread
-Wl,-Bstatic -lrt -Wl,-Bdynamic -ldl ../blockchain_db/libblockchain_db.a
../cryptonote_core/libcryptonote_core.a
../blockchain_db/libblockchain_db.a
../../contrib/otshell_utils/libotshell_utils.a ../blocks/libblocks.a
../common/libcommon.a ../../external/unbound/libunbound.a -lssl -lcrypto
-lunwind -Wl,-Bstatic -lboost_program_options ../crypto/libcrypto.a
-lboost_date_time -lboost_serialization -lboost_filesystem
../../external/db_drivers/liblmdb/liblmdb.a -Wl,-Bdynamic -pthread
-Wl,-Bstatic -lboost_chrono -lboost_system -lboost_thread -lrt
-Wl,-Bdynamic -ldl
/usr/bin/ld: ../../bin/simpleminer: hidden symbol
`__aeabi_unwind_cpp_pr0' in
/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/6.1.1/libgcc_eh.a(unwind-arm.o)
is referenced by DSO
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
2016-08-28 07:20:39 -04:00
redfish
397b720069 make: remove NO_AES from arm targets
cmake sets that appropriately based on the target architecture
2016-08-28 05:42:06 -04:00
redfish
57ca3f3f64 make: make the ARM release targets statically linked
I think, in this context, dynamically linked builds make sense
only for native builds, not these builds that target arch
families to produce portable binaries.
2016-08-28 05:35:27 -04:00
redfish
43c07a1cfa readme: editted install/build instructions for clarity
* some re-org of sections to make things more concise
* dedicated section for installing from packages vs building from source
* for Windows, instruct to run the top-level makefile targets,
  because I don't see any reason not to -- advanced users
  will look into the makefile and find the cmake command there
  if they need to.
* for Windows, instruct to install *-toolchain meta package
  which includes expat
* added some context info here and there to aid -- I tried
  to clarify things that confused me, e.g. Windows build is
  cross-compilation to be precise; motivation for targets
  that are meant for generating portable binaries as opposed
  to binaries optimized to host CPU.
2016-08-28 04:42:20 -04:00
redfish
a0d40587ea Revert "makefile: remove unnecessary ARM-specific targets"
This reverts commit ecd0f2dde7.

These targets that are not native builds. They are for builds
portable within processors of a given family.

'make release' used to not work to build a native build on ARM, but that
has been fixed. These targets are unrelated to the native build.
2016-08-28 02:10:52 -04:00
redfish
c2bc34b736 Revert "Interpret x86_64 as x86-64 for architecture"
This reverts commit 8623492150.

Let's restrict ARCH to values accepted by -march to keep things clear
and consistent. ARCH is -march, with only one exception: a value of
"default" indicates to not pass -march at all.
2016-08-28 02:10:36 -04:00
redfish
c54b9a1a05 cmake: don't set ARCH from CMAKE_SYSTEM_PROCESSOR
It is not correct to do so, because ARCH should only take values
supported by the -march argument, with the exception of 'default'
which denotes not passing -march at all.

ARCH defines the target architecture for builds that are intended to be
portable to other machines.
2016-08-28 01:37:34 -04:00
redfish
94de4b040c cmake: pass -static when STATIC=ON on Windows
This gets rid of bitmonerod.exe's dependecy on libwindpthreads-1.dll in build
on Windows on x86_64 (via MSYS2 default toolchain). With this patch all DLL
dependencies are on DLLs in c:\windows\system32.
2016-08-27 20:26:39 -04:00
anonimal
ff6b8f2e59 Build: move Travis IRC notification channel
This will allow people to have Travis push notifications
for their repo without spamming the dev channel
2016-08-27 18:09:31 +00:00
Jacob Torrey
f1ba51cf89 remove -Wall from coverage arguments 2016-08-27 06:29:19 -06:00
Jacob Torrey
f017fecde9 Build the core_tests under Travis 2016-08-27 06:22:57 -06:00
redfish
cf6654c178 contrib: example systemd service and config file
Including in light of #977
2016-08-26 18:57:53 -04:00
Jacob Torrey
e0bf02a6ce Streamline release-test target
When Travis builds and tests, time is limited per build, so the overhead of re-calling CMake can push it over the limit.
2016-08-26 14:06:35 -06:00
Jacob Torrey
baf4574ad5 Update badge to point to monero's coveralls 2016-08-26 14:06:35 -06:00
Jacob Torrey
d1dc2c31c7 Re-enable Travis IRC notifications 2016-08-26 14:06:35 -06:00
Jacob Torrey
9c71b9e9ce Silence coveralls to prevent 4MB logs
Signed-off-by: Jacob Torrey <discipleofranok@gmail.com>
2016-08-26 14:03:27 -06:00
Jacob Torrey
65041fbbf8 Disabled libwallet_api_test until Issue #895 resolved
Signed-off-by: Jacob Torrey <discipleofranok@gmail.com>
2016-08-26 14:03:27 -06:00
Jacob Torrey
a4501384bf Disable core_tests on Travis-CI
Signed-off-by: Jacob Torrey <discipleofranok@gmail.com>
2016-08-26 14:03:27 -06:00
Jacob Torrey
650afacc1f Added -j2 to Makefile and clean up matrix
Signed-off-by: Jacob Torrey <discipleofranok@gmail.com>
2016-08-26 14:03:27 -06:00
Jacob Torrey
256dec0601 Streamline test building target
Signed-off-by: Jacob Torrey <discipleofranok@gmail.com>
2016-08-26 14:03:27 -06:00
Jacob Torrey
14915c24d7 Ensure tests are built prior to testing 2016-08-26 14:03:27 -06:00
Jacob Torrey
fe4992b1dc Added coverage g++ commands
Signed-off-by: Jacob Torrey <torreyj@ainfosec.com>
2016-08-26 14:03:27 -06:00
Jacob Torrey
497b24f25f Update .travis.yml 2016-08-26 14:03:27 -06:00
Jacob Torrey
678467d5b0 Update for the current make environment 2016-08-26 14:03:27 -06:00
Jacob Torrey
abcac26e9b Fixed tab/space issue on YAML
Signed-off-by: Jacob Torrey <torreyj@ainfosec.com>
2016-08-26 14:03:27 -06:00
Jacob Torrey
7351a1174b Converted to a build matrix for testing and release
Signed-off-by: Jacob Torrey <torreyj@ainfosec.com>
2016-08-26 14:03:27 -06:00
Jacob Torrey
342dbfb705 Prep for coveralls
Signed-off-by: Jacob Torrey <torreyj@ainfosec.com>
2016-08-26 14:03:27 -06:00
Riccardo Spagni
a569b264bc Merge pull request #991
f88029e db_lmdb: do not try to modify the database in read only mode (moneromooo-monero)
2016-08-26 20:39:21 +02:00
moneromooo-monero
f88029e72a db_lmdb: do not try to modify the database in read only mode 2016-08-26 19:33:25 +01:00
Riccardo Spagni
416c1da51c Merge pull request #989
0ed35f7 README.md: Boost version updated for windows (tobiasw2)
2016-08-26 10:34:29 +02:00
Riccardo Spagni
009bea43ce Merge pull request #986
da58422 Update README.i18n (arb0r)
2016-08-26 10:34:00 +02:00
Riccardo Spagni
2702e4999a Merge pull request #984
78035d2 Fix fake 'network synchronized, begin using' messages (Thomas Winget)
2016-08-26 10:33:10 +02:00
Riccardo Spagni
7000ed45ec Merge pull request #982
65238d2 fix #691 removed help about leaving wallet name empty on --generate-new-wallet (guzzi_jones)
2016-08-26 10:32:30 +02:00
Riccardo Spagni
9308b4e8b9 Merge pull request #978
99dd572 libwallet_api: tests: checking for result while opening wallet (Ilya Kitaev)
bcf7b67 libwallet_api: Wallet::amountFromString fixed (Ilya Kitaev)
32bc7b4 libwallet_api: helper method to return maximumAllowedAmount (Ilya Kitaev)
cbe534d libwallet_api: tests: removed logged passwords (Ilya Kitaev)
b1a5a93 libwallet_api: do not store wallet on close if status is not ok (Ilya Kitaev)
2016-08-26 10:32:00 +02:00
Riccardo Spagni
391c567f37 Merge pull request #976
c2f4e16 simplewallet: default to max-concurrency 1 on MacOS X (moneromooo-monero)
2016-08-26 10:31:24 +02:00
tobiasw2
0ed35f7d8d README.md: Boost version updated for windows 2016-08-25 01:41:58 +02:00
Riccardo Spagni
2c544257f5 Merge pull request #988
5f873ea added Symas as a sponsor (Riccardo Spagni)
2016-08-24 18:09:50 +02:00
Riccardo Spagni
5f873eaea0 added Symas as a sponsor 2016-08-24 17:47:53 +02:00
Riccardo Spagni
73ec1e6421 Merge pull request #981
3729ac8 Docs: re-introduce Boost 1.58 min req from 2a2b655 (anonimal)
2016-08-24 17:46:15 +02:00
Riccardo Spagni
b63d04fb84 Merge branch 'ranok-patch-1' 2016-08-24 17:45:28 +02:00
Riccardo Spagni
68039eccc2 resolved conflicts in readme.md 2016-08-24 17:45:09 +02:00
arb0r
da58422bae Update README.i18n
Fixed typo.
2016-08-24 17:01:32 +02:00
Thomas Winget
78035d2b6c Fix fake 'network synchronized, begin using' messages 2016-08-23 22:52:25 -04:00
guzzi_jones
65238d281c fix #691 removed help about leaving wallet name empty on --generate-new-wallet 2016-08-24 00:03:36 +00:00
anonimal
3729ac81c9 Docs: re-introduce Boost 1.58 min req from 2a2b655 2016-08-23 22:20:01 +00:00
Ilya Kitaev
99dd57258f libwallet_api: tests: checking for result while opening wallet 2016-08-23 14:13:30 +03:00
Ilya Kitaev
bcf7b67cd6 libwallet_api: Wallet::amountFromString fixed 2016-08-23 13:47:21 +03:00
Ilya Kitaev
32bc7b41c0 libwallet_api: helper method to return maximumAllowedAmount 2016-08-23 12:35:45 +03:00
Riccardo Spagni
db909a224c Merge branch 'radfish-PR--readme-clarify-conf-syntax' 2016-08-22 23:00:06 +02:00
Riccardo Spagni
dfab703eab fix README conflicts 2016-08-22 22:59:45 +02:00
Riccardo Spagni
17157f8a22 Merge pull request #972
2c5e68f cmake: fix typo in handling of STACK_TRACE (redfish)
2016-08-22 22:55:53 +02:00
Riccardo Spagni
79cdedb90c Merge pull request #970
25f529a wallet: store key images after importing them (moneromooo-monero)
2016-08-22 22:55:24 +02:00
Riccardo Spagni
13222f9ff5 Merge pull request #968
9cca53a wallet: fix build on Mac and Windows (missing include) (moneromooo-monero)
2016-08-22 22:55:00 +02:00
Riccardo Spagni
1843d189c3 Merge pull request #967
e596e25 simplewallet: do not suggest removing cache if the password was wrong (moneromooo-monero)
2016-08-22 22:54:22 +02:00
Riccardo Spagni
e152fd20e9 Merge pull request #964
2a2b655 Build: make boost 1.58 minimum requirement. Fixes #956 (anonimal)
2016-08-22 22:52:51 +02:00
Jacob Torrey
00bcae4cfe README formatting
Very slight changes to make the markdown slightly more readable and easy to copy/paste from.
2016-08-22 14:37:14 -06:00
Ilya Kitaev
cbe534db1a libwallet_api: tests: removed logged passwords 2016-08-22 23:14:58 +03:00
Ilya Kitaev
b1a5a937ff libwallet_api: do not store wallet on close if status is not ok 2016-08-22 22:47:59 +03:00
redfish
23accbcca5 readme: format Windows deps as a list 2016-08-21 12:35:24 -04:00
redfish
fcd895051a readme: formatting for rlwrap command snippet 2016-08-21 12:31:43 -04:00
moneromooo-monero
c2f4e16c59 simplewallet: default to max-concurrency 1 on MacOS X
A suspected bug in pthread/kernel, though might be that
I messed something up too...

This might rope in more platforms though.
2016-08-21 12:26:29 +01:00
redfish
d3363d573e readme: add deps for documentation 2016-08-20 12:12:39 -04:00
redfish
5018dfb79a readme: add deps: miniupnpc and libunwind
miniupnpc is included in source repo, but list it anyway, eventually
that fork will hopefully go away from this repo.
2016-08-20 12:11:07 -04:00
redfish
2b8a1eb9cb readme: add pkg-config dep 2016-08-20 12:04:04 -04:00
redfish
a29b196eeb readme: decrease size of sponsor logos 2016-08-20 01:46:08 -04:00
redfish
556998643c readme: format dependencies into a list #951 2016-08-20 01:00:41 -04:00
redfish
837baf57f8 readme: clarify conf syntax re leading dashes 2016-08-20 00:49:10 -04:00
redfish
2c5e68fb73 cmake: fix typo in handling of STACK_TRACE
This fixes the log output not getting redirected to log file.
2016-08-19 23:38:44 -04:00
moneromooo-monero
25f529aa67 wallet: store key images after importing them
It avoids rescan_spent resetting spent status, for example.
2016-08-17 08:37:56 +01:00
moneromooo-monero
9cca53ac29 wallet: fix build on Mac and Windows (missing include)
Reported by RaskaRuby, tested by iDunk5400.
2016-08-17 08:08:49 +01:00
moneromooo-monero
e596e25367 simplewallet: do not suggest removing cache if the password was wrong 2016-08-16 23:15:35 +01:00
anonimal
2a2b6550ad Build: make boost 1.58 minimum requirement. Fixes #956 2016-08-16 12:59:15 +00:00
Riccardo Spagni
63ba2447e2 Merge pull request #963
44dab04 Build: use libstdc++ with clang < 3.7 (anonimal)
455ded4 Build: use Boost 1.58 for Travis build. Refs #956 (anonimal)
2016-08-16 14:40:51 +02:00
Riccardo Spagni
40e8c6c403 Merge pull request #959
7e4e002 daemon: print time to next fork (moneromooo-monero)
2016-08-16 14:40:32 +02:00
anonimal
44dab04d88 Build: use libstdc++ with clang < 3.7 2016-08-16 12:04:05 +00:00
anonimal
455ded454d Build: use Boost 1.58 for Travis build. Refs #956 2016-08-15 16:28:08 +00:00
moneromooo-monero
7e4e0021f4 daemon: print time to next fork 2016-08-12 20:32:23 +01:00
Riccardo Spagni
45f4ef7a6d Merge pull request #955
7442dd0 More for Issue #855 (Howard Chu)
2016-08-11 22:44:29 +02:00
Riccardo Spagni
0faf572db8 Merge pull request #948
11dc091 Fake outs set is now decided by the wallet (moneromooo-monero)
1593553 new unlocked parameter to output_histogram (moneromooo-monero)
2016-08-11 22:43:14 +02:00
Howard Chu
7442dd084a More for Issue #855
Plug rpage leak in cursor_set
2016-08-11 21:04:36 +01: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
Riccardo Spagni
cb17c4da4f Merge pull request #953
240864f db_lmdb: errors dropping hf starting height db on reset are not fatal (moneromooo-monero)
2016-08-11 14:58:04 +02:00
Riccardo Spagni
b026650be9 Merge pull request #952
709c724 Better fix (#4) (hyc)
d2644c1 fix restore-deterministic height (luigi1111)
2016-08-11 14:57:33 +02:00
Riccardo Spagni
9273899ee7 Merge pull request #949
da1007f simplewallet: make the refresh thread into more generic idle thread (moneromooo-monero)
2016-08-11 14:56:40 +02:00
Riccardo Spagni
d46a58dab0 Merge pull request #947
663fc32 wallet2: if importing key images fails, print failure index (moneromooo-monero)
2016-08-11 14:53:16 +02:00
Riccardo Spagni
8d098610a7 Merge pull request #943
f0c0a3f Fix #864 Squashed commit of the following: commit 9af9e4223b     fixed some formatting commit c7920e1cf8 Merge: 97eb28b 1da1c68     fix#864 fix using boolean commit 97eb28ba5d     Fix #864 boolean value used to verify on new wallet commit 1da1c68bd3     fix #864 changed to boolean to prompt for verify commit 5bee966524     fix 864; made variable names easier for understanding branching. commit 45715960d3     fix #864;  allow password to be entered twice for new wallets for verification. fix #864 password entry verification; ammended boolean fix #864 ; default constructor for password_container should set verify=true (guzzi_jones)
2016-08-11 14:52:53 +02:00
Riccardo Spagni
66f89797e0 Merge pull request #940
e890f51 Build: take out tests in Travis CI (anonimal)
198e408 Build: add vanilla clang to Travis CI (anonimal)
659bee6 Build: add make release-test to Travis CI (anonimal)
2016-08-11 14:52:33 +02:00
Riccardo Spagni
f003315563 Merge pull request #939
33b5ebd cmake: do not pass -O2 in debug build on ARM (redfish)
35dc40a cmake: libatomic only needed for 32-bit Clang builds (redfish)
042db0b cmake: cleanup logic that sets flags per target/subdir (redfish)
2016-08-11 14:49:39 +02:00
moneromooo-monero
240864f529 db_lmdb: errors dropping hf starting height db on reset are not fatal
This db is now dropped unconditionally, so may or may not be there
in the first place.
2016-08-10 10:50:17 +01:00
hyc
709c7247cd Better fix (#4) 2016-08-09 18:54:20 -05:00
luigi1111
d2644c15c3 fix restore-deterministic height
Simplewallet improperly skipped the restore from height code if
restoring a deterministic wallet AND not specifying a wallet file in the
command line. The other generate options require a wallet file as an
argument, which prevents "ask_wallet_create_if_needed()" from being
called, which in turn causes "m_generate_new" to remain unset.
Specifying a wallet file at launch with --restore-deterministic emulated
this behavior.
2016-08-09 17:46:49 -05:00
moneromooo-monero
da1007f7cd simplewallet: make the refresh thread into more generic idle thread 2016-08-07 16:08:50 +01:00
moneromooo-monero
663fc32809 wallet2: if importing key images fails, print failure index 2016-08-04 08:19:29 +01:00
redfish
33b5ebd055 cmake: do not pass -O2 in debug build on ARM
Also, minor cleanup of redundant flag-setting code.
2016-08-01 22:03:53 -04:00
moneromooo-monero
1593553e03 new unlocked parameter to output_histogram
This constrains the number of instances of any amount
to the unlocked ones (as defined by the default unlock time
setting: outputs with non default unlock time are not
considered, so may be counted as unlocked even if they are
not actually unlocked).
2016-08-01 22:16:00 +01:00
guzzi_jones
f0c0a3fb65 Fix #864
Squashed commit of the following:
commit 9af9e4223b
    fixed some formatting
commit c7920e1cf8
Merge: 97eb28b 1da1c68
    fix#864 fix using boolean
commit 97eb28ba5d
    Fix #864 boolean value used to verify on new wallet
commit 1da1c68bd3
    fix #864 changed to boolean to prompt for verify
commit 5bee966524
    fix 864; made variable names easier for understanding branching.
commit 45715960d3
    fix #864;  allow password to be entered twice for new wallets for verification.
fix #864 password entry verification; ammended boolean
fix #864 ; default constructor for password_container should set verify=true
2016-08-01 02:32:14 +00:00
anonimal
e890f51b15 Build: take out tests in Travis CI 2016-07-30 00:09:37 +00:00
anonimal
198e40816d Build: add vanilla clang to Travis CI 2016-07-29 22:29:02 +00:00
anonimal
659bee6ada Build: add make release-test to Travis CI 2016-07-29 17:10:37 +00:00
redfish
35dc40af42 cmake: libatomic only needed for 32-bit Clang builds 2016-07-28 23:26:51 -04:00
redfish
042db0bd0f cmake: cleanup logic that sets flags per target/subdir
The previous logic that used a COMMON_*_FLAGS intermediate variable
and then re-assigned CMAKE_*_FLAGS before including each subdirectory
was confusing and ugly. This PR is the right way to do it.

This commit is purely refactoring: built binaries unchanged.
2016-07-28 21:20:50 -04:00
Riccardo Spagni
0fbe9cfcdb Merge pull request #937
0f990d0 cmake,common: flag for stack trace (redfish)
2016-07-27 11:07:38 +02:00
Riccardo Spagni
72f2934e20 Merge pull request #936
4618873 tests: fix a bitflag test typo (moneromooo-monero)
89e68d7 unit_tests: check adding checkpoints succeeded (moneromooo-monero)
121165f db_lmdb: add some missing api call checks (moneromooo-monero)
22d8344 core_rpc_server: fix gray/white peer list mixup (moneromooo-monero)
2016-07-27 11:06:57 +02:00
redfish
0f990d0183 cmake,common: flag for stack trace
By default the flag is enabled whenever libunwind is found on the
system, with the exception of static build on OSX (for which we can't
install the throw hook #932 due to lack of support for --wrap in OSX
ld64 linker).
2016-07-27 01:52:33 -04:00
moneromooo-monero
46188734f6 tests: fix a bitflag test typo 2016-07-26 22:40:46 +01:00
moneromooo-monero
89e68d778d unit_tests: check adding checkpoints succeeded 2016-07-26 22:40:38 +01:00
moneromooo-monero
121165f222 db_lmdb: add some missing api call checks 2016-07-26 22:39:51 +01:00
moneromooo-monero
22d8344cb5 core_rpc_server: fix gray/white peer list mixup 2016-07-26 20:02:43 +01:00
Riccardo Spagni
b34506da81 Merge pull request #928
ebf97d7 wallet: new {ex,im}port_key_images commands and RPC calls (moneromooo-monero)
2016-07-26 08:55:25 +02:00
Riccardo Spagni
1daef32844 Merge pull request #931
b3801fa hardfork: fix off by one in rescaning fork state after restart (moneromooo-monero)
2016-07-26 08:54:23 +02:00
Riccardo Spagni
9565d3ffbc Merge pull request #934
4b3a788 cmake: install throw hook in OSX build too (redfish)
3c92c2f cmake: do not install hook on throw when building tests (redfish)
2016-07-26 08:53:20 +02:00
redfish
4b3a7885ac cmake: install throw hook in OSX build too
This is an attempt to fix build with STATIC=ON on OSX (#932):

[ 95%] Linking CXX executable ../../bin/bitmonerod Undefined symbols for
architecture x86_64: "___real___cxa_throw", referenced from:
___wrap___cxa_throw in libcommon.a(stack_trace.cpp.o) ld: symbol(s) not found
for architecture x86_64
2016-07-26 02:30:59 +00:00
redfish
3c92c2f096 cmake: do not install hook on throw when building tests
This fixes build of tests with STATIC=ON, which failed with:

/tmp/cc8lNtqY.ltrans12.ltrans.o: In function
`boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::thread_resource_error>
>::rethrow() const [clone .lto_priv.41]':
cc8lNtqY.ltrans12.o:(.text+0x4e): undefined reference to `__wrap___cxa_throw'

The hook is implemented in libcommon, which is not linked into some of the test
binaries.  An alternative solution is to link all tests against libcommon,
but that seems worse because it introduces a false dependency (also,
I tried that and for some of the test binaries the linker still failed to
pick up the symol from libcommon, strangely.)
2016-07-26 02:20:16 +00: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
Riccardo Spagni
a834105bed Merge pull request #927
8bed9a4 cmake: wallet: libunbound is not always static (redfish)
2016-07-24 20:41:22 +02:00
moneromooo-monero
ebf97d76f0 wallet: new {ex,im}port_key_images commands and RPC calls
They are used to export a signed set of key images from a wallet
with a private spend key, so an auditor with the matching view key
may see which of those are spent, and which are not.
2016-07-24 09:23:30 +01:00
redfish
8bed9a42f7 cmake: wallet: libunbound is not always static
It is not clear why libunbound was added to this in the first place,
since it wasn't here before and #915 doesn't seem to introduce any
new dependency on it.

Tested build with STATIC=OFF (with and without libunbound-dev libunbound8
installed) and STATIC=ON, on Ubuntu Trusty, Debian Jessie, and Arch
Linux. For static builds, beware of #926 and #907.

If this hack was introduced to make it build on some other system
(Windows? OS X?), then it will have to be dealt with, but not this way.
2016-07-23 15:04:15 -04:00
Riccardo Spagni
47618c2710 Merge pull request #923
8312887 simplewallet: suggest removing cache when loading fails (moneromooo-monero)
2016-07-23 09:20:18 +02:00
Riccardo Spagni
07f974a499 Merge pull request #916
b89b963 wallet: add unconfirmed incoming txes from the txpool (moneromooo-monero)
2016-07-23 09:19:39 +02:00
Riccardo Spagni
b582764bd6 Merge pull request #915
d7597c5 refreshing wallet even if error happened (Ilya Kitaev)
6d32a3d wallet_api: async init, Wallet::connected status, log level (Ilya Kitaev)
193d251 libwallet_api cmake: conditionally creating libwallet_merged2 only for STATIC build (Ilya Kitaev)
10c06dd wallet_api: segfault on refresh fixed (Ilya Kitaev)
9d2cb4f WalletListener functionality (Ilya Kitaev)
d27b883 hack to successfull linking for MSYS2 (Ilya Kitaev)
083380c Transaction fee multiplier aka priority integraged (Ilya Kitaev)
00ed12b Wallet::paymentIdValid (Ilya Kitaev)
2016-07-23 09:17:21 +02:00
Riccardo Spagni
90f2e19d51 Merge pull request #910
080a606 simplewallet: revert to foreground refresh at startup (moneromooo-monero)
2016-07-23 09:13:15 +02:00
Riccardo Spagni
d4af91134c Merge pull request #886
dca9fe1 cmake: do not pass -Werror when building tests (redfish)
2016-07-23 09:11:24 +02:00
Riccardo Spagni
28f9348fea Merge pull request #920
ca33ce6 include result in the notifications template (Riccardo Spagni)
2a8352d only alert on IRC when the status changes (Riccardo Spagni)
6b6fb7f add IRC notifications to travis (Riccardo Spagni)
2016-07-23 09:10:15 +02:00
Riccardo Spagni
ca33ce6458 include result in the notifications template 2016-07-23 09:09:40 +02:00
Riccardo Spagni
2a8352db2e only alert on IRC when the status changes 2016-07-23 09:05:30 +02:00
Riccardo Spagni
3720c27b7d Merge pull request #924
61ed40a Tests: fix signed/unsigned comparison in hash-target (anonimal)
2016-07-23 09:03:55 +02:00
redfish
dca9fe175c cmake: do not pass -Werror when building tests
The tests currently issue a warning that
"warning: -fassociative-math disabled; other options take precedence"

The associative math optimization is turned on indirectly by -Ofast.
Apparently, the optimization is forced to be disabled, while compiling
test harnesses generated by Google Test framework.

Unfortunately, there is no -Wno-error=* flag to disable this warning
(see gcc --help=warnings).

An alternative to this patch is to disable the optimization explicitly
with -fno-associative-math, but that seems worse.

Another alternative is to not pass -Ofast for tests build, but we
want the tests to be built with exact same optimization flags as
the code being tested, otherwise the value of the tests is diminished.

Another alternative is to remove -Werror from the entire build, but
it's good to include that flag to preclude people leaving warnings.

A note regarding implementation of not passing -Werror for tests:
I considered filtering out -Werror from CMAKE_{C,CXX}_FLAGS but
that seems to be worse because it's surprizing behavior, to those
reading the code that adds -Werror. It is better to add it for
when it is used and not added otherwise. I also considered relying
on order, adding -Werror after inluding 'tests' subdir, but before
including the other subdirs, but that also seems cryptic to the
reader. So, I settled with the current solution, of explicitly
setting CMAKE_{C,CXX}_FLAGS to different values before including the
respective subdir.

Testing done: compared compiler invocation for non-tests source files
using `make VERBOSE=1` with and without this commit: the only difference
is the position of -Werror. So, this commit doesn't change the binary.
2016-07-22 18:08:33 -04:00
anonimal
61ed40a618 Tests: fix signed/unsigned comparison in hash-target
* References #886
2016-07-22 22:05:35 +00:00
moneromooo-monero
83128877e0 simplewallet: suggest removing cache when loading fails 2016-07-22 17:31:52 +01:00
moneromooo-monero
b89b96394a wallet: add unconfirmed incoming txes from the txpool
Shown in show_transfers simplewallet command, and get_transfers
RPC command, if req.pool is true.
2016-07-20 19:14:44 +01:00
moneromooo-monero
080a60610f simplewallet: revert to foreground refresh at startup
Background refresh is confusing to users at startup.
2016-07-20 19:09:32 +01:00
Riccardo Spagni
6b6fb7f7d0 add IRC notifications to travis 2016-07-20 14:50:44 +02:00
Riccardo Spagni
38e5156392 Merge pull request #914
87b1153 wallet2_api: use uint64_t for amounts (moneromooo-monero)
2016-07-20 14:29:33 +02:00
Riccardo Spagni
c6c761c45c Merge pull request #919
48e14ef fix atomic library to only fire off for clang (Riccardo Spagni)
39f7fad fix duplicate clang block in cmake (Riccardo Spagni)
2016-07-20 14:29:01 +02:00
Riccardo Spagni
2b1c4a9f64 Merge pull request #918
b249482 Docs: fix 'Development Resources' formatting in README. (anonimal)
2016-07-20 14:28:09 +02:00
Riccardo Spagni
48e14ef66c fix atomic library to only fire off for clang 2016-07-20 14:25:59 +02:00
Riccardo Spagni
39f7fad71d fix duplicate clang block in cmake 2016-07-20 14:24:50 +02:00
anonimal
b249482e1e Docs: fix 'Development Resources' formatting in README. 2016-07-20 12:22:17 +00:00
Riccardo Spagni
8e143fcf1d Merge pull request #911
d7b681c remove hf_starting_height db (moneromooo-monero)
2016-07-20 14:01:27 +02:00
Riccardo Spagni
b52b2ed00b Merge pull request #917
ea44142 change travis badge (Riccardo Spagni)
2016-07-20 14:00:23 +02:00
Riccardo Spagni
ea44142d2f change travis badge 2016-07-20 13:59:47 +02:00
Riccardo Spagni
c20a6d9069 Merge pull request #909
bbba197 Docs: update 'Development Resources' in README. (anonimal)
2feb94b Travis-CI: add build-status badge to README.md (anonimal)
f025622 Travis-CI: remote redundant make release-test. (anonimal)
b332da3 Travis-CI: implement first-draft configuration. (anonimal)
2016-07-20 13:57:25 +02:00
Riccardo Spagni
77015e8132 Merge pull request #904
f07f120 cmake: don't try to link with atomic on Apple (redfish)
19349d7 cmake: ARM: clang: make warning non-fatal: inline asm (redfish)
f3e09f3 cmake: link with -latomic for clang (redfish)
f4b35ae cmake: include -ldl via cmake built-in var (redfish)
fa85cd8 common: stack trace: make clang happy with func ptrs (redfish)
4dce26b cmake: do not pass -stdlib=c++ to clang >=3.7 (redfish)
2016-07-20 13:56:59 +02:00
Riccardo Spagni
fc3e135b83 Merge pull request #902
014f3a0 Add a daemon RPC version, and make simplewallet check it (moneromooo-monero)
2016-07-20 13:55:59 +02:00
Riccardo Spagni
b1bec02ce5 Merge pull request #900
78cc10f daemon: fix ban seconds being misinterpreted as absolute (moneromooo-monero)
34ecfdb rpc: fix get_bans and set_bans RPC names, they were missing a _ (moneromooo-monero)
2016-07-20 13:53:25 +02:00
Riccardo Spagni
07f1d4e04d Merge pull request #899
a95a2cb wallet_rpc_server: add payment id from integrated addresses to extra (moneromooo-monero)
2016-07-20 13:52:54 +02:00
Riccardo Spagni
992b6cce06 Merge pull request #897
ce6b831 daemonizer: posix: keep parent's working dir and umask (redfish)
2016-07-20 13:52:27 +02:00
Riccardo Spagni
255ff79416 Merge pull request #896
1e89f4f cmake: do not ignore dangerous warnings with -Wno-error (redfish)
2016-07-20 13:51:54 +02:00
Riccardo Spagni
83ccaf316d Merge pull request #887
ab25075 cmake: pass -fno-strict-aliasing to fix build with GCC 6.1.1 (redfish)
2016-07-20 13:51:27 +02:00
Riccardo Spagni
77e1d8774a Merge pull request #818
89d9f38 wallet: add command and RPC to sign/verify data (moneromooo-monero)
2016-07-20 13:50:41 +02:00
moneromooo-monero
89d9f382a0 wallet: add command and RPC to sign/verify data
Signing is done using the spend key, since the view key may
be shared. This could be extended later, to let the user choose
which key (even a per tx key).
simplewallet's sign/verify API uses a file. The RPC uses a
string (simplewallet can't easily do strings since commands
receive a tokenized set of arguments).
2016-07-19 20:39:03 +01:00
Ilya Kitaev
d7597c5961 refreshing wallet even if error happened 2016-07-18 23:03:09 +03:00
Ilya Kitaev
6d32a3d16b wallet_api: async init, Wallet::connected status, log level 2016-07-18 23:03:09 +03:00
Ilya Kitaev
193d251360 libwallet_api cmake: conditionally creating libwallet_merged2 only for
STATIC build
2016-07-18 23:03:09 +03:00
Ilya Kitaev
10c06ddac7 wallet_api: segfault on refresh fixed 2016-07-18 23:03:09 +03:00
Ilya Kitaev
9d2cb4f36c WalletListener functionality 2016-07-18 23:02:47 +03:00
Ilya Kitaev
d27b883b2d hack to successfull linking for MSYS2 2016-07-18 23:02:47 +03:00
Ilya Kitaev
083380cb8f Transaction fee multiplier aka priority integraged 2016-07-18 23:02:18 +03:00
Ilya Kitaev
00ed12bd6c Wallet::paymentIdValid 2016-07-18 23:02:18 +03:00
moneromooo-monero
87b1153f37 wallet2_api: use uint64_t for amounts 2016-07-17 09:33:31 +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
anonimal
bbba197cc9 Docs: update 'Development Resources' in README.
* Branch development was recently removed.
  All PR's now go directly to master.
* Also, removed EOL whitespace
2016-07-13 02:07:20 +00:00
anonimal
2feb94b44d Travis-CI: add build-status badge to README.md
* Currently points to anonimal/bitmonero.
  This should be changed to monero-project/bitmonero
  once the project signs-up for Travis-CI.
2016-07-13 01:43:31 +00:00
anonimal
f025622ff2 Travis-CI: remote redundant make release-test. 2016-07-13 00:45:06 +00:00
anonimal
b332da3e9a Travis-CI: implement first-draft configuration. 2016-07-12 23:33:57 +00:00
redfish
f07f120e5d cmake: don't try to link with atomic on Apple
-latomic is necessary with Clang on Linux, but
apparently, on OSX it's not found.
2016-07-12 00:25:56 -04:00
redfish
19349d7870 cmake: ARM: clang: make warning non-fatal: inline asm
Clang issues a warning for some inline asm in stack_trace.cpp.  This
patch ieaves the warning to be displayed as a reminder to fix
the code.
2016-07-10 21:27:00 -04:00
redfish
f3e09f36d3 cmake: link with -latomic for clang
otherwise clang build fails with

../cryptonote_core/libcryptonote_core.a(miner.cpp.o): In function
`std::__atomic_base<unsigned long long>::load(std::memory_order) const':
/usr/bin/../lib/gcc/i686-pc-linux-gnu/6.1.1/../../../../include/c++/6.1.1/bits/atomic_base.h:396:
undefined reference to `__atomic_load_8'

This has no effect on the gcc build.

The one strange thing is that test code like

std::atomic<int> x;
int main() { return x; }

compiles and links without errors with clang, without -latomic.  This
alone would suggest that this patch is unnecessary, but that is not the
case. It's not clear exactly why, though. The bitmonero code is
including the same header, but it must be doing something more complex
than in this test code snippet that causes the failure at link time
pasted above. In any case, passing -latomic fixes the problem and
seems safe.

.
2016-07-10 21:27:00 -04:00
redfish
f4b35aeafd cmake: include -ldl via cmake built-in var
This does two things:
1. fixes clang build, which otherwise errors with undefined symbol
'dlsym'.
2. simplifies the cmake script, delegating to cmake to figure
   out platform-specific flags for linking against the dl library.
2016-07-10 21:27:00 -04:00
redfish
fa85cd845f common: stack trace: make clang happy with func ptrs
Tested that it builds with:
gcc 6.1.1, STATIC=OFF,i686
gcc 6.1.1, STATIC=OFF,armv7h
clang 3.8, STATIC=OFF,i686
clang 3.8, STATIC=OFF,armv7h

gcc 6.1.1, STATIC=ON,i686
clang 3.8, STATIC=ON,i686

Also tested that stack trace is generated fine on exception on:
i686, gcc 6.1.1, STATIC=OFF
(didn't bother testing all the other platforms/configs)

This should fix the build problem on OSX (#871, #901), but
I don't have OSX, so I could only test Clang on Linux.
2016-07-10 21:26:11 -04:00
redfish
4dce26bba4 cmake: do not pass -stdlib=c++ to clang >=3.7
Tested on Linux (Arch) with clang 3.7 and 3.8 i686 and ARM:
if -stdlib=c++ is passed to clang, then the build errors
out with <string>,<iostrea>,etc. headers not found. Simply
not passing the arg fixes the problem.

**NOTE**: not tested on OSX.
2016-07-10 21:19:16 -04:00
moneromooo-monero
014f3a0d39 Add a daemon RPC version, and make simplewallet check it
If the version is different, simplewallet will refuse to use that
daemon, unless --allow-mismatched-daemon-version is used.
2016-07-10 16:49:40 +01:00
moneromooo-monero
78cc10f3fa daemon: fix ban seconds being misinterpreted as absolute
Absolute to relative conversion is already done by the callee.
2016-07-10 15:13:53 +01:00
moneromooo-monero
34ecfdbf15 rpc: fix get_bans and set_bans RPC names, they were missing a _ 2016-07-10 15:10:51 +01:00
moneromooo-monero
a95a2cbc4d wallet_rpc_server: add payment id from integrated addresses to extra 2016-07-10 13:46:18 +01:00
redfish
ce6b83128e daemonizer: posix: keep parent's working dir and umask
Keep the working directory (and umask) inherited from
the parent. Otherwise, it's impossible to control
the working directory of the daemon (from systemd, for
example).

Furthermoer, bitmonerod attempts to create logging directories and files
*in current working directory*. This fails due to permission denied and
generates a (caught, nonfatal) exception. Below is the strace with this
patch applied (so, no `chdir("/")`), showing successful opens at `log/`
relative path. Without this patch they fail (sorry, didn't save the
trace).

```
28911 getcwd("/.../bitmonero", 128) = 25
28911 stat64("/var/lib/bitmonero/.bitmonero", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
28911 stat64("/etc/bitmonerod.conf", {st_mode=S_IFREG|0644, st_size=244, ...}) = 0
28911 open("/etc/bitmonerod.conf", O_RDONLY|O_LARGEFILE) = 3
28911 open("/var/log/bitmonero/bitmonero.log", O_WRONLY|O_CREAT|O_APPEND|O_LARGEFILE, 0666) = 3
28911 stat64("log", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
28911 stat64("log/dbg", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
28911 open("log/dbg/main.log", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 4
```
The reasoning of chdir("/") in order to prevent the daemon from holding
a filesystem in busy state is not compelling at all: the choice of
working directory for the daemon is the user's business not the
daemon's.
2016-07-09 20:16:44 -04:00
redfish
1e89f4f2c5 cmake: do not ignore dangerous warnings with -Wno-error
Shorten the list of warnings that are reported, but
which are forced to NOT generate an error, via -Wno-error.

Unwhitelist these: strict-aliasing, sign-compare, type-limits

For example, ignoring strict-aliasing warning caused
lots of wasted time diagnosing Issue #847.
2016-07-09 11:59:07 -04:00
redfish
ab250754f2 cmake: pass -fno-strict-aliasing to fix build with GCC 6.1.1
This patch is a temprorary workaround until aliasing is fixed in the
code (Issue #847).
2016-07-08 21:42:05 -04:00
Riccardo Spagni
18dd507024 Merge pull request #889
a0bf85d wallet2_api: make this build (smatch needs .str() for /=) (moneromooo-monero)
2016-07-08 23:00:38 +02:00
moneromooo-monero
a0bf85d09d wallet2_api: make this build (smatch needs .str() for /=) 2016-07-07 22:42:59 +01:00
Riccardo Spagni
59172156bf Merge pull request #885
b727a1f updated README to reflect Windows changes (Riccardo Spagni)
2016-07-06 18:22:16 +02:00
Riccardo Spagni
18fa01c092 Merge pull request #884
c2ad9ca allow peers without port (moneromooo-monero)
2016-07-06 18:20:17 +02:00
Riccardo Spagni
1088ed862b Merge pull request #883
459ec60 daemon: print exception errors when failing to parse config file (moneromooo-monero)
2016-07-06 18:19:40 +02:00
Riccardo Spagni
0b65717a5d Merge pull request #882
f11191a rpc: restrict number of fake outs requested in restricted rpc mode (moneromooo-monero)
2016-07-06 18:17:08 +02:00
Riccardo Spagni
00fd89a36d Merge pull request #879
6b08001 simplewallet: mention the background refresh thread when starting (moneromooo-monero)
2016-07-06 18:15:36 +02:00
Riccardo Spagni
3923cbddaf Merge pull request #878
945c272 wallet: add a fee multiplier (moneromooo-monero)
2016-07-06 18:14:34 +02:00
Riccardo Spagni
65df33fb06 Merge pull request #877
ecd0f2d makefile: remove unnecessary ARM-specific targets (redfish)
c650160 cmake: disable AES on ARM (redfish)
804b1bc cmake: initialize ARCH for native builds (redfish)
bb39034 cmake: remove repetitive code in handling of NO_AES (redfish)
2016-07-06 18:14:03 +02:00
Riccardo Spagni
c9f66dfaba Merge pull request #876
72287d1 contrib: epee: add missing noexcept spec to class decl (redfish)
2016-07-06 18:13:28 +02:00
Riccardo Spagni
160e808796 Merge pull request #875
14f7538 readme: move license to separate file for packaging (redfish)
2016-07-06 18:12:53 +02:00
Riccardo Spagni
628f57b212 Merge pull request #873
d718960 remove POSIX_C_SOURCE and remove dlfcn.h for static builds (luigi1111)
2016-07-06 18:12:03 +02:00
Riccardo Spagni
fc58069731 Merge pull request #872
beb6d92 CMake: GPL 'libutils' script removed (Ilya Kitaev)
4e5521d PendingTransactionImpl: pointer->reference (Ilya Kitaev)
7b7cf21 commented regex (Ilya Kitaev)
eec0f57 Typo fixed (Ilya Kitaev)
f1c4a37 Wallet::createTransaction: added mixin_count param (Ilya Kitaev)
3318add double/string to monero integer convertion methods (Ilya Kitaev)
3ac20a4 wallet::default_mixin exposed to public interface as Wallet::setDefaultMixin, Wallet::defaultMixin; wallet::create_transaction_2 used in Wallet::createTransaction (Ilya Kitaev)
c554055 Wallet::filename, Wallet::keysFilename, tests for move wallet (Ilya Kitaev)
8f9d98b removed unused "using" (Ilya Kitaev)
2facbe7 Wallet API : WalletManager::findWallets() added (Ilya Kitaev)
ec949c3 scripts for faster test wallets generation (Ilya Kitaev)
7f3d28f regenerated test wallets, basic functions got broken (Ilya Kitaev)
4327548 installing wallet_api header (Ilya Kitaev)
7ac1342 cmake: BUILD_TESTS as option explicitly; added missed dependency (Ilya Kitaev)
1f0d016 cmake libutils dependency added (Ilya Kitaev)
d43ad22 all wallet dependencies merged to single static lib (Ilya Kitaev)
9ae4e87 WalletListener::moneyReceived test (Ilya Kitaev)
40087a7 WalletListener::moneySpent test (Ilya Kitaev)
27d86b7 WalletListener::moneySpent(), WalletListener::moneyReceived() (Ilya Kitaev)
ff52c67 i_wallet_callback: virtual dtor (Ilya Kitaev)
5dbd2b8 started WalletListener (Ilya Kitaev)
71131a8 TransactionHistory continued (Ilya Kitaev)
9311934 TransactionHistory continued (Ilya Kitaev)
566166a merged with upstream (Ilya Kitaev)
53a97bd Wallet API: transaction history in progress (Ilya Kitaev)
02c9df5 Wallet API : transaction history in progress (Ilya Kitaev)
a213887 transaction history api in progress (Ilya Kitaev)
b6aaf53 transaction history api in progress (Ilya Kitaev)
f83f3cb api implementation splitted over separate files (Ilya Kitaev)
4e1c2dc TransactionInfo / TransactionHistory APIs design (Ilya Kitaev)
1774d95 TODOs for Transaction/Transfer interface (Ilya Kitaev)
d97e9ef Transaction API continued (Ilya Kitaev)
079fbd3 Wallet::createTransaction API introduced (Ilya Kitaev)
ee5bb17 Wallet::transfer() continued (Ilya Kitaev)
c37c856 Wallet::transfer in progress (Ilya Kitaev)
830c19c Wallet::refresh + tests (Ilya Kitaev)
1ae9cdc "testnet" is default parameter (Ilya Kitaev)
2157a9a testnet option, Wallet::balance(), Wallet::unlockedBalance() (Ilya Kitaev)
8790904 - testnet option added to api; (Ilya Kitaev)
2cce329 wallet2::store() implemented within wallet2::store_to (Ilya Kitaev)
d608647 WalletManager::findWallets: searching by "keys" files instead of "address.txt" files (Ilya Kitaev)
ca61153 Wallet: payment id and integrated address (Ilya Kitaev)
23cbf6f PendingTransactionImpl: pointer->reference (Ilya Kitaev)
c1d9e7c commented regex (Ilya Kitaev)
563baf1 Typo fixed (Ilya Kitaev)
2efec04 Wallet::createTransaction: added mixin_count param (Ilya Kitaev)
85a6322 double/string to monero integer convertion methods (Ilya Kitaev)
e7d8f2a wallet::default_mixin exposed to public interface as Wallet::setDefaultMixin, Wallet::defaultMixin; wallet::create_transaction_2 used in Wallet::createTransaction (Ilya Kitaev)
a537489 Wallet::filename, Wallet::keysFilename, tests for move wallet (Ilya Kitaev)
a1eddcd removed unused "using" (Ilya Kitaev)
8390bfa Wallet API : WalletManager::findWallets() added (Ilya Kitaev)
44cc0ef scripts for faster test wallets generation (Ilya Kitaev)
2060bfe regenerated test wallets, basic functions got broken (Ilya Kitaev)
dbc0b03 installing wallet_api header (Ilya Kitaev)
653c7e3 cmake: BUILD_TESTS as option explicitly; added missed dependency (Ilya Kitaev)
ef9a74c cmake libutils dependency added (Ilya Kitaev)
191cb59 all wallet dependencies merged to single static lib (Ilya Kitaev)
91eeeb8 WalletListener::moneyReceived test (Ilya Kitaev)
64348a2 WalletListener::moneySpent test (Ilya Kitaev)
060bb62 WalletListener::moneySpent(), WalletListener::moneyReceived() (Ilya Kitaev)
214014c i_wallet_callback: virtual dtor (Ilya Kitaev)
3745770 started WalletListener (Ilya Kitaev)
e6fdd5d TransactionHistory continued (Ilya Kitaev)
3dd4b4c merged with upstream (Ilya Kitaev)
d500272 Wallet API : transaction history in progress (Ilya Kitaev)
663ed04 transaction history api in progress (Ilya Kitaev)
12345d3 api implementation splitted over separate files (Ilya Kitaev)
60508e6 TransactionInfo / TransactionHistory APIs design (Ilya Kitaev)
951f3b5 Wallet::createTransaction API introduced (Ilya Kitaev)
7c51227 Wallet::transfer in progress (Ilya Kitaev)
e04c67a Wallet::refresh + tests (Ilya Kitaev)
9cdf0b7 "testnet" is default parameter (Ilya Kitaev)
caf0e02 testnet option, Wallet::balance(), Wallet::unlockedBalance() (Ilya Kitaev)
8df820b - testnet option added to api; (Ilya Kitaev)
94eaeb5 wallet2::store() implemented within wallet2::store_to (Ilya Kitaev)
2016-07-06 18:11:04 +02:00
Riccardo Spagni
b727a1ffbf updated README to reflect Windows changes 2016-07-03 16:42:26 +02:00
moneromooo-monero
c2ad9caf01 allow peers without port
The default port is then used
2016-07-03 12:51:12 +01:00
moneromooo-monero
459ec6040e daemon: print exception errors when failing to parse config file
When an exception happens while reading the config file, we need
to print the error, as the logging system isn't initialized yet,
so the generic catch will not print anything.
2016-06-30 22:15:40 +01:00
moneromooo-monero
f11191a818 rpc: restrict number of fake outs requested in restricted rpc mode 2016-06-29 20:43:14 +01:00
Ilya Kitaev
beb6d9200d CMake: GPL 'libutils' script removed 2016-06-24 14:49:23 +03:00
redfish
ecd0f2dde7 makefile: remove unnecessary ARM-specific targets
* NO_AES is determined automatically
* BUILD_64 is determined automatically
2016-06-23 17:01:31 -04:00
Ilya Kitaev
ab61ba0c9b Merge branch 'master' of https://github.com/mbg033/bitmonero 2016-06-23 16:23:09 +03:00
Ilya Kitaev
d60864785f WalletManager::findWallets: searching by "keys" files instead of
"address.txt" files
2016-06-23 16:01:41 +03:00
Ilya Kitaev
ca61153003 Wallet: payment id and integrated address 2016-06-23 16:01:41 +03:00
Ilya Kitaev
23cbf6fd97 PendingTransactionImpl: pointer->reference 2016-06-23 16:01:41 +03:00
Ilya Kitaev
c1d9e7cd2a commented regex 2016-06-23 16:01:41 +03:00
Ilya Kitaev
563baf1b68 Typo fixed 2016-06-23 16:01:41 +03:00
Ilya Kitaev
2efec04f74 Wallet::createTransaction: added mixin_count param 2016-06-23 16:01:41 +03:00
Ilya Kitaev
85a632244e double/string to monero integer convertion methods 2016-06-23 16:01:41 +03:00
Ilya Kitaev
e7d8f2a085 wallet::default_mixin exposed to public interface as
Wallet::setDefaultMixin, Wallet::defaultMixin;
wallet::create_transaction_2 used in Wallet::createTransaction
2016-06-23 16:01:41 +03:00
Ilya Kitaev
a5374897f8 Wallet::filename, Wallet::keysFilename, tests for move wallet 2016-06-23 16:01:41 +03:00
Ilya Kitaev
a1eddcd693 removed unused "using" 2016-06-23 16:01:41 +03:00
Ilya Kitaev
8390bfa770 Wallet API : WalletManager::findWallets() added 2016-06-23 16:01:41 +03:00
Ilya Kitaev
44cc0ef147 scripts for faster test wallets generation 2016-06-23 16:01:41 +03:00
Ilya Kitaev
2060bfe5ad regenerated test wallets, basic functions got broken 2016-06-23 16:01:41 +03:00
Ilya Kitaev
dbc0b039b4 installing wallet_api header 2016-06-23 16:01:33 +03:00
Ilya Kitaev
653c7e3804 cmake: BUILD_TESTS as option explicitly; added missed dependency 2016-06-23 16:01:33 +03:00
Ilya Kitaev
ef9a74c67e cmake libutils dependency added 2016-06-23 16:01:33 +03:00
Ilya Kitaev
191cb594de all wallet dependencies merged to single static lib 2016-06-23 16:01:33 +03:00
Ilya Kitaev
91eeeb8989 WalletListener::moneyReceived test 2016-06-23 16:01:33 +03:00
Ilya Kitaev
64348a2d11 WalletListener::moneySpent test 2016-06-23 16:01:33 +03:00
Ilya Kitaev
060bb62e29 WalletListener::moneySpent(), WalletListener::moneyReceived() 2016-06-23 16:01:33 +03:00
Ilya Kitaev
214014c048 i_wallet_callback: virtual dtor 2016-06-23 16:01:33 +03:00
Ilya Kitaev
374577018d started WalletListener 2016-06-23 16:01:33 +03:00
Ilya Kitaev
e6fdd5dd10 TransactionHistory continued 2016-06-23 16:01:26 +03:00
Ilya Kitaev
3dd4b4ccf9 merged with upstream 2016-06-23 15:50:40 +03:00
Ilya Kitaev
d500272fa8 Wallet API : transaction history in progress 2016-06-23 15:50:33 +03:00
Ilya Kitaev
663ed04eb8 transaction history api in progress 2016-06-23 15:50:17 +03:00
Ilya Kitaev
12345d382c api implementation splitted over separate files 2016-06-23 15:50:17 +03:00
Ilya Kitaev
60508e6bae TransactionInfo / TransactionHistory APIs design 2016-06-23 15:50:17 +03:00
Ilya Kitaev
951f3b5d83 Wallet::createTransaction API introduced
Transaction API continued

TODOs for Transaction/Transfer interface
2016-06-23 15:49:54 +03:00
Ilya Kitaev
7c51227f88 Wallet::transfer in progress 2016-06-23 15:49:36 +03:00
Ilya Kitaev
e04c67ac4c Wallet::refresh + tests 2016-06-23 15:49:36 +03:00
Ilya Kitaev
9cdf0b7d7f "testnet" is default parameter 2016-06-23 15:49:36 +03:00
Ilya Kitaev
caf0e02787 testnet option, Wallet::balance(), Wallet::unlockedBalance() 2016-06-23 15:49:22 +03:00
Ilya Kitaev
8df820b301 - testnet option added to api; 2016-06-23 15:49:07 +03:00
Ilya Kitaev
94eaeb50b2 wallet2::store() implemented within wallet2::store_to 2016-06-23 15:40:48 +03:00
moneromooo-monero
6b08001f9e simplewallet: mention the background refresh thread when starting
It should be less confusing for people who're used to the foreground
refresh from earlier versions.
2016-06-22 23:05:50 +01:00
moneromooo-monero
945c272f6c wallet: add a fee multiplier
Fee can now be multiplied by 2 or 3, if users want to give
priority to their transactions. There are only three levels
to avoid too much fingerprinting. Default is 1 (minimum fee).
The default multiplier can be set by "set fee-multiplier X".
2016-06-22 22:21:30 +01:00
redfish
72287d121a contrib: epee: add missing noexcept spec to class decl
The noexcept specs were added to make GCC 6.1.1 happy (#846), but this
one was missing (because GCC did not complain about it on Linux, but
does complain on OSX).
2016-06-22 09:05:53 -04:00
Ilya Kitaev
4e5521d87d PendingTransactionImpl: pointer->reference 2016-06-22 15:50:59 +03:00
Ilya Kitaev
7b7cf21644 commented regex 2016-06-22 15:06:19 +03:00
Ilya Kitaev
eec0f57d60 Typo fixed 2016-06-22 14:37:53 +03:00
redfish
c6501607f3 cmake: disable AES on ARM
On ARM, gcc fails with 'unknown argument' if passed '-maes'.
2016-06-21 22:32:55 -04:00
redfish
804b1bc197 cmake: initialize ARCH for native builds
We need ARCH, because it needs to be set for ARM7, ARM6 to be
initialized.

Strangely, on different machines (both ARMv7, Arch), ${ARCH}
var is either empty or 'native'. Handle both cases.
2016-06-21 22:32:16 -04:00
redfish
bb39034405 cmake: remove repetitive code in handling of NO_AES
Minor eefactor only. No behavior or interface change in this commit.
2016-06-21 19:53:07 -04:00
redfish
14f7538488 readme: move license to separate file for packaging 2016-06-21 19:06:53 -04:00
luigi1111
d7189600ae remove POSIX_C_SOURCE and remove dlfcn.h for static builds
The former was a faulty "fix" for gmtime_r not existing on Windows. The latter is needed only for dynamic builds, and is not included with msys2, which ends up fine because Windows is only built static at this time.
2016-06-21 11:16:25 -05:00
Riccardo Spagni
de91bb75a1 Merge pull request #870
57dce80 gmtime for Windows (luigi1111)
2016-06-21 09:32:32 +02:00
Riccardo Spagni
fd32a3b52a Merge pull request #869
03e545d More fixing for Windows (iDunk)
e8baa57 CMakeLists.txt: fix build for mingw (iDunk)
2016-06-21 09:32:12 +02:00
Riccardo Spagni
8c34cca0f0 Merge pull request #867
f0b85c1 simplewallet: add a status command (moneromooo-monero)
2016-06-21 09:31:50 +02:00
Riccardo Spagni
03477063ba Merge pull request #868
15c2b69 common: fix build without libunwind (moneromooo-monero)
f72388c CMakeLists: fix build without libunwind (moneromooo-monero)
2016-06-21 09:30:56 +02:00
luigi1111
57dce8083a gmtime for Windows
gmtime_r is not available in Windows, use gmtime_s instead. Also change shorthand codes (also not working in Windows).
2016-06-20 18:14:12 -05:00
iDunk
03e545d323 More fixing for Windows 2016-06-20 22:38:36 +01:00
iDunk
e8baa57326 CMakeLists.txt: fix build for mingw
Fix from iDunk from IRC.
2016-06-20 21:39:13 +01:00
Ilya Kitaev
f1c4a376af Wallet::createTransaction: added mixin_count param 2016-06-20 22:56:30 +03:00
moneromooo-monero
15c2b69db7 common: fix build without libunwind 2016-06-20 19:23:32 +01:00
moneromooo-monero
f72388c1c6 CMakeLists: fix build without libunwind 2016-06-20 19:20:14 +01:00
moneromooo-monero
f0b85c1631 simplewallet: add a status command
It matches the daemon, and should allow people who're suspicious
of the background refresh to know they're synced.
2016-06-20 19:11:10 +01:00
Riccardo Spagni
a645a3e5ff Merge pull request #865
3c3537e cmake: add missing FindLibunwind.cmake (moneromooo-monero)
2016-06-20 08:48:29 +02:00
moneromooo-monero
3c3537e8c6 cmake: add missing FindLibunwind.cmake 2016-06-20 00:34:06 +01:00
Riccardo Spagni
21b3a1b43c Merge pull request #863
0c6e9e4 rpc: fix getblock RPC sending blob as binary, not hex dump (moneromooo-monero)
2016-06-19 21:52:35 +02:00
Riccardo Spagni
2072c642d1 Merge pull request #862
5dc09f2 wallet_rpc_server: fix some string values being returned between <> (moneromooo-monero)
f8213c0 Require 64/16 characters for payment ids (moneromooo-monero)
2016-06-19 21:51:32 +02:00
Riccardo Spagni
724dfda6d1 Merge pull request #857
d6f5d54 Fix Issue #855 (Howard Chu)
2016-06-19 21:50:50 +02:00
Riccardo Spagni
551d44a989 Merge pull request #856
c5f00bc cn_deserialize: add minergate data (moneromooo-monero)
2470b20 cn_deserialize: print extra nonce as hex data (moneromooo-monero)
77d8fc3 tx_extra: parse new chunk added by minergate (blashyrkh)
2016-06-19 21:30:20 +02:00
Riccardo Spagni
ba61f37f9c Merge pull request #846
de030d9 fix: error: -Werror=misleading-indentation (moneroexample)
c2d7300 contrib: epee: add exception spec to throwing destructors (redfish)
6898741 src: p2p: add exception spec to throwing destructors (redfish)
21dbc95 crypto: slow-hash: fix misleading indent (redfish)
70f3634 crypto: slow-hash: remove unused hash list for ARM (redfish)
1a7772f crypto: oaes_lib: remove unused _NR array (redfish)
6462a3a crypto: fix compile error: use named type in sizeof (redfish)
2016-06-19 21:25:52 +02:00
Riccardo Spagni
e97d96ccfb Merge pull request #775
e409e59 Print stack trace on exceptions (moneromooo-monero)
ef4ff42 connection_basic: avoid gratuitous exception (moneromooo-monero)
2016-06-19 21:14:11 +02:00
moneromooo-monero
5dc09f2666 wallet_rpc_server: fix some string values being returned between <> 2016-06-19 17:52:46 +01:00
moneromooo-monero
f8213c0644 Require 64/16 characters for payment ids
The default behavior for hex string parsing would allow the
last digit to be made from a single hexadecimal character,
which is correct, but we typically do not want that as it
gets confusing and easy to not spot wrong input size.
2016-06-19 17:52:39 +01:00
Ilya Kitaev
3318addafa double/string to monero integer convertion methods 2016-06-16 16:42:33 +03:00
moneromooo-monero
0c6e9e4ddd rpc: fix getblock RPC sending blob as binary, not hex dump 2016-06-10 17:48:19 +01:00
Ilya Kitaev
3ac20a46b3 wallet::default_mixin exposed to public interface as
Wallet::setDefaultMixin, Wallet::defaultMixin;
wallet::create_transaction_2 used in Wallet::createTransaction
2016-06-10 13:52:10 +03:00
Ilya Kitaev
c554055ce4 Wallet::filename, Wallet::keysFilename, tests for move wallet 2016-06-10 12:51:09 +03:00
Howard Chu
d6f5d543a5 Fix Issue #855
Use the same size dirty list for both 64 and 32 bit.
2016-06-07 23:38:47 +01:00
moneromooo-monero
c5f00bc751 cn_deserialize: add minergate data 2016-06-06 18:51:36 +01:00
moneromooo-monero
2470b20029 cn_deserialize: print extra nonce as hex data 2016-06-06 18:51:10 +01:00
blashyrkh
77d8fc3344 tx_extra: parse new chunk added by minergate
Patch from blashyrkh on forum.getmonero.org:
https://forum.getmonero.org/5/support/2530/simplewallet-returns-invalid-paymentid
2016-06-06 18:29:16 +01:00
Riccardo Spagni
30ef965f9a Merge pull request #854
14d10e7 readme: notes on config file and fg/bg run mode (redfish)
2016-06-03 16:40:55 +02:00
Riccardo Spagni
0ec8bc944c Merge pull request #850
95be58e crypto: slow-hash: disable mul implemented in asm for ARM (redfish)
2016-06-03 16:40:28 +02:00
Ilya Kitaev
8f9d98b3e0 removed unused "using" 2016-06-03 16:56:13 +03:00
Ilya Kitaev
2facbe77e4 Wallet API : WalletManager::findWallets() added 2016-06-03 14:52:58 +03:00
Ilya Kitaev
ec949c383c scripts for faster test wallets generation 2016-06-01 17:06:10 +03:00
redfish
14d10e77b0 readme: notes on config file and fg/bg run mode 2016-05-28 16:41:00 -04:00
Ilya Kitaev
7f3d28fe1b regenerated test wallets, basic functions got broken 2016-05-27 13:35:00 +03:00
Ilya Kitaev
bc4584c1ff Merge remote-tracking branch 'upstream/master' 2016-05-27 11:33:08 +03:00
Ilya Kitaev
4327548915 installing wallet_api header 2016-05-27 10:58:07 +03:00
Ilya Kitaev
7ac134254f cmake: BUILD_TESTS as option explicitly; added missed dependency 2016-05-27 10:42:31 +03:00
Ilya Kitaev
1f0d016f44 cmake libutils dependency added 2016-05-27 10:08:25 +03:00
Ilya Kitaev
d43ad22595 all wallet dependencies merged to single static lib 2016-05-27 10:00:01 +03:00
redfish
95be58ef0e crypto: slow-hash: disable mul implemented in asm for ARM
The implementation of mul in asm breaks 'slow-hash' test when built with
GCC 6.1.1.  Disable this implementation in favor of plain C until it is
fixed.
2016-05-25 15:53:29 -04:00
moneroexample
de030d99a5 fix: error: -Werror=misleading-indentation
Compilation of bitmonero on Arch with gcc 6.1 results in the following
error:

/home/mwo/bitmonero/tests/unit_tests/hardfork.cpp: In member function ‘virtual void TestDB::set_hard_fork_version(uint64_t, uint8_t)’:
/home/mwo/bitmonero/tests/unit_tests/hardfork.cpp:132:5: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
     if (versions.size() <= height) versions.resize(height+1); versions[height] = version;

This can be fixed by simply unfolding this line into three lines.
2016-05-18 10:54:41 -04:00
redfish
c2d7300d2e contrib: epee: add exception spec to throwing destructors
The destructors get a noexcept(true) spec by default, but these
destructors in fact throw exceptions. An alternative fix might be to not
throw (most if not all of these throws are non-essential
error-reporting/logging).
2016-05-18 01:02:27 -04:00
redfish
68987416ad src: p2p: add exception spec to throwing destructors
The destructors get a noexcept(true) spec by default, but these
destructors in fact throw exceptions. An alternative fix might be to not
throw (most if not all of these throws are non-essential
error-reporting/logging).
2016-05-18 01:02:21 -04:00
redfish
21dbc95b47 crypto: slow-hash: fix misleading indent
GCC warned about this one.
2016-05-18 01:02:17 -04:00
redfish
70f363401b crypto: slow-hash: remove unused hash list for ARM
This list is already defined within the function. The
removed definition was shadowed.
2016-05-18 01:02:13 -04:00
redfish
1a7772fbae crypto: oaes_lib: remove unused _NR array 2016-05-18 01:02:07 -04:00
redfish
6462a3a6db crypto: fix compile error: use named type in sizeof
Btw, the warning 4200 remains disabled, but it did not get triggered
(GCC 6.1.1, ARM). But, perhaps a better way than disabling
the warning would be to do what is suggested here:
http://stackoverflow.com/questions/3350852/how-to-correctly-fix-zero-sized-array-in-struct-union-warning-c4200-without%3E
2016-05-18 01:01:58 -04:00
Riccardo Spagni
a837c9cb0f Merge pull request #842
d539be3 crypto: make clear generate_random_bytes is not thread safe (moneromooo-monero)
2016-05-17 19:09:57 +02:00
Riccardo Spagni
f03def87ad Merge pull request #840
1c0bffb Restrict also 'get_connections' and 'getbans' APIs. (osensei)
9f8bc49 Don't allow 'flush_txpool' and 'setbans' JSON_RPC methods when running in restricted mode. (osensei)
2016-05-17 19:09:11 +02:00
Riccardo Spagni
36dfbf9e00 Merge pull request #837
bc99b5d Update README with TAILS instructions (dEBRUYNE-1)
2016-05-17 19:08:19 +02:00
Riccardo Spagni
e54e4d96a4 Merge pull request #831
9ef8c7b tests: fix tests broken by the removal of the block reward accumulation loop (moneromooo-monero)
a6e717e cn_deserialize: deserialize tx_extra too (moneromooo-monero)
3eff37f unit_tests: add a write_varint/read_varint test (moneromooo-monero)
7a66387 unit_tests: fix UNBOUND_LIBRARIES/UNBOUND_LIBRARY typo (moneromooo-monero)
d6bce4b core: move tx_extra parsing errors to log level 1 (moneromooo-monero)
2016-05-17 19:07:28 +02:00
Riccardo Spagni
ae205020f6 Merge pull request #827
f1e70d1 Only log 1/N skipped blocks (Howard Chu)
cebb97c Move refresh height to keys file from cache file (Howard Chu)
590c439 Make fast_refresh interruptible (Howard Chu)
687855d Set refresh height earlier (Howard Chu)
2fb00c0 Fix 19fe8ae3ef (Howard Chu)
2016-05-17 19:04:41 +02:00
Ilya Kitaev
9ae4e871a3 WalletListener::moneyReceived test 2016-05-17 12:16:11 +03:00
osensei
1c0bffb5f0 Restrict also 'get_connections' and 'getbans' APIs. 2016-05-16 08:34:15 -03:00
Ilya Kitaev
40087a745f WalletListener::moneySpent test 2016-05-16 13:11:44 +03:00
moneromooo-monero
d539be3359 crypto: make clear generate_random_bytes is not thread safe
And add a thread safe version to encourage proper use
2016-05-15 00:05:59 +01:00
osensei
9f8bc4946b Don't allow 'flush_txpool' and 'setbans' JSON_RPC methods when running in restricted mode. 2016-05-14 03:06:04 -03:00
Ilya Kitaev
27d86b73c6 WalletListener::moneySpent(), WalletListener::moneyReceived() 2016-05-13 16:25:31 +03:00
Ilya Kitaev
ff52c67aa9 i_wallet_callback: virtual dtor 2016-05-13 12:59:29 +03:00
Ilya Kitaev
2d799097ca Merge remote-tracking branch 'upstream/master' 2016-05-12 15:14:30 +03:00
dEBRUYNE-1
bc99b5d1da Update README with TAILS instructions 2016-05-11 17:43:40 +02:00
Ilya Kitaev
5dbd2b8fc3 started WalletListener 2016-05-05 22:24:00 +03:00
Ilya Kitaev
71131a84ea TransactionHistory continued 2016-05-05 21:30:25 +03:00
moneromooo-monero
9ef8c7b694 tests: fix tests broken by the removal of the block reward accumulation loop
The tests for rejection of unmixable outputs in v2 are commented out,
as there are no unmixable outputs created anymore. This should be
restored at some point.
2016-05-01 20:59:41 +01:00
moneromooo-monero
a6e717ed30 cn_deserialize: deserialize tx_extra too 2016-05-01 11:42:48 +01:00
moneromooo-monero
3eff37f931 unit_tests: add a write_varint/read_varint test 2016-05-01 11:42:31 +01:00
moneromooo-monero
7a663873ce unit_tests: fix UNBOUND_LIBRARIES/UNBOUND_LIBRARY typo 2016-05-01 11:35:14 +01:00
moneromooo-monero
d6bce4be36 core: move tx_extra parsing errors to log level 1
They're not fatal, though indicate something wrong
2016-05-01 11:35:06 +01:00
Riccardo Spagni
30dce45643 Merge branch 'performance' of https://github.com/LMDB/bitmonero 2016-04-29 21:41:43 +02:00
Howard Chu
f1e70d15ca Only log 1/N skipped blocks 2016-04-29 16:50:51 +01:00
Howard Chu
cebb97c913 Move refresh height to keys file from cache file 2016-04-29 15:33:28 +01:00
Howard Chu
590c43988c Make fast_refresh interruptible 2016-04-29 15:33:28 +01:00
Howard Chu
687855d658 Set refresh height earlier
Do it before the generate() call so the value actually gets stored.
2016-04-29 15:33:28 +01:00
Ilya Kitaev
93119344ec TransactionHistory continued 2016-04-29 16:26:14 +03:00
Riccardo Spagni
8b0d22a2aa Merge pull request #826
76c6bf1 simplewallet: display all settings on set with no arguments (moneromooo-monero)
2016-04-29 10:44:59 +02:00
Riccardo Spagni
5b734c2a3a Merge pull request #825
513a658 add a --max-concurrency flag (moneromooo-monero)
2016-04-29 10:43:48 +02:00
Riccardo Spagni
aee3214d86 Merge pull request #824
09dddf2 wallet: add a filter_by_height field to get_transfers (moneromooo-monero)
2016-04-29 10:42:39 +02:00
Howard Chu
2fb00c0666 Fix 19fe8ae3ef
Don't prompt for restore-height on generate-new-wallet
2016-04-29 04:51:02 +01:00
moneromooo-monero
e409e59d29 Print stack trace on exceptions
if libunwind is found.

Useful for debugging logs.
2016-04-28 23:34:51 +01:00
moneromooo-monero
76c6bf1875 simplewallet: display all settings on set with no arguments 2016-04-28 22:09:49 +01:00
moneromooo-monero
513a658c87 add a --max-concurrency flag
It sets the max number of threads to use for a parallel job.
This is different that the number of total threads, since monero
binaries typically start a lot of them.
2016-04-28 20:33:59 +01:00
moneromooo-monero
09dddf281a wallet: add a filter_by_height field to get_transfers
It allows a simple get_transfers (with default 0 min_height and
max_height) to return all transactions, instead of the unexpected
set of txes in block 0, which is probably none at all.
2016-04-27 23:43:39 +01:00
Riccardo Spagni
bdb93cbf3d Merge pull request #823
a687e6e simplewallet: fix pending transfers fee display in show_transfers (moneromooo-monero)
2016-04-27 09:18:28 +02:00
Riccardo Spagni
29b2cfa3d9 Merge pull request #822
48ab3f9 wallet: add get_transfers rpc call (moneromooo-monero)
2016-04-27 09:15:15 +02:00
Riccardo Spagni
5247c063ea Merge pull request #821
d7bb175 simplewallet: more threading fixes (moneromooo-monero)
2016-04-27 09:09:21 +02:00
moneromooo-monero
a687e6e592 simplewallet: fix pending transfers fee display in show_transfers 2016-04-26 22:42:26 +01:00
moneromooo-monero
d7bb1752eb simplewallet: more threading fixes 2016-04-26 22:40:57 +01:00
moneromooo-monero
48ab3f93ff wallet: add get_transfers rpc call
Allows getting in, out, pending, and failed transfers, similarly
to the show_transfers command.
2016-04-26 22:39:52 +01:00
Riccardo Spagni
b6f19a485c Merge pull request #816
7baed9b wallet: allow attaching notes to txids (moneromooo-monero)
ce6f8a6 wallet: add GMT timestamps to transfers/payments (moneromooo-monero)
2016-04-26 20:36:35 +02:00
moneromooo-monero
7baed9bd89 wallet: allow attaching notes to txids 2016-04-26 19:07:33 +01:00
moneromooo-monero
ce6f8a6324 wallet: add GMT timestamps to transfers/payments 2016-04-26 19:07:25 +01:00
Riccardo Spagni
3d984854a6 Merge pull request #819
31587bd random: call abort(3) instead of assert in must_succeed macro (moneromooo-monero)
2016-04-26 18:11:04 +02:00
Riccardo Spagni
cde9dce9c4 Merge pull request #817
4b1c0d6 simplewallet: some background refresh threading fixes (moneromooo-monero)
2016-04-26 18:08:59 +02:00
Riccardo Spagni
714dcc2866 Merge pull request #815
b0850a9 wallet: add a new sweep_all command and RPC command (moneromooo-monero)
2016-04-26 18:08:09 +02:00
Riccardo Spagni
7098ad6804 Merge pull request #814
68cbe15 	modified:   src/wallet/wallet2.cpp 	modified:   src/wallet/wallet2.h (awfulcrawler)
4b325bd 	modified:   src/simplewallet/simplewallet.cpp 	modified:   src/wallet/wallet2.cpp 	modified:   src/wallet/wallet2.h (awfulcrawler)
2016-04-26 18:04:00 +02:00
Riccardo Spagni
fbfb8f46a9 Merge pull request #813
70c8656 blockchain: add missing overflow check for already generated coins (moneromooo-monero)
d6fd6be blockchain: update cumulative block limit when popping a block (moneromooo-monero)
2016-04-26 18:03:31 +02:00
Riccardo Spagni
0fb0e7701b Merge pull request #812
3102feb abstract_tcp_server2: fix send queue limit warning spam (moneromooo-monero)
6bca9a8 abstract_tcp_server2: avoid deadlock waiting for send queue to drain (moneromooo-monero)
7450656 net_node: fix connection leak when ping fails with bad response (moneromooo-monero)
2016-04-26 18:02:57 +02:00
Riccardo Spagni
0922ae2b43 Merge pull request #811
672162d tests: fix compile failure on wallet2::transfer (moneromooo-monero)
b0c18ef wallet2: move output selection api public (moneromooo-monero)
2016-04-26 18:02:26 +02:00
Riccardo Spagni
94a291f8fb Merge pull request #806
19fe8ae Add --restore-height option (Howard Chu)
b6e42c3 Speed up new wallet refresh (Howard Chu)
b7140da Add GET_HASHES_FAST rpc, use it in wallet (Howard Chu)
2016-04-26 18:01:57 +02:00
Ilya Kitaev
566166aafd merged with upstream 2016-04-26 13:46:20 +03:00
Ilya Kitaev
dce5374660 Merge remote-tracking branch 'upstream/master' into develop 2016-04-26 11:08:40 +03:00
Howard Chu
2b0fa05f0d Another take on migration
Delete old indices and recreate them, rather than updating them
Maybe not quite as slow as before.
2016-04-24 17:46:50 +01:00
moneromooo-monero
31587bdd15 random: call abort(3) instead of assert in must_succeed macro
Avoids silent use of bad RNG in release builds, in case those
calls might actually fail.

Reported by smooth.
2016-04-24 12:26:56 +01:00
Ilya Kitaev
53a97bdcd3 Wallet API: transaction history in progress 2016-04-22 13:33:09 +03:00
Ilya Kitaev
02c9df5de2 Wallet API : transaction history in progress 2016-04-22 13:21:08 +03:00
moneromooo-monero
4b1c0d69f4 simplewallet: some background refresh threading fixes
We want to lock operations which access the blockchain in
wallet2. We also want the background refresh to happen again
when we cancel a foreground refresh. Wrap the locking setup
in a macro so it doesn't get copy/pasted/mangled, and use
a scope exit trick to ensure it's always properly restored.
2016-04-21 00:11:11 +01:00
Ilya Kitaev
a213887476 transaction history api in progress 2016-04-20 13:33:54 +03:00
Ilya Kitaev
b6aaf53a60 transaction history api in progress 2016-04-20 13:17:27 +03:00
Ilya Kitaev
f83f3cbd96 api implementation splitted over separate files 2016-04-20 13:01:00 +03:00
moneromooo-monero
b0850a9bea wallet: add a new sweep_all command and RPC command
This sends all outputs in a wallet to a given address, alleviating
the difficulty people have had trying to send all monero but
being left with some small amount left.
2016-04-19 21:20:27 +01:00
Ilya Kitaev
4e1c2dc365 TransactionInfo / TransactionHistory APIs design 2016-04-19 12:25:03 +03:00
awfulcrawler
68cbe1579e modified: src/wallet/wallet2.cpp
modified:   src/wallet/wallet2.h

Removed working comments
2016-04-18 20:20:31 +12:00
awfulcrawler
4b325bdb66 modified: src/simplewallet/simplewallet.cpp
modified:   src/wallet/wallet2.cpp
	modified:   src/wallet/wallet2.h

Update to fix unconfirmed balance and give a slightly more verbose and informative confirmation message for transfers
2016-04-18 14:57:47 +12:00
AwfulCrawler
2d9dfd0820 Merge pull request #1 from monero-project/master
Catch up with Monero master
2016-04-18 13:58:22 +12:00
Howard Chu
19fe8ae3ef Add --restore-height option
For specifying the block height from which to start a restore
2016-04-17 15:25:46 +01:00
Howard Chu
b6e42c3276 Speed up new wallet refresh
Use the current blockchain height as the refresh_from_block_height.
2016-04-17 15:25:46 +01:00
Howard Chu
b7140daea2 Add GET_HASHES_FAST rpc, use it in wallet
When m_refresh_from_block_height has been set, only hashes will be
retrieved up to that height, instead of full blocks. The same will
be done for "refresh <height>" when the specified height is beyond
the current local blockchain.
2016-04-17 15:25:46 +01:00
moneromooo-monero
70c86561af blockchain: add missing overflow check for already generated coins
When reaching the tail emission phase, the amount of coins will
eventually go over MONEY_SUPPLY, overflowing 64 bits. There was
a check added to blockchain_storage, but this was not ported to
the blockchain DB version.

Reported by smooth.
2016-04-17 14:46:17 +01:00
moneromooo-monero
d6fd6be5de blockchain: update cumulative block limit when popping a block
Avoids possible issues with accepting a tx too large to fit
in an actual block.

Reported by smooth.
2016-04-17 14:46:13 +01:00
moneromooo-monero
3102feb56c abstract_tcp_server2: fix send queue limit warning spam
When the send queue limit is reached, it is likely to not drain
any time soon. If we call close on the connection, it will stay
alive, waiting for the queue to drain before actually closing,
and will hit that check again and again. Since the queue size
limit is the reason we're closing in the first place, we call
shutdown directly.
2016-04-17 11:47:22 +01:00
moneromooo-monero
6bca9a8ef4 abstract_tcp_server2: avoid deadlock waiting for send queue to drain
If we reach the send queue size limit, we need to release the lock,
or we will deadlock and it will never drain.

If we reach that limit, it's likely there's another problem in the
first place though, so it will probably not drain in practice either,
unless some kind of transient network timeout.
2016-04-17 11:45:38 +01:00
moneromooo-monero
7450656bf3 net_node: fix connection leak when ping fails with bad response
If there is no comms error, but the response is not as expected,
close would not be called.
2016-04-17 11:24:07 +01:00
moneromooo-monero
672162d9e2 tests: fix compile failure on wallet2::transfer 2016-04-17 11:21:01 +01:00
moneromooo-monero
b0c18ef9cd wallet2: move output selection api public 2016-04-17 11:20:44 +01:00
Riccardo Spagni
1c66fe04bc Merge pull request #803
c33ffc8 simplewallet: save fixes in RPC mode (moneromooo-monero)
2016-04-14 16:26:46 +09:00
Riccardo Spagni
b52148201b Merge pull request #786
5092e45 tests: unbound API is only accessible in static builds (moneromooo-monero)
2016-04-14 16:26:29 +09:00
Riccardo Spagni
0ecb152810 Merge pull request #785
1a58d20 simplewallet: optional address in --generate-from-json (moneromooo-monero)
2016-04-14 16:26:11 +09:00
Riccardo Spagni
8f78f1407e Merge pull request #784
087373e Fix potential race with parallel processing of txes/signatures/blocks (moneromooo-monero)
2016-04-14 16:25:53 +09:00
Riccardo Spagni
6bfb8799c3 Merge pull request #783
48d0747 wallet: better output selection for transfer/transfer_new (moneromooo-monero)
2016-04-14 16:25:38 +09:00
Riccardo Spagni
17049fa8e8 Merge pull request #782
113cdc1 core: keep the acc loop for the genesis block (moneromooo-monero)
2016-04-14 16:25:18 +09:00
Riccardo Spagni
a299e5269b Merge pull request #801
ed61a2c simplewallet: set strict umask at start (moneromooo-monero)
7385c03 util: add a function to set umask to 077 (moneromooo-monero)
2016-04-14 16:21:29 +09:00
Riccardo Spagni
784a2108f4 Merge pull request #800
4cfb4df blockchain: remove the tx validation result cache (moneromooo-monero)
2016-04-14 16:21:08 +09:00
Riccardo Spagni
c2e9866fc6 Merge pull request #797
d662ab5 rpc: print human readable time since received when printing pool (moneromooo-monero)
5c9dd23 rpc: add a do_not_relay boolean to tx submission (moneromooo-monero)
2016-04-14 16:20:41 +09:00
Riccardo Spagni
da277e17b5 Merge pull request #796
d817aec tx_pool: ensure no txes that fail check_inputs get in the block template (moneromooo-monero)
2016-04-14 16:20:17 +09:00
Riccardo Spagni
8f63e89c7f Merge pull request #791
f17b2f4 rpc: add pool/blockchain and block height results to gettransactions (moneromooo-monero)
2016-04-14 16:19:49 +09:00
Riccardo Spagni
977ec85c5d Merge pull request #789
17cac41 tests: fix build with older GCC (Javier Smooth)
2016-04-14 16:19:14 +09:00
Ilya Kitaev
1774d9574b TODOs for Transaction/Transfer interface 2016-04-12 22:30:20 +03:00
moneromooo-monero
c33ffc8e94 simplewallet: save fixes in RPC mode
^C when in RPC mode would not save the wallet while it was still
refreshing after starting up.

Also, save the wallet out of the signal handler. We don't want
to call complex stuff in a signal handler.
2016-04-10 16:56:12 +01:00
Howard Chu
66b1e13aa7 mdb_drop optimization
If we know there are no sub-DBs and no overflow pages, skip leaf scan.
2016-04-09 20:44:05 +01:00
moneromooo-monero
f17b2f42b2 rpc: add pool/blockchain and block height results to gettransactions 2016-04-09 12:40:32 +01:00
Howard Chu
c14f9efd52 Migration
Migrate from DB version 0 to version 1 on startup
2016-04-08 03:11:05 +01:00
moneromooo-monero
ed61a2ccc1 simplewallet: set strict umask at start 2016-04-06 20:00:25 +01:00
moneromooo-monero
7385c036bd util: add a function to set umask to 077
Useful to ensure files are written without group/other read rights.
2016-04-06 19:59:34 +01:00
moneromooo-monero
4cfb4dff3e blockchain: remove the tx validation result cache
As pointed out by smooth, a transaction's validity may change
over time as the blockchain changes.
2016-04-06 19:01:28 +01:00
Ilya Kitaev
d97e9ef8a5 Transaction API continued 2016-04-06 13:56:57 +03:00
Riccardo Spagni
abea280dd3 Merge pull request #799
aaaf9e2 Fix get_tick_count() on Windows (Howard Chu)
2016-04-06 12:21:14 +09:00
Howard Chu
aaaf9e2e6d Fix get_tick_count() on Windows
GetTickCount used in 52056dcfc4
only has ~10-16ms resolution. Use higher rez timer to get 1ms rez.
2016-04-06 03:41:52 +01:00
Riccardo Spagni
151f4b63f7 Merge pull request #787
b1aaf20 epee: flush output after a message (moneromooo-monero)
2016-04-06 11:25:15 +09:00
Riccardo Spagni
fafb43f3cd Merge pull request #798
1aad759 tx_pool: fix (hopefully) save/load of kept_by_block (moneromooo-monero)
2016-04-06 11:25:00 +09:00
moneromooo-monero
1aad759bf1 tx_pool: fix (hopefully) save/load of kept_by_block 2016-04-06 00:11:31 +01:00
Howard Chu
d7ea7d9a23 Merge branch 'performance' into master 2016-04-05 21:13:16 +01:00
Howard Chu
372acee723 Cleanup
drop obsolete remove_output()
fix get_output_key(global), fix crash in blockchain_dump
2016-04-05 21:05:24 +01:00
Howard Chu
591e421875 Cleanup and clarify
Try to rationalize the variable names, document usage.
2016-04-05 20:57:45 +01:00
Howard Chu
b2f1c58805 Use cursors in some remove functions
Helps when they're called repeatedly in one txn
2016-04-05 20:57:31 +01:00
Howard Chu
118dd69dd5 Use DUPFIXED for block_info and output_txs
Saves another ~150MB or so on the full blockchain
2016-04-05 20:55:16 +01:00
Howard Chu
6225716f3c More outputs consolidation
Also bumped DB VERSION to 1
Another significant speedup and space savings:
Get rid of global_output_indices, remove indirection from output to keys

This is the change warptangent described on irc but never got to finish.
2016-04-05 20:55:12 +01:00
Howard Chu
7c5abdc3a3 Use DUPFIXED for output_keys
Saves another 90MB on 200000 block import.
Had to bring back compare_uint64 for this, but it's safe since
this table is always 64-bit aligned.
2016-04-05 20:54:42 +01:00
Howard Chu
8e9d8e3364 Use DUPFIXED for tx_indices
Small space savings, no measurable speedup
2016-04-05 20:54:39 +01:00
Howard Chu
a12f9365f8 Use DUPFIXED for block_heights
Only a small savings...
2016-04-05 20:54:07 +01:00
Howard Chu
38c2277d6f Use DUPFIXED for spent_keys 2016-04-05 20:54:07 +01:00
warptangent
bf769c32ba Add back changes from revert.
m_tx_outputs doesn't need to be changed, as it's no longer dup list.
2016-04-05 20:54:07 +01:00
warptangent
46b991b362 Use MDB_APPEND mode with two tx subdbs
This is possible on those using a tx index as a key.
2016-04-05 20:54:07 +01:00
warptangent
9aadedb1d0 Schema update: tx_indices - consolidate the tx subdbs from 5 to 3 2016-04-05 20:54:06 +01:00
warptangent
a2f518aa01 Schema update: tx_indices - yet less indirection 2016-04-05 20:54:06 +01:00
warptangent
8d12a8df2c Schema update: tx_indices - improve further with less indirection 2016-04-05 20:54:06 +01:00
warptangent
7c013f66e9 Add batch warning for further review 2016-04-05 20:54:06 +01:00
warptangent
ae0854a431 Schema update: tx_indices 2016-04-05 20:54:06 +01:00
Howard Chu
8d252a4214 Consolidated block info 2016-04-05 20:53:59 +01:00
warptangent
132c666f67 Update schema for "tx_outputs" to use array containing amount output indices
This speeds up wallet refresh by directly retrieving a tx's amount output indices.

It removes the indirection and walking the amount output duplicate list
for every amount in each requested tx.

"tx_outputs" is used by:
Amount output indices are needed for wallet refresh.
Global output indices are needed for removing a tx.

Both amount output indices and global output indices are now stored in
an array of 64-bit unsigned ints:

tx_outputs[<tx_hash>] -> [ <a1_oi, a1_gi, a2_oi, a2_gi, ...> ]

Previously it was:
tx_outputs[<tx_hash>] -> duplicate list of <a1_gi, a2_gi, a3_gi, ...>

The amount output list had to be walked for every amount in order to
find each amount's output index, by comparing the amount's global output
index with each one in the duplicate list until a match was found.

See also d045dfa7ce
2016-04-05 20:30:50 +01:00
warptangent
309f8f3d44 blockchain_utilities: Update documentation 2016-04-05 20:30:50 +01:00
luigi1111
7ac1db42c2 get_payments short ID
Add support for short/integrated/encrypted IDs to get_payments RPC
2016-04-05 20:30:50 +01:00
moneromooo-monero
d662ab5cec rpc: print human readable time since received when printing pool 2016-04-05 20:16:05 +01:00
moneromooo-monero
5c9dd23b1c rpc: add a do_not_relay boolean to tx submission
Just to make it easier
2016-04-05 20:15:54 +01:00
Ilya Kitaev
079fbd3d42 Wallet::createTransaction API introduced 2016-04-05 15:24:44 +03:00
moneromooo-monero
d817aeca80 tx_pool: ensure no txes that fail check_inputs get in the block template 2016-04-05 13:06:29 +01:00
Ilya Kitaev
ee5bb17f26 Wallet::transfer() continued 2016-04-04 14:56:17 +03:00
Ilya Kitaev
c37c856d6d Wallet::transfer in progress 2016-04-03 14:34:38 +03:00
Javier Smooth
17cac41968 tests: fix build with older GCC 2016-04-02 22:05:56 +01:00
moneromooo-monero
b1aaf20e57 epee: flush output after a message
This is equivalent to line buffering, as C++ seems to lack
a setvbuf equivalent which alows line buffering.
2016-04-02 20:59:24 +01:00
moneromooo-monero
5092e45e3f tests: unbound API is only accessible in static builds 2016-04-02 16:02:18 +01:00
moneromooo-monero
1a58d202b2 simplewallet: optional address in --generate-from-json
When present, it can be used to validate the keys, as well
as deduce the spend key, if it is absent (watch wallet).
2016-04-02 15:22:59 +01:00
moneromooo-monero
087373eccf Fix potential race with parallel processing of txes/signatures/blocks 2016-04-02 14:20:51 +01:00
moneromooo-monero
48d0747d00 wallet: better output selection for transfer/transfer_new
This now requests the set of outputs that can be mixed first,
to avoid trying non dust but unmixable outputs, which we know
will fail.
2016-04-02 14:17:02 +01:00
moneromooo-monero
113cdc10a2 core: keep the acc loop for the genesis block
For unknown reasons, it was generated with a block reward
consisting of a single large dusty output.
2016-04-02 11:17:49 +01:00
Ilya Kitaev
830c19c934 Wallet::refresh + tests 2016-03-31 16:38:57 +03:00
Ilya Kitaev
1ae9cdc6bf "testnet" is default parameter 2016-03-31 15:39:28 +03:00
Ilya Kitaev
2157a9ac48 testnet option, Wallet::balance(), Wallet::unlockedBalance() 2016-03-31 12:48:41 +03:00
Ilya Kitaev
df6026182a Merge remote-tracking branch 'upstream/master' 2016-03-31 12:01:19 +03:00
moneromooo-monero
ef4ff4252a connection_basic: avoid gratuitous exception
The remote endpoint is usually invalid, so use a version of the
call that returns an error code instead.
2016-03-28 18:59:09 +01:00
Ilya Kitaev
8790904cf9 - testnet option added to api; 2016-03-25 17:06:30 +03:00
Ilya Kitaev
2cce32995b wallet2::store() implemented within wallet2::store_to 2016-03-21 16:17:03 +03:00
854 changed files with 115404 additions and 38424 deletions

1
.dockerignore Normal file
View File

@@ -0,0 +1 @@
*

1
.gitignore vendored
View File

@@ -103,3 +103,4 @@ local.properties
.texlipse
.idea/
/testnet

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2017, The Monero Project
#
# All rights reserved.
#
@@ -27,10 +27,13 @@
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
if (IOS)
INCLUDE(CmakeLists_IOS.txt)
endif()
cmake_minimum_required(VERSION 2.8.7)
project(bitmonero)
project(monero)
function (die msg)
if (NOT WIN32)
@@ -45,36 +48,65 @@ function (die msg)
message(FATAL_ERROR "${BoldRed}${msg}${ColourReset}")
endfunction ()
if (NOT ${ARCH} STREQUAL "")
string(SUBSTRING ${ARCH} 0 3 IS_ARM)
string(TOLOWER ${IS_ARM} IS_ARM)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}")
endif()
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_LOWER)
if (${IS_ARM} STREQUAL "arm")
string(SUBSTRING ${ARCH} 0 5 ARM_TEST)
string(TOLOWER ${ARM_TEST} ARM_TEST)
if (${ARM_TEST} STREQUAL "armv6")
set(ARM6 1)
else()
set(ARM6 0)
endif()
if (${ARM_TEST} STREQUAL "armv7")
set(ARM7 1)
else()
set(ARM7 0)
endif()
# ARCH defines the target architecture, either by an explicit identifier or
# one of the following two keywords. By default, ARCH a value of 'native':
# target arch = host arch, binary is not portable. When ARCH is set to the
# string 'default', no -march arg is passed, which creates a binary that is
# portable across processors in the same family as host processor. In cases
# when ARCH is not set to an explicit identifier, cmake's builtin is used
# to identify the target architecture, to direct logic in this cmake script.
# Since ARCH is a cached variable, it will not be set on first cmake invocation.
if (NOT ARCH OR ARCH STREQUAL "" OR ARCH STREQUAL "native" OR ARCH STREQUAL "default")
set(ARCH_ID "${CMAKE_SYSTEM_PROCESSOR}")
else()
set(ARCH_ID "${ARCH}")
endif()
string(TOLOWER "${ARCH_ID}" ARM_ID)
string(SUBSTRING "${ARM_ID}" 0 3 ARM_TEST)
if (ARM_TEST STREQUAL "arm")
set(ARM 1)
string(SUBSTRING "${ARM_ID}" 0 5 ARM_TEST)
if (ARM_TEST STREQUAL "armv6")
set(ARM6 1)
endif()
if (ARM_TEST STREQUAL "armv7")
set(ARM7 1)
endif()
endif()
if(WIN32 OR ARM7 OR ARM6)
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
else()
set(CMAKE_C_FLAGS_RELEASE "-Ofast -DNDEBUG -Wno-unused-variable")
set(CMAKE_CXX_FLAGS_RELEASE "-Ofast -DNDEBUG -Wno-unused-variable")
if (ARM_ID STREQUAL "aarch64" OR ARM_ID STREQUAL "arm64" OR ARM_ID STREQUAL "armv8-a")
set(ARM 1)
set(ARM8 1)
set(ARCH "armv8-a")
endif()
if(ARCH_ID STREQUAL "ppc64le")
set(PPC64LE 1)
endif()
if(WIN32 OR ARM)
set(OPT_FLAGS_RELEASE "-O2")
else()
set(OPT_FLAGS_RELEASE "-Ofast")
endif()
# BUILD_TAG is used to select the build type to check for a new version
if(BUILD_TAG)
message(STATUS "Building build tag ${BUILD_TAG}")
add_definitions("-DBUILD_TAG=${BUILD_TAG}")
else()
message(STATUS "Building without build tag")
endif()
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG ${OPT_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${OPT_FLAGS_RELEASE}")
# set this to 0 if per-block checkpoint needs to be disabled
set(PER_BLOCK_CHECKPOINT 1)
@@ -133,12 +165,15 @@ message(STATUS "Building for a ${ARCH_WIDTH}-bit system")
# Check if we're on FreeBSD so we can exclude the local miniupnpc (it should be installed from ports instead)
# CMAKE_SYSTEM_NAME checks are commonly known, but specifically taken from libsdl's CMakeLists
if(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
set(FREEBSD TRUE)
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
if(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*|FreeBSD")
set(FREEBSD TRUE)
endif()
# Check if we're on DragonFly BSD. See the README.md for build instructions.
if(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*")
set(DRAGONFLY TRUE)
endif()
# Check if we're on OpenBSD. See the README.md for build instructions.
if(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
set(OPENBSD TRUE)
@@ -151,10 +186,13 @@ endif()
# elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
# set(BSDI TRUE)
include_directories(src contrib/epee/include external "${CMAKE_BINARY_DIR}/version")
include_directories(external/easylogging++ src contrib/epee/include external "${CMAKE_BINARY_DIR}/version")
if(APPLE)
include_directories(SYSTEM /usr/include/malloc)
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
endif()
if(MSVC OR MINGW)
@@ -164,6 +202,19 @@ else()
endif()
option(STATIC "Link libraries statically" ${DEFAULT_STATIC})
# This is a CMake built-in switch that concerns internal libraries
if (NOT DEFINED BUILD_SHARED_LIBS AND NOT STATIC AND CMAKE_BUILD_TYPE_LOWER STREQUAL "debug")
set(BUILD_SHARED_LIBS ON)
endif()
if (BUILD_SHARED_LIBS)
message(STATUS "Building internal libraries with position independent code")
set(PIC_FLAG "-fPIC")
add_definitions("-DBUILD_SHARED_LIBS")
else()
message(STATUS "Building internal libraries as static")
endif()
if(MINGW)
string(REGEX MATCH "^[^/]:/[^/]*" msys2_install_path "${CMAKE_C_COMPILER}")
message(STATUS "MSYS location: ${msys2_install_path}")
@@ -185,8 +236,8 @@ if(STATIC)
endif()
endif()
# default database:
# should be lmdb for testing, memory for production still
# Set default blockchain storage location:
# memory was the default in Cryptonote before Monero implimented LMDB, it still works but is unneccessary.
# set(DATABASE memory)
set(DATABASE lmdb)
@@ -229,10 +280,6 @@ elseif (DATABASE STREQUAL "berkeleydb")
message(STATUS "Using Berkeley DB as default DB type")
add_definitions("-DDEFAULT_DB_TYPE=\"berkeley\"")
elseif (DATABASE STREQUAL "memory")
set(BLOCKCHAIN_DB DB_MEMORY)
message(STATUS "Using Serialised In Memory as default DB type")
add_definitions("-DDEFAULT_DB_TYPE=\"memory\"")
else()
die("Invalid database type: ${DATABASE}")
endif()
@@ -243,16 +290,64 @@ endif()
add_definitions("-DBLOCKCHAIN_DB=${BLOCKCHAIN_DB}")
# Can't install hook in static build on OSX, because OSX linker does not support --wrap
# On ARM, having libunwind package (with .so's only) installed breaks static link.
if (APPLE)
set(DEFAULT_STACK_TRACE OFF)
set(LIBUNWIND_LIBRARIES "")
elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT MINGW)
set(DEFAULT_STACK_TRACE ON)
set(LIBUNWIND_LIBRARIES "")
elseif (ARM AND STATIC)
set(DEFAULT_STACK_TRACE OFF)
set(LIBUNWIND_LIBRARIES "")
else()
find_package(Libunwind)
if(LIBUNWIND_FOUND)
set(DEFAULT_STACK_TRACE ON)
else()
set(DEFAULT_STACK_TRACE OFF)
set(LIBUNWIND_LIBRARIES "")
endif()
endif()
option(STACK_TRACE "Install a hook that dumps stack on exception" ${DEFAULT_STACK_TRACE})
if(STACK_TRACE)
message(STATUS "Stack trace on exception enabled")
else()
message(STATUS "Stack trace on exception disabled")
endif()
# Handle OpenSSL, used for sha256sum on binary updates
if (APPLE AND NOT IOS)
if (NOT OpenSSL_DIR)
EXECUTE_PROCESS(COMMAND brew --prefix openssl
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "Using OpenSSL found at ${OPENSSL_ROOT_DIR}")
endif()
endif()
find_package(OpenSSL REQUIRED)
if(STATIC AND NOT IOS)
if(UNIX)
set(OPENSSL_LIBRARIES "${OPENSSL_LIBRARIES};${CMAKE_DL_LIBS}")
endif()
endif()
if (UNIX AND NOT APPLE)
# Note that at the time of this writing the -Wstrict-prototypes flag added below will make this fail
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads)
endif()
add_definitions(-DAUTO_INITIALIZE_EASYLOGGINGPP)
add_subdirectory(external)
# Final setup for miniupnpc
if(UPNP_STATIC)
if(UPNP_STATIC OR IOS)
add_definitions("-DUPNP_STATIC")
else()
add_definitions("-DUPNP_DYNAMIC")
@@ -263,8 +358,9 @@ endif()
include_directories(${UNBOUND_INCLUDE})
link_directories(${UNBOUND_LIBRARY_DIRS})
# Final setup for rapidjson
include_directories(external/rapidjson)
# Final setup for easylogging++
include_directories(${EASYLOGGING_INCLUDE})
link_directories(${EASYLOGGING_LIBRARY_DIRS})
# Final setup for liblmdb
include_directories(${LMDB_INCLUDE})
@@ -274,6 +370,10 @@ if (BERKELEY_DB)
include_directories(${BDB_INCLUDE})
endif()
# Final setup for libunwind
include_directories(${LIBUNWIND_INCLUDE})
link_directories(${LIBUNWIND_LIBRARY_DIRS})
if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
@@ -285,26 +385,27 @@ if(MSVC)
endif()
include_directories(SYSTEM src/platform/msc)
else()
set(ARCH native CACHE STRING "CPU to build for: -march value or default")
# -march=armv7-a conflicts with -mcpu=cortex-a7
if(ARCH STREQUAL "default" OR ARM7 OR ARM6)
include(TestCXXAcceptsFlag)
set(ARCH native CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}")
if(ARCH STREQUAL "default")
set(ARCH_FLAG "")
elseif(PPC64LE)
set(ARCH_FLAG "-mcpu=${ARCH}")
elseif(IOS AND ARCH STREQUAL "arm64")
message(STATUS "IOS: Changing arch from arm64 to armv8")
set(ARCH_FLAG "-march=armv8")
else()
if(ARCH STREQUAL "x86_64")
set(ARCH_FLAG "-march=x86-64")
else()
set(ARCH_FLAG "-march=${ARCH}")
endif()
endif()
set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(WARNINGS "${WARNINGS} -Wno-deprecated-register")
set(ARCH_FLAG "-march=${ARCH}")
endif()
set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized")
if(NOT MINGW)
set(WARNINGS "${WARNINGS} -Werror") # to allow pedantic but not stop compilation
set(WARNINGS_AS_ERRORS_FLAG "-Werror")
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(WARNINGS "${WARNINGS} -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration")
if(ARM)
set(WARNINGS "${WARNINGS} -Wno-error=inline-asm")
endif()
else()
set(WARNINGS "${WARNINGS} -Wlogical-op -Wno-error=maybe-uninitialized")
endif()
@@ -329,50 +430,161 @@ else()
set(STATIC_ASSERT_FLAG "-Dstatic_assert=_Static_assert")
endif()
try_compile(STATIC_ASSERT_CPP_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-static-assert.cpp" COMPILE_DEFINITIONS "-std=c++11")
if(STATIC_ASSERT_CPP_RES)
set(STATIC_ASSERT_CPP_FLAG "")
else()
set(STATIC_ASSERT_CPP_FLAG "-Dstatic_assert=_Static_assert")
endif()
option(COVERAGE "Enable profiling for test coverage report" 0)
if(COVERAGE)
message(STATUS "Building with profiling for test coverage report")
set(COVERAGE_FLAGS "-fprofile-arcs -ftest-coverage --coverage")
endif()
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
# is fixed in the code (Issue #847), force compiler to be conservative.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
option(NO_AES "Explicitly disable AES support" ${NO_AES})
if (NO_AES)
message(STATUS "Disabling AES support")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG}")
if(NOT NO_AES AND NOT ARM AND NOT PPC64LE)
message(STATUS "AES support enabled")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
elseif(PPC64LE)
message(STATUS "AES support not available on ppc64le")
elseif(ARM6)
message(STATUS "AES support not available on ARMv6")
elseif(ARM7)
message(STATUS "AES support not available on ARMv7")
elseif(ARM8)
CHECK_CXX_ACCEPTS_FLAG("-march=${ARCH}+crypto" ARCH_PLUS_CRYPTO)
if(ARCH_PLUS_CRYPTO)
message(STATUS "Crypto extensions enabled for ARMv8")
set(ARCH_FLAG "-march=${ARCH}+crypto")
else()
message(STATUS "Crypto extensions unavailable on your ARMv8 device")
endif()
else()
message(STATUS "Enabling AES support")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} -maes")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} -maes")
message(STATUS "AES support disabled")
endif()
if(ARM6)
message(STATUS "Setting ARM6 C and C++ flags")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp -mfloat-abi=hard")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp -mfloat-abi=hard")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_FLAG} ${WARNINGS} ${C_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -D_GNU_SOURCE ${MINGW_FLAG} ${STATIC_ASSERT_CPP_FLAG} ${WARNINGS} ${CXX_WARNINGS} ${ARCH_FLAG} ${COVERAGE_FLAGS} ${PIC_FLAG}")
if(ARM7)
message(STATUS "Setting ARM7 C and C++ flags")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -mfloat-abi=hard")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -mfloat-abi=hard")
# With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that
# is fixed in the code (Issue #847), force compiler to be conservative.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
if(ARM)
message(STATUS "Setting FPU Flags for ARM Processors")
#NB NEON hardware does not fully implement the IEEE 754 standard for floating-point arithmetic
#Need custom assembly code to take full advantage of NEON SIMD
#Cortex-A5/9 -mfpu=neon-fp16
#Cortex-A7/15 -mfpu=neon-vfpv4
#Cortex-A8 -mfpu=neon
#ARMv8 -FP and SIMD on by default for all ARM8v-A series, NO -mfpu setting needed
#For custom -mtune, processor IDs for ARMv8-A series:
#0xd04 - Cortex-A35
#0xd07 - Cortex-A57
#0xd08 - Cortex-A72
#0xd03 - Cortex-A73
if(NOT ARM8)
CHECK_CXX_ACCEPTS_FLAG(-mfpu=vfp3-d16 CXX_ACCEPTS_VFP3_D16)
CHECK_CXX_ACCEPTS_FLAG(-mfpu=vfp4 CXX_ACCEPTS_VFP4)
CHECK_CXX_ACCEPTS_FLAG(-mfloat-abi=hard CXX_ACCEPTS_MFLOAT_HARD)
CHECK_CXX_ACCEPTS_FLAG(-mfloat-abi=softfp CXX_ACCEPTS_MFLOAT_SOFTFP)
endif()
if(ARM8)
CHECK_CXX_ACCEPTS_FLAG(-mfix-cortex-a53-835769 CXX_ACCEPTS_MFIX_CORTEX_A53_835769)
CHECK_CXX_ACCEPTS_FLAG(-mfix-cortex-a53-843419 CXX_ACCEPTS_MFIX_CORTEX_A53_843419)
endif()
if(ARM6)
message(STATUS "Selecting VFP for ARMv6")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp")
endif(ARM6)
if(ARM7)
if(CXX_ACCEPTS_VFP3_D16 AND NOT CXX_ACCEPTS_VFP4)
message(STATUS "Selecting VFP3 for ARMv7")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp3-d16")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp3-d16")
endif()
if(CXX_ACCEPTS_VFP4)
message(STATUS "Selecting VFP4 for ARMv7")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=vfp4")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=vfp4")
endif()
if(CXX_ACCEPTS_MFLOAT_HARD)
message(STATUS "Setting Hardware ABI for Floating Point")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=hard")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=hard")
endif()
if(CXX_ACCEPTS_MFLOAT_SOFTFP AND NOT CXX_ACCEPTS_MFLOAT_HARD)
message(STATUS "Setting Software ABI for Floating Point")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=softfp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=softfp")
endif()
endif(ARM7)
if(ARM8)
if(CXX_ACCEPTS_MFIX_CORTEX_A53_835769)
message(STATUS "Enabling Cortex-A53 workaround 835769")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfix-cortex-a53-835769")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfix-cortex-a53-835769")
endif()
if(CXX_ACCEPTS_MFIX_CORTEX_A53_843419)
message(STATUS "Enabling Cortex-A53 workaround 843419")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfix-cortex-a53-843419")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfix-cortex-a53-843419")
endif()
endif(ARM8)
endif(ARM)
if(ANDROID AND NOT BUILD_GUI_DEPS STREQUAL "ON" OR IOS)
#From Android 5: "only position independent executables (PIE) are supported"
message(STATUS "Enabling PIE executable")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -fPIE -pie")
endif()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGTEST_HAS_TR1_TUPLE=0")
endif()
set(DEBUG_FLAGS "-g3")
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8))
set(DEBUG_FLAGS "-g3 -Og")
set(DEBUG_FLAGS "${DEBUG_FLAGS} -Og ")
else()
set(DEBUG_FLAGS "-g3 -O0")
set(DEBUG_FLAGS "${DEBUG_FLAGS} -O0 ")
endif()
if(NOT DEFINED USE_LTO_DEFAULT)
set(USE_LTO_DEFAULT true)
set(USE_LTO_DEFAULT false)
endif()
set(USE_LTO ${USE_LTO_DEFAULT} CACHE BOOL "Use Link-Time Optimization (Release mode only)")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# There is a clang bug that does not allow to compile code that uses AES-NI intrinsics if -flto is enabled, so explicitly disable
set(USE_LTO false)
# explicitly define stdlib for older versions of clang
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
endif()
@@ -382,9 +594,16 @@ else()
set(RELEASE_FLAGS "${RELEASE_FLAGS} -ffat-lto-objects")
endif()
# Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0) AND NOT OPENBSD)
set(CMAKE_AR "gcc-ar")
set(CMAKE_RANLIB "gcc-ranlib")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.0) AND NOT OPENBSD AND NOT DRAGONFLY)
# When invoking cmake on distributions on which gcc's binaries are prefixed
# with an arch-specific triplet, the user must specify -DCHOST=<prefix>
if (DEFINED CHOST)
set(CMAKE_AR "${CHOST}-gcc-ar")
set(CMAKE_RANLIB "${CHOST}-gcc-ranlib")
else()
set(CMAKE_AR "gcc-ar")
set(CMAKE_RANLIB "gcc-ranlib")
endif()
endif()
endif()
@@ -392,8 +611,19 @@ else()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
if(STATIC AND NOT APPLE AND NOT FREEBSD AND NOT OPENBSD)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
if(STATIC)
# STATIC already configures most deps to be linked in statically,
# here we make more deps static if the platform permits it
if (MINGW)
# On Windows, this is as close to fully-static as we get:
# this leaves only deps on /c/Windows/system32/*.dll
set(STATIC_FLAGS "-static")
elseif (NOT (APPLE OR FREEBSD OR OPENBSD OR DRAGONFLY))
# On Linux, we don't support fully static build, but these can be static
set(STATIC_FLAGS "-static-libgcc -static-libstdc++")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${STATIC_FLAGS} ")
endif()
endif()
@@ -410,32 +640,69 @@ if(STATIC)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
endif()
find_package(Boost 1.53 QUIET REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options)
find_package(Boost 1.58 QUIET REQUIRED COMPONENTS system filesystem thread date_time chrono regex serialization program_options)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_LIB_SUFFIXES})
if(NOT Boost_FOUND)
die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.53 or 1.55+) or the equivalent")
endif()
if((Boost_MAJOR_VERSION EQUAL 1) AND (Boost_MINOR_VERSION EQUAL 54))
die("Boost version 1.54 is unsupported due to a bug (see: http://goo.gl/RrCFmA), please install Boost 1.53 or 1.55 and above")
die("Could not find Boost libraries, please make sure you have installed Boost or libboost-all-dev (1.58) or the equivalent")
elseif(Boost_FOUND)
message(STATUS "Found Boost Version: ${Boost_VERSION}")
endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MINGW)
set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi)
elseif(APPLE OR FREEBSD OR OPENBSD)
elseif(APPLE OR OPENBSD OR ANDROID)
set(EXTRA_LIBRARIES "")
elseif(FREEBSD)
set(EXTRA_LIBRARIES execinfo)
elseif(DRAGONFLY)
find_library(COMPAT compat)
set(EXTRA_LIBRARIES execinfo ${COMPAT})
elseif(NOT MSVC)
find_library(RT rt)
set(EXTRA_LIBRARIES ${RT})
endif()
list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS})
option(USE_READLINE "Build with GNU readline support." ON)
if(USE_READLINE)
find_package(Readline)
if(READLINE_FOUND AND GNU_READLINE_FOUND)
add_definitions(-DHAVE_READLINE)
include_directories(${Readline_INCLUDE_DIR})
list(APPEND EXTRA_LIBRARIES ${Readline_LIBRARY})
message(STATUS "Found readline library at: ${Readline_ROOT_DIR}")
else()
message(STATUS "Could not find GNU readline library so building without readline support")
endif()
endif()
if(ANDROID)
set(ATOMIC libatomic.a)
endif()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ARCH_WIDTH EQUAL "32" AND NOT IOS)
find_library(ATOMIC atomic)
list(APPEND EXTRA_LIBRARIES ${ATOMIC})
endif()
include(version.cmake)
function (treat_warnings_as_errors dirs)
foreach(dir ${ARGV})
set_property(DIRECTORY ${dir}
APPEND PROPERTY COMPILE_FLAGS "-Werror")
endforeach()
endfunction()
add_subdirectory(contrib)
add_subdirectory(src)
treat_warnings_as_errors(contrib src)
option(BUILD_TESTS "Build tests." OFF)
if(BUILD_TESTS)
add_subdirectory(tests)
endif()
@@ -464,3 +731,11 @@ if(BUILD_DOCUMENTATION)
endif()
endif()
# when ON - will install libwallet_merged into "lib"
option(BUILD_GUI_DEPS "Build GUI dependencies." OFF)
# This is not nice, distribution packagers should not enable this, but depend
# on libunbound shipped with their distribution instead
option(INSTALL_VENDORED_LIBUNBOUND "Install libunbound binary built from source vendored with this repo." OFF)

164
CMakeLists_IOS.txt Normal file
View File

@@ -0,0 +1,164 @@
# Portions Copyright (c) 2017, The Monero Project
# This file is based off of the https://code.google.com/archive/p/ios-cmake/
# It has been altered for Monero iOS development
#
#
# Options:
#
# IOS_PLATFORM = OS (default) or SIMULATOR or SIMULATOR64
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
#
# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
# If set manually, it will override the default location and force the user of a particular Developer Platform
#
# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
# If set manually, this will force the use of a specific SDK version
# Standard settings
set (CMAKE_SYSTEM_NAME Darwin)
set (CMAKE_SYSTEM_VERSION 1)
set (UNIX True)
set (APPLE True)
set (IOS True)
# Required as of cmake 2.8.10
set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE)
# Determine the cmake host system version so we know where to find the iOS SDKs
find_program (CMAKE_UNAME uname /bin /usr/bin /usr/local/bin)
if (CMAKE_UNAME)
exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
string (REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
endif (CMAKE_UNAME)
# Force the compilers to gcc for iOS
include (CMakeForceCompiler)
# set (MAKE_C_COMPILER "/usr/bin/gcc Apple")
# set (CMAKE_CXX_COMPILER "/usr/bin/g++ Apple")
set(CMAKE_AR ar CACHE FILEPATH "" FORCE)
# Skip the platform compiler checks for cross compiling
set (CMAKE_CXX_COMPILER_WORKS TRUE)
set (CMAKE_C_COMPILER_WORKS TRUE)
# All iOS/Darwin specific settings - some may be redundant
set (CMAKE_SHARED_LIBRARY_PREFIX "lib")
set (CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
set (CMAKE_SHARED_MODULE_PREFIX "lib")
set (CMAKE_SHARED_MODULE_SUFFIX ".so")
set (CMAKE_MODULE_EXISTS 1)
set (CMAKE_DL_LIBS "")
set (CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
set (CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
set (CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
# Hidden visibilty is required for cxx on iOS
set (CMAKE_C_FLAGS_INIT "")
set (CMAKE_CXX_FLAGS_INIT "-fvisibility=hidden -fvisibility-inlines-hidden")
set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
set (CMAKE_PLATFORM_HAS_INSTALLNAME 1)
set (CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
set (CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
set (CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
set (CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
set (CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
# Setup iOS platform unless specified manually with IOS_PLATFORM
if (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM "OS")
endif (NOT DEFINED IOS_PLATFORM)
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
# Setup building for arm64 or not
if (NOT DEFINED BUILD_ARM64)
set (BUILD_ARM64 true)
endif (NOT DEFINED BUILD_ARM64)
set (BUILD_ARM64 ${BUILD_ARM64} CACHE STRING "Build arm64 arch or not")
# Check the platform selection and setup for developer root
if (${IOS_PLATFORM} STREQUAL "OS")
set (IOS_PLATFORM_LOCATION "iPhoneOS.platform")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
set (SIMULATOR true)
set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR64")
set (SIMULATOR true)
set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
# This causes the installers to properly locate the output libraries
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
else (${IOS_PLATFORM} STREQUAL "OS")
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
endif (${IOS_PLATFORM} STREQUAL "OS")
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
# Note Xcode 4.3 changed the installation location, choose the most recent one available
exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE CMAKE_XCODE_DEVELOPER_DIR)
set (XCODE_POST_43_ROOT "${CMAKE_XCODE_DEVELOPER_DIR}/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
set (XCODE_PRE_43_ROOT "/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
if (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
if (EXISTS ${XCODE_POST_43_ROOT})
set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_POST_43_ROOT})
elseif(EXISTS ${XCODE_PRE_43_ROOT})
set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_PRE_43_ROOT})
endif (EXISTS ${XCODE_POST_43_ROOT})
endif (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
set (CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
# Find and use the most recent iOS sdk unless specified manually with CMAKE_IOS_SDK_ROOT
if (NOT DEFINED CMAKE_IOS_SDK_ROOT)
file (GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*")
if (_CMAKE_IOS_SDKS)
list (SORT _CMAKE_IOS_SDKS)
list (REVERSE _CMAKE_IOS_SDKS)
list (GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT)
else (_CMAKE_IOS_SDKS)
message (FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
endif (_CMAKE_IOS_SDKS)
message (STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}")
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
set (CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
# Set the sysroot default to the most recent SDK
set (CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
# set the architecture for iOS
if (NOT DEFINED ARCH)
set (ARCH armv7)
endif()
set (IOS_ARCH ${ARCH})
set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE string "Build architecture for iOS")
message(STATUS "ios arch: ${IOS_ARCH}")
# Set the find root to the iOS developer roots and to user defined paths
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE string "iOS find search path root")
# default to searching for frameworks first
set (CMAKE_FIND_FRAMEWORK FIRST)
# set up the default search directories for frameworks
set (CMAKE_SYSTEM_FRAMEWORK_PATH
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
)
message(STATUS "IOS CMAKE conf finished")

40
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,40 @@
# Contributing to Monero
A good way to help is to test, and report bugs. See
[How to Report Bugs Effectively (by Simon Tatham)](http://www.chiark.greenend.org.uk/~sgtatham/bugs.html)
if you want to help that way. Testing is invaluable in making a piece
of software solid and usable.
## General Guidelines
* Comments are encouraged.
* If modifying code for which Doxygen headers exist, that header must be modified to match.
* Tests would be nice to have if you're adding functionality.
Patches are preferably to be sent via a github pull request. If that
can't be done, patches in "git format-patch" format can be sent
(eg, posted to fpaste.org with a long enough timeout and a link
posted to #monero-dev on irc.freenode.net).
Patches should be self contained. A good rule of thumb is to have
one patch per separate issue, feature, or logical change. Also, no
other changes, such as random whitespace changes or reindentation.
Following the code style of the particular chunk of code you're
modifying is encourgaged. Proper squashing should be done (eg, if
you're making a buggy patch, then a later patch to fix the bug,
both patches should be merged).
## Commits and Pull Requests
Commit messages should be sensible. That means a subject line that
describes the patch, with an optional longer body that gives details,
documentation, etc.
When submitting a pull request on github, make sure your branch is
rebased. No merge commits nor stray commits from other people in
your submitted branch, please. You may be asked to rebase if there
are conflicts (even trivially resolvable ones).
PGP signing commits is strongly encouraged. That should explain why
the previous paragraph is here.

45
Dockerfile Normal file
View File

@@ -0,0 +1,45 @@
FROM ubuntu:16.04
ENV SRC_DIR /usr/local/src/monero
RUN set -x \
&& buildDeps=' \
ca-certificates \
cmake \
g++ \
git \
libboost1.58-all-dev \
libssl-dev \
make \
pkg-config \
' \
&& apt-get -qq update \
&& apt-get -qq --no-install-recommends install $buildDeps
RUN git clone https://github.com/monero-project/monero.git $SRC_DIR
WORKDIR $SRC_DIR
RUN make -j$(nproc) release-static
RUN cp build/release/bin/* /usr/local/bin/ \
\
&& rm -r $SRC_DIR \
&& apt-get -qq --auto-remove purge $buildDeps
# Contains the blockchain
VOLUME /root/.bitmonero
# Generate your wallet via accessing the container and run:
# cd /wallet
# monero-wallet-cli
VOLUME /wallet
ENV LOG_LEVEL 0
ENV P2P_BIND_IP 0.0.0.0
ENV P2P_BIND_PORT 18080
ENV RPC_BIND_IP 127.0.0.1
ENV RPC_BIND_PORT 18081
EXPOSE 18080
EXPOSE 18081
CMD monerod --log-level=$LOG_LEVEL --p2p-bind-ip=$P2P_BIND_IP --p2p-bind-port=$P2P_BIND_PORT --rpc-bind-ip=$RPC_BIND_IP --rpc-bind-port=$RPC_BIND_PORT

View File

@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
PROJECT_NAME = "Bitmonero"
PROJECT_NAME = "Monero"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version

31
LICENSE Normal file
View File

@@ -0,0 +1,31 @@
Copyright (c) 2014-2017, The Monero Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote
developers

View File

@@ -1,21 +1,21 @@
# Copyright (c) 2014-2016, The Monero Project
#
# Copyright (c) 2014-2017, The Monero Project
#
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific
# prior written permission.
#
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -35,13 +35,17 @@ cmake-debug:
debug: cmake-debug
cd build/debug && $(MAKE)
debug-test: debug
debug-test:
mkdir -p build/debug
cd build/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE) test
cd build/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE) && $(MAKE) test
debug-all:
mkdir -p build/debug
cd build/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE)
cd build/debug && cmake -D BUILD_TESTS=ON -D BUILD_SHARED_LIBS=OFF -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE)
debug-static-all:
mkdir -p build/debug
cd build/debug && cmake -D BUILD_TESTS=ON -D STATIC=ON -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE)
cmake-release:
mkdir -p build/release
@@ -50,39 +54,67 @@ cmake-release:
release: cmake-release
cd build/release && $(MAKE)
release-test: release
release-test:
mkdir -p build/release
cd build/release && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE) test
cd build/release && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE) && $(MAKE) test
release-all:
mkdir -p build/release
cd build/release && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
release-arm6:
mkdir -p build/release
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv6zk" -D BUILD_64=OFF -D NO_AES=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
release-arm7:
mkdir -p build/release
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D BUILD_64=OFF -D NO_AES=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
release-static: release-static-64
release-static-64:
release-static:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
release-static-32:
coverage:
mkdir -p build/debug
cd build/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug -D COVERAGE=ON ../.. && $(MAKE) && $(MAKE) test
# Targets for specific prebuilt builds which will be advertised for updates by their build tag
release-static-linux-armv6:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv6zk" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-armv6" ../.. && $(MAKE)
release-static-linux-armv7:
mkdir -p build/release
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-armv7" ../.. && $(MAKE)
release-static-android:
mkdir -p build/release
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D INSTALL_VENDORED_LIBUNBOUND=ON -D BUILD_TAG="android" ../.. && $(MAKE)
release-static-linux-armv8:
mkdir -p build/release
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-armv8" ../.. && $(MAKE)
release-static-linux-x86_64:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-x64" ../.. && $(MAKE)
release-static-freebsd-x86_64:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="freebsd-x64" ../.. && $(MAKE)
release-static-mac-x86_64:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="mac-x64" ../.. && $(MAKE)
release-static-linux-i686:
mkdir -p build/release
cd build/release && cmake -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-x86" ../.. && $(MAKE)
release-static-win64:
mkdir -p build/release
cd build/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=../../cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 ../.. && $(MAKE)
cd build/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=../../cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 ../.. && $(MAKE)
release-static-win32:
mkdir -p build/release
cd build/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=../../cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys32 ../.. && $(MAKE)
cd build/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x32" -D CMAKE_TOOLCHAIN_FILE=../../cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys32 ../.. && $(MAKE)
fuzz:
mkdir -p build/fuzz
cd build/fuzz && cmake -D BUILD_TESTS=ON -D USE_LTO=OFF -D CMAKE_C_COMPILER=afl-gcc -D CMAKE_CXX_COMPILER=afl-g++ -D ARCH="x86-64" -D CMAKE_BUILD_TYPE=fuzz -D BUILD_TAG="linux-x64" ../.. && $(MAKE)
clean:
@echo "WARNING: Back-up your wallet if it exists within ./build!" ; \

View File

@@ -1,45 +0,0 @@
The Monero command line tools can be translated in various languages.
In order to use the same translation workflow as the future GUI, they
use Qt Linguist translation files. However, to avoid the dependencies
on Qt this normally implies, they use a custom loader to read those
files at runtime. In order to update, or build translations files, you
do need to have Qt tools installed, however. For translating, you need
either the Qt Linguist GUI, or another tool that supports Qt ts files,
such as Transifex. To run, you do not need anything Qt.
To update ts files after changing source code:
./utils/translations/update-translations.sh
To add a new language, eg Spanish (ISO code es):
cp transations/monero.ts transations/monero_es.ts
To edit translations for Spanish:
linguist translations/monero_es.ts
To build translations after modiying them:
./utils/translations/build-translations.sh
To test a translation:
LANG=es ./build/release/bin/simplewallet
To add new translatable sources in the source:
Use the tr(string) function if possible. If the code is in a class,
and this class doesn't already have a tr() static function, add one,
which uses a context named after what lupdate uses for the context,
usually the fully qualified class name (eg, cryptonote::simple_wallet).
If you need to use tr in code that's not in a class, you can use the
fully qualified version (eg, simple_wallet::tr) of the one matching
the context you want.
Use QT_TRANSLATE_NOOP(string) if you want to specify a context manually.
If you're getting messages of the form:
Class 'cryptonote::simple_wallet' lacks Q_OBJECT macro
all is fine, we don't actually need that here.

44
README.i18n.md Normal file
View File

@@ -0,0 +1,44 @@
Monero daemon internationalization
==================================
The Monero command line tools can be translated in various languages.
In order to use the same translation workflow as the [Monero Core GUI](https://github.com/monero-project/monero-core), they use Qt Linguist translation files. However, to avoid the dependencies on Qt this normally implies, they use a custom loader to read those files at runtime.
### Tools for translators
In order to create, update or build translations files, you need to have Qt tools installed. For translating, you need either the **Qt Linguist GUI** ([part of QT Creator](https://www.qt.io/download-open-source/#allDownloadsDiv-9) or a [3rd-party standalone version](https://github.com/lelegard/qtlinguist-installers/releases)), or another tool that supports Qt ts files, such as Transifex. The files are XML, so they can be edited in any plain text editor if needed.
### Creating / modifying translations
You do not need anything from Qt in order to use the final translations.
To update ts files after changing source code:
./utils/translations/update-translations.sh
To add a new language, eg Spanish (ISO code es):
cp translations/monero.ts translations/monero_es.ts
To edit translations for Spanish:
linguist translations/monero_es.ts
To build translations after modifying them:
./utils/translations/build-translations.sh
To test a translation:
LANG=es ./build/release/bin/monero-wallet-cli
To add new translatable strings in the source code:
Use the `tr(string)` function if possible. If the code is in a class, and this class doesn't already have a `tr()` static function, add one, which uses a context named after what `lupdate` uses for the context, usually the fully qualified class name (eg, `cryptonote::simple_wallet`). If you need to use `tr()` in code that's not in a class, you can use the fully qualified version (eg, `simple_wallet::tr`) of the one matching the context you want. Use `QT_TRANSLATE_NOOP(string)` if you want to specify a context manually.
If you're getting messages of the form:
Class 'cryptonote::simple_wallet' lacks Q_OBJECT macro
all is fine, we don't actually need that here.

455
README.md
View File

@@ -1,23 +1,47 @@
# Monero
Copyright (c) 2014-2016, The Monero Project
Copyright (c) 2014-2017, The Monero Project
Portions Copyright (c) 2012-2013, The Cryptonote developers
## Development Resources
Web: [getmonero.org](https://getmonero.org)
Forum: [forum.getmonero.org](https://forum.getmonero.org)
Mail: [dev@getmonero.org](mailto:dev@getmonero.org)
Github (staging): [https://github.com/monero-project/bitmonero](https://github.com/monero-project/bitmonero)
Github (development): [http://github.com/monero-project/bitmonero/tree/development](http://github.com/monero-project/bitmonero/tree/development)
IRC: [#monero-dev on Freenode](irc://chat.freenode.net/#monero-dev)
- Web: [getmonero.org](https://getmonero.org)
- Forum: [forum.getmonero.org](https://forum.getmonero.org)
- Mail: [dev@getmonero.org](mailto:dev@getmonero.org)
- GitHub: [https://github.com/monero-project/monero](https://github.com/monero-project/monero)
- IRC: [#monero-dev on Freenode](http://webchat.freenode.net/?randomnick=1&channels=%23monero-dev&prompt=1&uio=d4)
## Build
| Operating System | Processor | Status |
| --------------------- | -------- |--------|
| Ubuntu 16.04 | i686 | [![Ubuntu 16.04 i686](https://build.getmonero.org/png?builder=monero-static-ubuntu-i686)](https://build.getmonero.org/builders/monero-static-ubuntu-i686)
| Ubuntu 16.04 | amd64 | [![Ubuntu 16.04 amd64](https://build.getmonero.org/png?builder=monero-static-ubuntu-amd64)](https://build.getmonero.org/builders/monero-static-ubuntu-amd64)
| Ubuntu 16.04 | armv7 | [![Ubuntu 16.04 armv7](https://build.getmonero.org/png?builder=monero-static-ubuntu-arm7)](https://build.getmonero.org/builders/monero-static-ubuntu-arm7)
| Debian Stable | armv8 | [![Debian armv8](https://build.getmonero.org/png?builder=monero-static-debian-armv8)](https://build.getmonero.org/builders/monero-static-debian-armv8)
| OSX 10.10 | amd64 | [![OSX 10.10 amd64](https://build.getmonero.org/png?builder=monero-static-osx-10.10)](https://build.getmonero.org/builders/monero-static-osx-10.10)
| OSX 10.11 | amd64 | [![OSX 10.11 amd64](https://build.getmonero.org/png?builder=monero-static-osx-10.11)](https://build.getmonero.org/builders/monero-static-osx-10.11)
| OSX 10.12 | amd64 | [![OSX 10.12 amd64](https://build.getmonero.org/png?builder=monero-static-osx-10.12)](https://build.getmonero.org/builders/monero-static-osx-10.12)
| FreeBSD 11 | amd64 | [![FreeBSD 11 amd64](https://build.getmonero.org/png?builder=monero-static-freebsd64)](https://build.getmonero.org/builders/monero-static-freebsd64)
| DragonFly BSD 4.6 | amd64 | [![DragonFly BSD amd64](https://build.getmonero.org/png?builder=monero-static-dragonflybsd-amd64)](https://build.getmonero.org/builders/monero-static-dragonflybsd-amd64)
| Windows (MSYS2/MinGW) | i686 | [![Windows (MSYS2/MinGW) i686](https://build.getmonero.org/png?builder=monero-static-win32)](https://build.getmonero.org/builders/monero-static-win32)
| Windows (MSYS2/MinGW) | amd64 | [![Windows (MSYS2/MinGW) amd64](https://build.getmonero.org/png?builder=monero-static-win64)](https://build.getmonero.org/builders/monero-static-win64)
## Coverage
| Type | Status |
|-----------|--------|
| Coverity | [![Coverity Status](https://scan.coverity.com/projects/9657/badge.svg)](https://scan.coverity.com/projects/9657/)
| Coveralls | [![Coveralls Status](https://coveralls.io/repos/github/monero-project/monero/badge.svg?branch=master)](https://coveralls.io/github/monero-project/monero?branch=master)
| License | [![License](https://img.shields.io/badge/license-BSD3-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)
## Introduction
Monero is a private, secure, untraceable currency. You are your bank, you control your funds, and nobody can trace your transfers unless you decide so.
Monero is a private, secure, untraceable, decentralised digital currency. You are your bank, you control your funds, and nobody can trace your transfers unless you allow them to do so.
**Privacy:** Monero uses a cryptographically sound system to allow you to send and receive funds without your transactions being easily revealed on the blockchain (the ledger of transactions that everyone has). This ensures that your purchases, receipts, and all transfers remain absolutely private by default.
**Security:** Using the power of a distributed peer-to-peer consensus network, every transaction on the network is cryptographically secured. Individual wallets have a 24 word mnemonic seed that is only displayed once, and can be written down to backup the wallet. Wallet files are encrypted with a passphrase to ensure they are useless if stolen.
**Security:** Using the power of a distributed peer-to-peer consensus network, every transaction on the network is cryptographically secured. Individual wallets have a 25 word mnemonic seed that is only displayed once, and can be written down to backup the wallet. Wallet files are encrypted with a passphrase to ensure they are useless if stolen.
**Untraceability:** By taking advantage of ring signatures, a special property of a certain type of cryptography, Monero is able to ensure that transactions are not only untraceable, but have an optional measure of ambiguity that ensures that transactions cannot easily be tied back to an individual user or computer.
@@ -25,9 +49,9 @@ Monero is a private, secure, untraceable currency. You are your bank, you contro
This is the core implementation of Monero. It is open source and completely free to use without restrictions, except for those specified in the license agreement below. There are no restrictions on anyone creating an alternative implementation of Monero that uses the protocol and network in a compatible manner.
As with many development projects, the repository on Github is considered to be the "staging" area for the latest changes. Before changes are merged into that branch on the main repository, they are tested by individual developers, committed to the "development" branch, and then subsequently tested by contributors who focus on thorough testing and code reviews. That having been said, the repository should be carefully considered before using it in a production environment, unless there is a patch in the repository for a particular show-stopping issue you are experiencing. It is generally a better idea to use a tagged release for stability.
As with many development projects, the repository on Github is considered to be the "staging" area for the latest changes. Before changes are merged into that branch on the main repository, they are tested by individual developers in their own branches, submitted as a pull request, and then subsequently tested by contributors who focus on testing and code reviews. That having been said, the repository should be carefully considered before using it in a production environment, unless there is a patch in the repository for a particular show-stopping issue you are experiencing. It is generally a better idea to use a tagged release for stability.
Anyone is welcome to contribute to Monero. If you have a fix or code change, feel free to submit is as a pull request directly to the "development" branch. In cases where the change is relatively small or does not affect other parts of the codebase it may be merged in immediately by any one of the collaborators. On the other hand, if the change is particularly large or complex, it is expected that it will be discussed at length either well in advance of the pull request being submitted, or even directly on the pull request.
**Anyone is welcome to contribute to Monero's codebase!** If you have a fix or code change, feel free to submit it as a pull request directly to the "master" branch. In cases where the change is relatively small or does not affect other parts of the codebase it may be merged in immediately by any one of the collaborators. On the other hand, if the change is particularly large or complex, it is expected that it will be discussed at length either well in advance of the pull request being submitted, or even directly on the pull request.
## Supporting the Project
@@ -35,130 +59,252 @@ Monero development can be supported directly through donations.
Both Monero and Bitcoin donations can be made to donate.getmonero.org if using a client that supports the [OpenAlias](https://openalias.org) standard
The Monero donation address is: 44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A (viewkey: f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501)
The Monero donation address is: `44AFFq5kSiGBoZ4NMDwYtN18obc8AemS33DBLWs3H7otXft3XjrpDtQGv7SqSsaBYBb98uNbr2VBBEt7f2wfn3RVGQBEP3A` (viewkey: `f359631075708155cc3d92a32b75a7d02a5dcf27756707b47a2b31b21c389501`)
The Bitcoin donation address is: 1KTexdemPdxSBcG55heUuTjDRYqbC5ZL8H
The Bitcoin donation address is: `1KTexdemPdxSBcG55heUuTjDRYqbC5ZL8H`
*Note: you can easily donate XMR to the Monero donation address by using the `donate` command. Type `help` in the command-line wallet for details.*
Core development funding and/or some supporting services are also graciously provided by sponsors:
[![MyMonero](https://static.getmonero.org/images/sponsors/mymonero.png)](https://mymonero.com) [![Kitware](https://static.getmonero.org/images/sponsors/kitware.png?1)](http://kitware.com) [![Dome9](https://static.getmonero.org/images/sponsors/dome9.png)](http://dome9.com) [![Araxis](https://static.getmonero.org/images/sponsors/araxis.png)](http://araxis.com) [![JetBrains](https://static.getmonero.org/images/sponsors/jetbrains.png)](http://www.jetbrains.com/) [![Navicat](https://static.getmonero.org/images/sponsors/navicat.png)](http://www.navicat.com/)
[<img width="80" src="https://static.getmonero.org/images/sponsors/mymonero.png"/>](https://mymonero.com)
[<img width="150" src="https://static.getmonero.org/images/sponsors/kitware.png?1"/>](http://kitware.com)
[<img width="100" src="https://static.getmonero.org/images/sponsors/dome9.png"/>](http://dome9.com)
[<img width="150" src="https://static.getmonero.org/images/sponsors/araxis.png"/>](http://araxis.com)
[<img width="150" src="https://static.getmonero.org/images/sponsors/jetbrains.png"/>](http://www.jetbrains.com/)
[<img width="150" src="https://static.getmonero.org/images/sponsors/navicat.png"/>](http://www.navicat.com/)
[<img width="150" src="https://static.getmonero.org/images/sponsors/symas.png"/>](http://www.symas.com/)
There are also several mining pools that kindly donate a portion of their fees, [a list of them can be found on our Bitcointalk post](https://bitcointalk.org/index.php?topic=583449.0).
## License
Copyright (c) 2014-2016, The Monero Project
See [LICENSE](LICENSE).
All rights reserved.
# Contributing
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
If you want to help out, see [CONTRIBUTING](CONTRIBUTING.md) for a set of guidelines.
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
## Vulnerability Response Process
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
See [Vulnerability Response Process](VULNERABILITY_RESPONSE_PROCESS.md).
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
## Monero software updates and consensus protocol changes (hard fork schedule)
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Monero uses a fixed-schedule hard fork mechanism to implement new features. This means that users of Monero (end users and service providers) need to run current versions and update their software on a regular schedule. Here is the current schedule, versions, and compatibility.
Dates are provided in the format YYYY-MM-DD.
Parts of the project are originally copyright (c) 2012-2013 The Cryptonote developers
## Compiling Monero
| Fork Date | Consensus version | Minimum Monero Version | Recommended Monero Version | Details |
| ----------------- | ----------------- | ---------------------- | -------------------------- | ------------------ |
| 2016-09-21 | v3 | v0.9.4 | v0.10.0 | Splits coinbase into denominations |
| 2017-01-05 | v4 | v0.10.1 | v0.10.2.1 | Allow normal and RingCT transactions |
| 2017-04-15 | v5 | v0.10.3.0 | v0.10.3.1 | Adjusted minimum blocksize and fee algorithm |
| 2017-09-21 | v6 | Not determined as of 2017-03-27 | Not determined as of 2017-03-27 | Allow only RingCT transactions |
### Overview:
## Installing Monero from a Package
Dependencies: GCC 4.7.3 or later, CMake 3.0.0 or later, libunbound 1.4.16 or later (note: Unbound is not a dependency, libunbound is), libevent 2.0 or later, libgtest 1.5 or later, and Boost 1.53 or later (except 1.54, [more details here](http://goo.gl/RrCFmA)), BerkeleyDB 4.8 or later (note: on Ubuntu this means installing libdb-dev and libdb++-dev).
Static Build Additional Dependencies: ldns 1.6.17 or later, expat 1.1 or later, bison or yacc
Packages are available for
**Basic Process:**
* Ubuntu and [snap supported](https://snapcraft.io/docs/core/install) systems, via a community contributed build.
* Install the dependencies (see below for more detailed instructions for your OS)
* To build, change to the root of the source code directory, and run `make`. Please note that Windows systems follow a slightly different process, outlined below.
* The resulting executables can be found in `build/release/bin` or `build/debug/bin`, depending on what you're building.
snap install monero --beta
**Advanced options:**
Installing a snap is very quick. Snaps are secure. They are isolated with all of their dependencies. Snaps also auto update when a new version is released.
* Parallel build: run `make -j<number of threads>` instead of `make`.
* Statically linked release build: run `make release-static`.
* Debug build: run `make debug`.
* Test suite: run `make release-test` to run tests in addition to building. Running `make debug-test` will do the same to the debug version.
* Arch Linux (via [AUR](https://aur.archlinux.org/)):
- Stable release: [`monero`](https://aur.archlinux.org/packages/monero)
- Bleeding edge: [`bitmonero-git`](https://aur.archlinux.org/packages/bitmonero-git)
**Makefile Targets for Static Builds:**
* OS X via [Homebrew](http://brew.sh)
For static builds there are a number of Makefile targets to make the build process easier.
brew tap sammy007/cryptonight
brew install monero --build-from-source
* ```make release-static-win64``` builds statically for 64-bit Windows systems
* ```make release-static-win32``` builds statically for 32-bit Windows systems
* ```make release-static-64``` the default, builds statically for 64-bit non-Windows systems
* ```make release-static-32``` builds statically for 32-bit non-Windows systems
* ```make release-static-arm6``` builds statically for ARMv6 devices, such as the Raspberry Pi
* Docker
### On Linux:
docker build -t monero .
# either run in foreground
docker run -it -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero
The instructions above should provide enough detail.
# or in background
docker run -it -d -v /monero/chain:/root/.bitmonero -v /monero/wallet:/wallet -p 18080:18080 monero
### On OS X:
Packaging for your favorite distribution would be a welcome contribution!
**Basic Process:**
## Compiling Monero from Source
The project can be built from scratch by following instructions for Unix and Linux above.
### Dependencies
**Alternate Process:**
The following table summarizes the tools and libraries required to build. A
few of the libraries are also included in this repository (marked as
"Vendored"). By default, the build uses the library installed on the system,
and ignores the vendored sources. However, if no library is found installed on
the system, then the vendored source will be built and used. The vendored
sources are also used for statically-linked builds because distribution
packages often include only shared library binaries (`.so`) but not static
library archives (`.a`).
Alternatively, it can be built in an easier and more automated fashion using Homebrew:
| Dep | Min. Version | Vendored | Debian/Ubuntu Pkg | Arch Pkg | Optional | Purpose |
| -------------- | ------------- | ---------| ------------------ | -------------- | -------- | -------------- |
| GCC | 4.7.3 | NO | `build-essential` | `base-devel` | NO | |
| CMake | 3.0.0 | NO | `cmake` | `cmake` | NO | |
| pkg-config | any | NO | `pkg-config` | `base-devel` | NO | |
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | NO | C++ libraries |
| OpenSSL | basically any | NO | `libssl-dev` | `openssl` | NO | sha256 sum |
| libunbound | 1.4.16 | YES | `libunbound-dev` | `unbound` | NO | DNS resolver |
| libminiupnpc | 2.0 | YES | `libminiupnpc-dev` | `miniupnpc` | YES | NAT punching |
| libunwind | any | NO | `libunwind8-dev` | `libunwind` | YES | Stack traces |
| liblzma | any | NO | `liblzma-dev` | `xz` | YES | For libunwind |
| ldns | 1.6.17 | NO | `libldns-dev` | `ldns` | YES | SSL toolkit |
| expat | 1.1 | NO | `libexpat1-dev` | `expat` | YES | XML parsing |
| GTest | 1.5 | YES | `libgtest-dev`^ | `gtest` | YES | Test suite |
| Doxygen | any | NO | `doxygen` | `doxygen` | YES | Documentation |
| Graphviz | any | NO | `graphviz` | `graphviz` | YES | Documentation |
* Ensure Homebrew is installed, it can be found at http://brew.sh
* Add the repository to brew: `brew tap sammy007/cryptonight`
* Build Monero: `brew install bitmonero --build-from-source`
[^] On Debian/Ubuntu `libgtest-dev` only includes sources and headers. You must
build the library binary manually. This can be done with the following command ```sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv libg* /usr/lib/ ```
### On Windows:
### Build instructions
Dependencies: mingw-w64, msys2, CMake 3.0.0 or later, libunbound 1.4.16 or later (note: Unbound is not a dependency, libunbound is), and Boost 1.53 or 1.55 (except 1.54, [more details here](http://goo.gl/RrCFmA)), BerkeleyDB 4.8 or later (note: on Ubuntu this means installing libdb-dev and libdb++-dev).
Monero uses the CMake build system and a top-level [Makefile](Makefile) that
invokes cmake commands as needed.
#### On Linux and OS X
* Install the dependencies
* Change to the root of the source code directory and build:
cd monero
make
*Optional*: If your machine has several cores and enough memory, enable
parallel build by running `make -j<number of threads>` instead of `make`. For
this to be worthwhile, the machine should have one core and about 2GB of RAM
available per thread.
* The resulting executables can be found in `build/release/bin`
* Add `PATH="$PATH:$HOME/monero/build/release/bin"` to `.profile`
* Run Monero with `monerod --detach`
* **Optional**: build and run the test suite to verify the binaries:
make release-test
*NOTE*: `coretests` test may take a few hours to complete.
* **Optional**: to build binaries suitable for debugging:
make debug
* **Optional**: to build statically-linked binaries:
make release-static
* **Optional**: build documentation in `doc/html` (omit `HAVE_DOT=YES` if `graphviz` is not installed):
HAVE_DOT=YES doxygen Doxyfile
#### On the Raspberry Pi 2
Tested on a Raspberry Pi 2 with a clean install of minimal Debian Jessie from https://www.raspberrypi.org/downloads/raspbian/
* `apt-get update && apt-get upgrade` to install all of the latest software
* Install the dependencies for Monero except libunwind and libboost-all-dev
* Increase the system swap size:
```
sudo /etc/init.d/dphys-swapfile stop
sudo nano /etc/dphys-swapfile
CONF_SWAPSIZE=1024
sudo /etc/init.d/dphys-swapfile start
```
* Install the latest version of boost (this may first require invoking `apt-get remove --purge libboost*` to remove a previous version if you're not using a clean install):
```
cd
wget https://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.bz2
tar xvfo boost_1_64_0.tar.bz2
cd boost_1_64_0
./bootstrap.sh
sudo ./b2
```
* Wait ~8 hours
```
sudo ./bjam install
```
* Wait ~4 hours
* Change to the root of the source code directory and build:
```
cd monero
make release
```
* Wait ~4 hours
* The resulting executables can be found in `build/release/bin`
* Add `PATH="$PATH:$HOME/monero/build/release/bin"` to `.profile`
* Run Monero with `monerod --detach`
* You may wish to reduce the size of the swap file after the build has finished, and delete the boost directory from your home directory
#### On Windows:
Binaries for Windows are built on Windows using the MinGW toolchain within
[MSYS2 environment](http://msys2.github.io). The MSYS2 environment emulates a
POSIX system. The toolchain runs within the environment and *cross-compiles*
binaries that can run outside of the environment as a regular Windows
application.
**Preparing the Build Environment**
* Download the [MSYS2 installer](http://msys2.github.io), 64-bit or 32-bit as needed, and run it.
* Use the shortcut associated with your architecture to launch the MSYS2 environment. On 64-bit systems that would be the MinGW-w64 Win64 Shell shortcut. Note that if you are running 64-bit Windows, you will have both 64-bit and 32-bit environments.
* Update the packages in your MSYS2 install:
```
pacman -Sy
pacman -Su --ignoregroup base
pacman -Su
```
* For those of you already familiar with pacman, you can run the normal `pacman -Syu` to update, but you may get errors and need to restart MSYS2 if pacman's dependencies are updated.
* Install dependencies: `pacman -S mingw-w64-x86_64-gcc make mingw-w64-x86_64-cmake mingw-w64-x86_64-unbound mingw-w64-x86_64-boost`
* If you are planning to build statically you will also need to install: `pacman -S mingw-w64-x86_64-ldns mingw-w64-x86_64-expat` (note that these are likely already installed by the unbound dependency installation above)
* Download and install the [MSYS2 installer](http://msys2.github.io), either the 64-bit or the 32-bit package, depending on your system.
* Open the MSYS shell via the `MSYS2 Shell` shortcut
* Update packages using pacman:
pacman -Syuu
* Exit the MSYS shell using Alt+F4
* Edit the properties for the `MSYS2 Shell` shortcut changing "msys2_shell.bat" to "msys2_shell.cmd -mingw64" for 64-bit builds or "msys2_shell.cmd -mingw32" for 32-bit builds
* Restart MSYS shell via modified shortcut and update packages again using pacman:
pacman -Syuu
* Install dependencies:
To build for 64-bit Windows:
pacman -S mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-boost
To build for 32-bit Windows:
pacman -S mingw-w64-i686-toolchain make mingw-w64-i686-cmake mingw-w64-i686-boost
* Open the MingW shell via `MinGW-w64-Win64 Shell` shortcut on 64-bit Windows
or `MinGW-w64-Win64 Shell` shortcut on 32-bit Windows. Note that if you are
running 64-bit Windows, you will have both 64-bit and 32-bit MinGW shells.
**Building**
* From the root of the source code directory run:
```
mkdir build
cd build
```
* If you are on a 64-bit system, run:
```
cmake -G "MSYS Makefiles" -D CMAKE_BUILD_TYPE=Release -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_TOOLCHAIN_FILE=../cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 ..
```
make release-static-win64
* If you are on a 32-bit system, run:
```
cmake -G "MSYS Makefiles" -D CMAKE_BUILD_TYPE=Release -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_TOOLCHAIN_FILE=../cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys32 ..
```
* You can now run `make` to have it build
* The resulting executables can be found in `build/release/bin` or `build/debug/bin`, depending on what you're building.
If you installed MSYS2 in a folder other than c:/msys64, make the appropriate substitution above.
make release-static-win32
**Advanced options:**
* Parallel build: run `make -j<number of threads>` instead of `make`.
* Statically linked release build: run `make release-static`.
* Debug build: run `make debug`.
* Test suite: run `make release-test` to run tests in addition to building. Running `make debug-test` will do the same to the debug version.
* The resulting executables can be found in `build/release/bin`
### On FreeBSD:
The project can be built from scratch by following instructions for Unix and Linux above.
The project can be built from scratch by following instructions for Linux above. If you are running monero in a jail you need to add the flag: `allow.sysvipc=1` to your jail configuration, otherwise lmdb will throw the error message: `Failed to open lmdb environment: Function not implemented`.
We expect to add Monero into the ports tree in the near future, which will aid in managing installations using ports or packages.
@@ -177,28 +323,143 @@ You will have to add the serialization, date_time, and regex modules to Boost wh
To build: `env CC=egcc CXX=eg++ CPP=ecpp DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/path/to/the/boost/you/built make release-static-64`
## Building Documentation
### On Linux for Android (using docker):
Monero developer documentation uses Doxygen, and is currently a work-in-progress.
# Build image (select android64.Dockerfile for aarch64)
cd utils/build_scripts/ && docker build -f android32.Dockerfile -t monero-android .
# Create container
docker create -it --name monero-android monero-android bash
# Get binaries
docker cp monero-android:/opt/android/monero/build/release/bin .
Dependencies: Doxygen 1.8.0 or later, Graphviz 2.28 or later (optional).
### Building Portable Statically Linked Binaries
* To build, change to the root of the source code directory, and run `doxygen Doxyfile`
* If you have installed Graphviz, you can also generate in-doc diagrams by instead running `HAVE_DOT=YES doxygen Doxyfile`
* The output will be built in doc/html/
By default, in either dynamically or statically linked builds, binaries target the specific host processor on which the build happens and are not portable to other processors. Portable binaries can be built using the following targets:
* ```make release-static-64``` builds binaries on Linux on x86_64 portable across POSIX systems on x86_64 processors
* ```make release-static-32``` builds binaries on Linux on x86_64 or i686 portable across POSIX systems on i686 processors
* ```make release-static-armv8``` builds binaries on Linux portable across POSIX systems on armv8 processors
* ```make release-static-armv7``` builds binaries on Linux portable across POSIX systems on armv7 processors
* ```make release-static-armv6``` builds binaries on Linux portable across POSIX systems on armv6 processors
* ```make release-static-win64``` builds binaries on 64-bit Windows portable across 64-bit Windows systems
* ```make release-static-win32``` builds binaries on 64-bit or 32-bit Windows portable across 32-bit Windows systems
## Running monerod
The build places the binary in `bin/` sub-directory within the build directory
from which cmake was invoked (repository root by default). To run in
foreground:
./bin/monerod
To list all available options, run `./bin/monerod --help`. Options can be
specified either on the command line or in a configuration file passed by the
`--config-file` argument. To specify an option in the configuration file, add
a line with the syntax `argumentname=value`, where `argumentname` is the name
of the argument without the leading dashes, for example `log-level=1`.
To run in background:
./bin/monerod --log-file monerod.log --detach
To run as a systemd service, copy
[monerod.service](utils/systemd/monerod.service) to `/etc/systemd/system/` and
[monerod.conf](utils/conf/monerod.conf) to `/etc/`. The [example
service](utils/systemd/monerod.service) assumes that the user `monero` exists
and its home is the data directory specified in the [example
config](utils/conf/monerod.conf).
If you're on Mac, you may need to add the `--max-concurrency 1` option to
monero-wallet-cli, and possibly monerod, if you get crashes refreshing.
## Internationalization
See README.i18n
See [README.i18n.md](README.i18n.md).
## Using Tor
While Monero isn't made to integrate with Tor, it can be used wrapped with torsocks, if you add --p2p-bind-ip 127.0.0.1 to the bitmonerod command line. You also want to set DNS requests to go over TCP, so they'll be routed through Tor, by setting DNS_PUBLIC=tcp. You may also disable IGD (UPnP port forwarding negotiation), which is pointless with Tor. To allow local connections from the wallet, add TORSOCKS_ALLOW_INBOUND=1. Example:
While Monero isn't made to integrate with Tor, it can be used wrapped with torsocks, if you add --p2p-bind-ip 127.0.0.1 to the monerod command line. You also want to set DNS requests to go over TCP, so they'll be routed through Tor, by setting DNS_PUBLIC=tcp. You may also disable IGD (UPnP port forwarding negotiation), which is pointless with Tor. To allow local connections from the wallet, you might have to add TORSOCKS_ALLOW_INBOUND=1, some OSes need it and some don't. Example:
DNS_PUBLIC=tcp TORSOCKS_ALLOW_INBOUND=1 torsocks bitmonerod --p2p-bind-ip 127.0.0.1 --no-igd
`DNS_PUBLIC=tcp torsocks monerod --p2p-bind-ip 127.0.0.1 --no-igd`
or:
`DNS_PUBLIC=tcp TORSOCKS_ALLOW_INBOUND=1 torsocks monerod --p2p-bind-ip 127.0.0.1 --no-igd`
TAILS ships with a very restrictive set of firewall rules. Therefore, you need to add a rule to allow this connection too, in addition to telling torsocks to allow inbound connections. Full example:
`sudo iptables -I OUTPUT 2 -p tcp -d 127.0.0.1 -m tcp --dport 18081 -j ACCEPT`
`DNS_PUBLIC=tcp torsocks ./monerod --p2p-bind-ip 127.0.0.1 --no-igd --rpc-bind-ip 127.0.0.1 --data-dir /home/amnesia/Persistent/your/directory/to/the/blockchain`
`./monero-wallet-cli`
## Using readline
While bitmonerod and simplewallet do not use readline directly, most of the functionality can be obtained by running them via rlwrap. This allows command recall, edit capabilities, etc. It does not give autocompletion without an extra completion file, however. To use rlwrap, simply prepend "rlwrap " to the command line, eg:
rlwrap bin/simplewallet --wallet-file /path/to/wallet
While monerod and monero-wallet-cli do not use readline directly, most of the functionality can be obtained by running them via rlwrap. This allows command recall, edit capabilities, etc. It does not give autocompletion without an extra completion file, however. To use rlwrap, simply prepend `rlwrap` to the command line, eg:
`rlwrap bin/monero-wallet-cli --wallet-file /path/to/wallet`
Note: rlwrap will save things like your seed and private keys, if you supply them on prompt. You may want to not use rlwrap when you use simplewallet to restore from seed, etc.
# Debugging
This section contains general instructions for debugging failed installs or problems encountered with Monero. First ensure you are running the latest version built from the github repo.
## Obtaining Stack Traces and Core Dumps on Unix Systems
We generally use the tool `gdb` (GNU debugger) to provide stack trace functionality, and `ulimit` to provide core dumps in builds which crash or segfault.
* To use gdb in order to obtain a stack trace for a build that has stalled:
Run the build.
Once it stalls, enter the following command:
```
gdb /path/to/monerod `pidof monerod`
```
Type `thread apply all bt` within gdb in order to obtain the stack trace
* If however the core dumps or segfaults:
Enter `ulimit -c unlimited` on the command line to enable unlimited filesizes for core dumps
Run the build.
When it terminates with an output along the lines of "Segmentation fault (core dumped)", there should be a core dump file in the same directory as monerod.
You can now analyse this core dump with `gdb` as follows:
`gdb /path/to/monerod /path/to/dumpfile`
Print the stack trace with `bt`
* To run monero within gdb:
Type `gdb /path/to/monerod`
Pass command-line options with `--args` followed by the relevant arguments
Type `run` to run monerod
## Analysing Memory Corruption
We use the tool `valgrind` for this.
Run with `valgrind /path/to/monerod`. It will be slow.
## LMDB
Instructions for debugging suspected blockchain corruption as per @HYC
There is an `mdb_stat` command in the LMDB source that can print statistics about the database but it's not routinely built. This can be built with the following command:
`cd ~/monero/external/db_drivers/liblmdb && make`
The output of `mdb_stat -ea <path to blockchain dir>` will indicate inconsistencies in the blocks, block_heights and block_info table.
The output of `mdb_dump -s blocks <path to blockchain dir>` and `mdb_dump -s block_info <path to blockchain dir>` is useful for indicating whether blocks and block_info contain the same keys.
These records are dumped as hex data, where the first line is the key and the second line is the data.

View File

@@ -0,0 +1,143 @@
# Monero Vulnerability Response Process
## Preamble
Researchers/Hackers: while you research/hack, we ask that you please refrain from committing the following:
- Denial of Service / Active exploiting against the network
- Social Engineering of Monero staff or contractors
- Any physical or electronic attempts against Monero community property and/or data centers
## I. Point of Contacts for Security Issues
```
ric@getmonero.org
BDA6 BD70 42B7 21C4 67A9 759D 7455 C5E3 C0CD CEB9
luigi1111@getmonero.org
8777 AB8F 778E E894 87A2 F8E7 F4AC A018 3641 E010
moneromooo.monero@gmail.com
48B0 8161 FBDA DFE3 93AD FC3E 686F 0745 4D6C EFC3
```
## II. Security Response Team
- fluffypony
- luigi1111
- moneromooo
## III. Incident Response
1. Researcher submits report via one or both of two methods:
- a. Email
- b. [HackerOne](https://hackerone.com/monero)
2. Response Team designates a Response Manager who is in charge of the particular report based on availability and/or knowledge-set
3. In no more than 3 working days, Response Team should gratefully respond to researcher using only encrypted, secure channels
4. Response Manager makes inquiries to satisfy any needed information to confirm if submission is indeed a vulnerability
- a. If submission proves to be vulnerable, proceed to next step
- b. If not vulnerable:
- i. Response Manager responds with reasons why submission is not a vulnerability
- ii. Response Manager moves discussion to a new or existing ticket on GitHub if necessary
5. If over email, Response Manager opens a HackerOne issue for new submission
6. Establish severity of vulnerability:
- a. HIGH: impacts network as a whole, has potential to break entire network, results in the loss of monero, or is on a scale of great catastrophe
- b. MEDIUM: impacts individual nodes, wallets, or must be carefully exploited
- c. LOW: is not easily exploitable
7. Respond according to the severity of the vulnerability:
- a. HIGH severities must be notified on website and reddit /r/Monero within 3 working days of classification
- i. The notification should list appropriate steps for users to take, if any
- ii. The notification must not include any details that could suggest an exploitation path
- iii. The latter takes precedence over the former
- b. MEDIUM and HIGH severities will require a Point Release
- c. LOW severities will be addressed in the next Regular Release
8. Response Team applies appropriate patch(es)
- a. Response Manager designates a PRIVATE git "hotfix branch" to work in
- b. Patches are reviewed with the researcher
- c. Any messages associated with PUBLIC commits during the time of review should not make reference to the security nature of the PRIVATE branch or its commits
- d. Vulnerability announcement is drafted
- i. Include the severity of the vulnerability
- ii. Include all vulnerable systems/apps/code
- iii. Include solutions (if any) if patch cannot be applied
- e. Release date is discussed
9. At release date, Response Team coordinates with developers to finalize update:
- a. Response Manager propagates the "hotfix branch" to trunk
- b. Response Manager includes vulnerability announcement draft in release notes
- c. Proceed with the Point or Regular Release
## IV. Post-release Disclosure Process
1. Response Team has 90 days to fulfill all points within section III
2. If the Incident Response process in section III is successfully completed:
- a. Response Manager contacts researcher and asks if researcher wishes for credit
- b. Finalize vulnerability announcement draft and include the following:
- i. Project name and URL
- ii. Versions known to be affected
- iii. Versions known to be not affected (for example, the vulnerable code was introduced in a recent version, and older versions are therefore unaffected)
- iv. Versions not checked
- v. Type of vulnerability and its impact
- vi. If already obtained or applicable, a CVE-ID
- vii. The planned, coordinated release date
- viii. Mitigating factors (for example, the vulnerability is only exposed in uncommon, non-default configurations)
- ix. Workarounds (configuration changes users can make to reduce their exposure to the vulnerability)
- x. If applicable, credits to the original reporter
- c. Release finalized vulnerability announcement on website and reddit /r/Monero
- d. For HIGH severities, release finalized vulnerability announcement on well-known mailing lists:
- i. oss-security@lists.openwall.com
- ii. bugtraq@securityfocus.com
- e. If applicable, developers request a CVE-ID
- i. The commit that applied the fix is made reference too in a future commit and includes a CVE-ID
3. If the Incident Response process in section III is *not* successfully completed:
- a. Response Team and developers organize an IRC meeting to discuss why/what points in section III were not resolved and how the team can resolve them in the future
- b. Any developer meetings immediately following the incident should include points made in section V
- c. If disputes arise about whether or when to disclose information about a vulnerability, the Response Team will publicly discuss the issue via IRC and attempt to reach consensus
- d. If consensus on a timely disclosure is not met (no later than 90 days), the researcher (after 90 days) has every right to expose the vulnerability to the public
## V. Incident Analysis
1. Isolate codebase
- a. Response Team and developers should coordinate to work on the following:
- i. Problematic implementation of classes/libraries/functions, etc.
- ii. Focus on apps/distro packaging, etc.
- iii. Operator/config error, etc.
2. Auditing
- a. Response Team and developers should coordinate to work on the following:
- i. Auditing of problem area(s) as discussed in point 1
- ii. Generate internal reports and store for future reference
- iii. If results are not sensitive, share with the public via IRC or GitHub
3. Response Team has 45 days following completion of section III to ensure completion of section V
## VI. Resolutions
Any further questions or resolutions regarding the incident(s) between the researcher and response + development team after public disclosure can be addressed via the following:
- [GitHub](https://github.com/monero-project/monero/issues/)
- [HackerOne](https://hackerone.com/monero)
- [Reddit /r/Monero](https://reddit.com/r/Monero/)
- IRC
- Email
## VII. Continuous Improvement
1. Response Team and developers should hold annual meetings to review the previous year's incidents
2. Response Team or designated person(s) should give a brief presentation, including:
- a. Areas of Monero affected by the incidents
- b. Any network downtime or monetary cost (if any) of the incidents
- c. Ways in which the incidents could have been avoided (if any)
- d. How effective this process was in dealing with the incidents
3. After the presentation, Response Team and developers should discuss:
- a. Potential changes to development processes to reduce future incidents
- b. Potential changes to this process to improve future responses

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2017, The Monero Project
#
# All rights reserved.
#

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2017, The Monero Project
#
# All rights reserved.
#

41
cmake/FindLibunwind.cmake Normal file
View File

@@ -0,0 +1,41 @@
# - Try to find libunwind
# Once done this will define
#
# LIBUNWIND_FOUND - system has libunwind
# LIBUNWIND_INCLUDE_DIR - the libunwind include directory
# LIBUNWIND_LIBRARIES - Link these to use libunwind
# LIBUNWIND_DEFINITIONS - Compiler switches required for using libunwind
# Copyright (c) 2006, Alexander Dymo, <adymo@kdevelop.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
find_path(LIBUNWIND_INCLUDE_DIR libunwind.h
/usr/include
/usr/local/include
)
find_library(LIBUNWIND_LIBRARIES NAMES unwind )
if(NOT LIBUNWIND_LIBRARIES STREQUAL "LIBUNWIND_LIBRARIES-NOTFOUND")
if (CMAKE_COMPILER_IS_GNUCC)
set(LIBUNWIND_LIBRARIES "gcc_eh;${LIBUNWIND_LIBRARIES}")
endif()
endif()
# some versions of libunwind need liblzma, and we don't use pkg-config
# so we just look whether liblzma is installed, and add it if it is.
# It might not be actually needed, but doesn't hurt if it is not.
# We don't need any headers, just the lib, as it's privately needed.
message(STATUS "looking for liblzma")
find_library(LIBLZMA_LIBRARIES lzma )
if(NOT LIBLZMA_LIBRARIES STREQUAL "LIBLZMA_LIBRARIES-NOTFOUND")
message(STATUS "liblzma found")
set(LIBUNWIND_LIBRARIES "${LIBUNWIND_LIBRARIES};${LIBLZMA_LIBRARIES}")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libunwind "Could not find libunwind" LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARIES)
# show the LIBUNWIND_INCLUDE_DIR and LIBUNWIND_LIBRARIES variables only in the advanced view
mark_as_advanced(LIBUNWIND_INCLUDE_DIR LIBUNWIND_LIBRARIES )

View File

@@ -4,10 +4,7 @@
# MINIUPNP_FOUND, if false, do not try to link to miniupnp
# MINIUPNP_LIBRARY, the miniupnp variant
# MINIUPNP_INCLUDE_DIR, where to find miniupnpc.h and family)
# MINIUPNPC_VERSION_PRE1_6 --> set if we detect the version of miniupnpc is
# pre 1.6
# MINIUPNPC_VERSION_PRE1_5 --> set if we detect the version of miniupnpc is
# pre 1.5
# MINIUPNPC_VERSION_1_7_OR_HIGHER, set if we detect the version of miniupnpc is 1.7 or higher
#
# Note that the expected include convention is
# #include "miniupnpc.h"
@@ -16,170 +13,47 @@
# This is because, the miniupnpc location is not standardized and may exist
# in locations other than miniupnpc/
#=============================================================================
# Copyright 2011 Mark Vejvoda
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
if (MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
# Already in cache, be silent
set(MINIUPNP_FIND_QUIETLY TRUE)
endif ()
find_path(MINIUPNP_INCLUDE_DIR miniupnpc.h
PATH_SUFFIXES miniupnpc)
find_library(MINIUPNP_LIBRARY miniupnpc)
HINTS $ENV{MINIUPNP_INCLUDE_DIR}
PATH_SUFFIXES miniupnpc
)
if (MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
set (MINIUPNP_FOUND TRUE)
endif ()
find_library(MINIUPNP_LIBRARY miniupnpc
HINTS $ENV{MINIUPNP_LIBRARY}
)
if (MINIUPNP_FOUND)
include(CheckCXXSourceRuns)
if (NOT MINIUPNP_FIND_QUIETLY)
message (STATUS "Found the miniupnpc libraries at ${MINIUPNP_LIBRARY}")
message (STATUS "Found the miniupnpc headers at ${MINIUPNP_INCLUDE_DIR}")
endif ()
find_library(MINIUPNP_STATIC_LIBRARY libminiupnpc.a
HINTS $ENV{MINIUPNP_STATIC_LIBRARY}
)
message(STATUS "Detecting version of miniupnpc in path: ${MINIUPNP_INCLUDE_DIR}")
set(MINIUPNP_INCLUDE_DIRS ${MINIUPNP_INCLUDE_DIR})
set(MINIUPNP_LIBRARIES ${MINIUPNP_LIBRARY})
set(MINIUPNP_STATIC_LIBRARIES ${MINIUPNP_STATIC_LIBRARY})
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
#include <miniwget.h>
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <stdio.h>
int main()
{
static struct UPNPUrls urls;
static struct IGDdatas data;
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
MiniUPnPc DEFAULT_MSG
MINIUPNP_INCLUDE_DIR
MINIUPNP_LIBRARY
)
GetUPNPUrls (&urls, &data, \"myurl\",0);
return 0;
}"
MINIUPNPC_VERSION_1_7_OR_HIGHER)
IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
#include <miniwget.h>
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <stdio.h>
int main()
{
struct UPNPDev *devlist = NULL;
int upnp_delay = 5000;
const char *upnp_multicastif = NULL;
const char *upnp_minissdpdsock = NULL;
int upnp_sameport = 0;
int upnp_ipv6 = 0;
int upnp_error = 0;
devlist = upnpDiscover(upnp_delay, upnp_multicastif, upnp_minissdpdsock, upnp_sameport, upnp_ipv6, &upnp_error);
return 0;
}"
MINIUPNPC_VERSION_PRE1_7)
ENDIF()
IF (NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
#include <miniwget.h>
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <stdio.h>
int main()
{
struct UPNPDev *devlist = NULL;
int upnp_delay = 5000;
const char *upnp_multicastif = NULL;
const char *upnp_minissdpdsock = NULL;
int upnp_sameport = 0;
int upnp_ipv6 = 0;
int upnp_error = 0;
devlist = upnpDiscover(upnp_delay, upnp_multicastif, upnp_minissdpdsock, upnp_sameport);
return 0;
}"
MINIUPNPC_VERSION_PRE1_6)
ENDIF()
IF (NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
#include <miniwget.h>
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <stdio.h>
static struct UPNPUrls urls;
static struct IGDdatas data;
int main()
{
char externalIP[16] = \"\";
UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIP);
return 0;
}"
MINIUPNPC_VERSION_1_5_OR_HIGHER)
ENDIF()
IF (NOT MINIUPNPC_VERSION_1_5_OR_HIGHER AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
check_cxx_source_runs("
#include <miniwget.h>
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <stdio.h>
static struct UPNPUrls urls;
static struct IGDdatas data;
int main()
{
char externalIP[16] = \"\";
UPNP_GetExternalIPAddress(urls.controlURL, data.servicetype, externalIP);
return 0;
}"
MINIUPNPC_VERSION_PRE1_5)
IF(MINIUPNPC_FOUND)
file(STRINGS "${MINIUPNP_INCLUDE_DIR}/miniupnpc.h" MINIUPNPC_API_VERSION_STR REGEX "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+[0-9]+")
if(MINIUPNPC_API_VERSION_STR MATCHES "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+([0-9]+)")
set(MINIUPNPC_API_VERSION "${CMAKE_MATCH_1}")
endif()
if (${MINIUPNPC_API_VERSION} GREATER "10" OR ${MINIUPNPC_API_VERSION} EQUAL "10")
message(STATUS "Found miniupnpc API version " ${MINIUPNPC_API_VERSION})
set(MINIUPNP_FOUND true)
set(MINIUPNPC_VERSION_1_7_OR_HIGHER true)
endif()
ENDIF()
IF(MINIUPNPC_VERSION_PRE1_5)
message(STATUS "Found miniupnpc version is pre v1.5")
ENDIF()
IF(MINIUPNPC_VERSION_PRE1_6)
message(STATUS "Found miniupnpc version is pre v1.6")
ENDIF()
IF(MINIUPNPC_VERSION_PRE1_7)
message(STATUS "Found miniupnpc version is pre v1.7")
ENDIF()
IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7)
IF(MINIUPNPC_VERSION_1_5_OR_HIGHER)
message(STATUS "Found miniupnpc version is v1.5 or higher")
ELSE()
message(STATUS "Found miniupnpc version is v1.7 or higher")
ENDIF()
ENDIF()
else ()
message (STATUS "Could not find miniupnp")
endif ()
MARK_AS_ADVANCED(MINIUPNP_INCLUDE_DIR MINIUPNP_LIBRARY)
mark_as_advanced(MINIUPNP_INCLUDE_DIR MINIUPNP_LIBRARY MINIUPNP_STATIC_LIBRARY)
# --------------------------------- FindMiniupnpc End ---------------------------------

66
cmake/FindReadline.cmake Normal file
View File

@@ -0,0 +1,66 @@
# - Try to find readline include dirs and libraries
#
# Usage of this module as follows:
#
# find_package(Readline)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# Readline_ROOT_DIR Set this variable to the root installation of
# readline if the module has problems finding the
# proper installation path.
#
# Variables defined by this module:
#
# READLINE_FOUND System has readline, include and lib dirs found
# GNU_READLINE_FOUND Version of readline found is GNU readline, not libedit!
# Readline_INCLUDE_DIR The readline include directories.
# Readline_LIBRARY The readline library.
find_path(Readline_ROOT_DIR
NAMES include/readline/readline.h
PATHS /opt/local/ /usr/local/ /usr/
NO_DEFAULT_PATH
)
find_path(Readline_INCLUDE_DIR
NAMES readline/readline.h
PATHS ${Readline_ROOT_DIR}/include
NO_DEFAULT_PATH
)
find_library(Readline_LIBRARY
NAMES readline
PATHS ${Readline_ROOT_DIR}/lib
NO_DEFAULT_PATH
)
if(Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY)
set(READLINE_FOUND TRUE)
else(Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY)
FIND_LIBRARY(Readline_LIBRARY NAMES readline PATHS Readline_ROOT_DIR)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Readline DEFAULT_MSG Readline_INCLUDE_DIR Readline_LIBRARY )
MARK_AS_ADVANCED(Readline_INCLUDE_DIR Readline_LIBRARY)
endif(Readline_INCLUDE_DIR AND Readline_LIBRARY AND Ncurses_LIBRARY)
mark_as_advanced(
Readline_ROOT_DIR
Readline_INCLUDE_DIR
Readline_LIBRARY
)
set(CMAKE_REQUIRED_INCLUDES ${Readline_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${Readline_LIBRARY})
INCLUDE(CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES(
"
#include <stdio.h>
#include <readline/readline.h>
int
main()
{
char * s = rl_copy_text(0, 0);
}
" GNU_READLINE_FOUND)

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2017, The Monero Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2014-2016, The Monero Project
// Copyright (c) 2014-2017, The Monero Project
//
// All rights reserved.
//

View File

@@ -0,0 +1,34 @@
// Copyright (c) 2014-2017, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assert.h>
static_assert(1, "FAIL");
int main(int argc, char *argv[]) {
return 0;
}

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2017, The Monero Project
#
# All rights reserved.
#
@@ -26,5 +26,5 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
add_subdirectory(otshell_utils)
add_subdirectory(epee)

View File

@@ -0,0 +1,30 @@
# Copyright (c) 2014-2017, The Monero Project
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
add_subdirectory(src)

View File

@@ -1,217 +0,0 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Andrey N. Sabelnikov nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#include "stdafx.h"
#include "console_handler.h"
#include "demo_http_server.h"
#include "net/http_client.h"
#include "storages/http_abstract_invoke.h"
template<class t_request, class t_response>
bool communicate(const std::string url, t_request& req, t_response& rsp, const std::string& ip, const std::string& port, bool use_json, bool use_jrpc = false)
{
epee::net_utils::http::http_simple_client http_client;
bool r = http_client.connect(ip, port, 1000);
CHECK_AND_ASSERT_MES(r, false, "failed to connect");
if(use_json)
{
if(use_jrpc)
{
epee::json_rpc::request<t_request> req_t = AUTO_VAL_INIT(req_t);
req_t.jsonrpc = "2.0";
req_t.id = epee::serialization::storage_entry(10);
req_t.method = "command_example_1";
req_t.params = req;
epee::json_rpc::response<t_response, std::string> resp_t = AUTO_VAL_INIT(resp_t);
if(!epee::net_utils::invoke_http_json_remote_command2("/request_json_rpc", req_t, resp_t, http_client))
{
return false;
}
rsp = resp_t.result;
return true;
}else
return epee::net_utils::invoke_http_json_remote_command2(url, req, rsp, http_client);
}
else
return epee::net_utils::invoke_http_bin_remote_command2(url, req, rsp, http_client);
}
int main(int argc, char* argv[])
{
TRY_ENTRY();
string_tools::set_module_name_and_folder(argv[0]);
//set up logging options
log_space::get_set_log_detalisation_level(true, LOG_LEVEL_2);
log_space::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL);
log_space::log_singletone::add_logger(LOGGER_FILE,
log_space::log_singletone::get_default_log_file().c_str(),
log_space::log_singletone::get_default_log_folder().c_str());
LOG_PRINT("Demo server starting ...", LOG_LEVEL_0);
demo::demo_http_server srv;
start_default_console(&srv, "#");
std::string bind_param = "0.0.0.0";
std::string port = "83";
if(!srv.init(port, bind_param))
{
LOG_ERROR("Failed to initialize srv!");
return 1;
}
//log loop
srv.run();
size_t count = 0;
while (!srv.is_stop())
{
demo::COMMAND_EXAMPLE_1::request req;
req.sub = demo::get_test_data();
demo::COMMAND_EXAMPLE_1::response rsp;
bool r = false;
if(count%2)
{//invoke json
r = communicate("/request_api_json_1", req, rsp, "127.0.0.1", port, true, true);
}else{
r = communicate("/request_api_bin_1", req, rsp, "127.0.0.1", port, false);
}
CHECK_AND_ASSERT_MES(r, false, "failed to invoke http request");
CHECK_AND_ASSERT_MES(rsp.m_success, false, "wrong response");
CHECK_AND_ASSERT_MES(rsp.subs.size()==1, false, "wrong response");
CHECK_AND_ASSERT_MES(rsp.subs.front() == demo::get_test_data(), false, "wrong response");
//misc_utils::sleep_no_w(1000);
++count;
}
bool r = srv.wait_stop();
CHECK_AND_ASSERT_MES(r, 1, "failed to wait server stop");
srv.deinit();
LOG_PRINT("Demo server stoped.", LOG_LEVEL_0);
return 1;
CATCH_ENTRY_L0("main", 1);
}
/************************************************************************/
/* */
/************************************************************************/
namespace demo
{
bool demo_http_server::init(const std::string& bind_port, const std::string& bind_ip)
{
//set self as callback handler
m_net_server.get_config_object().m_phandler = this;
//here set folder for hosting reqests
m_net_server.get_config_object().m_folder = "";
LOG_PRINT_L0("Binding on " << bind_ip << ":" << bind_port);
return m_net_server.init_server(bind_port, bind_ip);
}
bool demo_http_server::run()
{
m_stop = false;
//here you can set worker threads count
int thrds_count = 4;
//go to loop
LOG_PRINT("Run net_service loop( " << thrds_count << " threads)...", LOG_LEVEL_0);
if(!m_net_server.run_server(thrds_count, false))
{
LOG_ERROR("Failed to run net tcp server!");
}
return true;
}
bool demo_http_server::deinit()
{
return m_net_server.deinit_server();
}
bool demo_http_server::send_stop_signal()
{
m_stop = true;
m_net_server.send_stop_signal();
return true;
}
bool demo_http_server::on_requestr_uri_1(const net_utils::http::http_request_info& query_info,
net_utils::http::http_response_info& response,
const net_utils::connection_context_base& m_conn_context)
{
return true;
}
bool demo_http_server::on_requestr_uri_2(const net_utils::http::http_request_info& query_info,
net_utils::http::http_response_info& response,
const net_utils::connection_context_base& m_conn_context)
{
return true;
}
bool demo_http_server::on_hosting_request( const net_utils::http::http_request_info& query_info,
net_utils::http::http_response_info& response,
const net_utils::connection_context_base& m_conn_context)
{
//read file from filesystem here
return true;
}
bool demo_http_server::on_request_api_1(const COMMAND_EXAMPLE_1::request& req, COMMAND_EXAMPLE_1::response& res, connection_context& ctxt)
{
CHECK_AND_ASSERT_MES(req.sub == demo::get_test_data(), false, "wrong request");
res.m_success = true;
res.subs.push_back(req.sub);
return true;
}
bool demo_http_server::on_request_api_1_with_error(const COMMAND_EXAMPLE_1::request& req, COMMAND_EXAMPLE_1::response& res, epee::json_rpc::error& error_resp, connection_context& ctxt)
{
error_resp.code = 232432;
error_resp.message = "bla bla bla";
return false;
}
bool demo_http_server::on_request_api_2(const COMMAND_EXAMPLE_2::request& req, COMMAND_EXAMPLE_2::response& res, connection_context& ctxt)
{
return true;
}
}

View File

@@ -1,103 +0,0 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Andrey N. Sabelnikov nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#pragma once
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include "net/http_server_cp2.h"
#include "transport_defs.h"
#include "net/http_server_handlers_map2.h"
using namespace epee;
namespace demo
{
class demo_http_server: public net_utils::http::i_http_server_handler<epee::net_utils::connection_context_base>
{
public:
typedef epee::net_utils::connection_context_base connection_context;
demo_http_server():m_stop(false){}
bool run();
bool init(const std::string& bind_port = "11112", const std::string& bind_ip = "0.0.0.0");
bool deinit();
bool send_stop_signal();
bool is_stop(){return m_stop;}
bool wait_stop(){return m_net_server.timed_wait_server_stop(100000);}
private:
CHAIN_HTTP_TO_MAP2(connection_context); //forward http requests to uri map
BEGIN_URI_MAP2()
MAP_URI2("/requestr_uri_1", on_requestr_uri_1)
MAP_URI2("/requestr_uri_2", on_requestr_uri_1)
//MAP_URI_AUTO_XML2("/request_api_xml_1", on_request_api_1, COMMAND_EXAMPLE_1)
//MAP_URI_AUTO_XML2("/request_api_xml_2", on_request_api_2, COMMAND_EXAMPLE_2)
MAP_URI_AUTO_JON2("/request_api_json_1", on_request_api_1, COMMAND_EXAMPLE_1)
MAP_URI_AUTO_JON2("/request_api_json_2", on_request_api_2, COMMAND_EXAMPLE_2)
MAP_URI_AUTO_BIN2("/request_api_bin_1", on_request_api_1, COMMAND_EXAMPLE_1)
MAP_URI_AUTO_BIN2("/request_api_bin_2", on_request_api_2, COMMAND_EXAMPLE_2)
BEGIN_JSON_RPC_MAP("/request_json_rpc")
MAP_JON_RPC("command_example_1", on_request_api_1, COMMAND_EXAMPLE_1)
MAP_JON_RPC("command_example_2", on_request_api_2, COMMAND_EXAMPLE_2)
MAP_JON_RPC_WE("command_example_1_we", on_request_api_1_with_error, COMMAND_EXAMPLE_1)
END_JSON_RPC_MAP()
CHAIN_URI_MAP2(on_hosting_request)
END_URI_MAP2()
bool on_requestr_uri_1(const net_utils::http::http_request_info& query_info,
net_utils::http::http_response_info& response,
const net_utils::connection_context_base& m_conn_context);
bool on_requestr_uri_2(const net_utils::http::http_request_info& query_info,
net_utils::http::http_response_info& response,
const net_utils::connection_context_base& m_conn_context);
bool on_hosting_request( const net_utils::http::http_request_info& query_info,
net_utils::http::http_response_info& response,
const net_utils::connection_context_base& m_conn_context);
bool on_request_api_1(const COMMAND_EXAMPLE_1::request& req, COMMAND_EXAMPLE_1::response& res, connection_context& ctxt);
bool on_request_api_2(const COMMAND_EXAMPLE_2::request& req, COMMAND_EXAMPLE_2::response& res, connection_context& ctxt);
bool on_request_api_1_with_error(const COMMAND_EXAMPLE_1::request& req, COMMAND_EXAMPLE_1::response& res, epee::json_rpc::error& error_resp, connection_context& ctxt);
net_utils::boosted_http_server_custum_handling m_net_server;
std::atomic<bool> m_stop;
};
}

View File

@@ -1,200 +0,0 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Andrey N. Sabelnikov nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#include "stdafx.h"
#include "demo_levin_server.h"
#include "console_handler.h"
template<class t_request>
bool communicate(net_utils::boosted_levin_async_server& transport, int id, t_request& req, const std::string& ip, const std::string& port, bool use_async)
{
if(use_async)
{
//IMPORTANT: do not pass local parameters from stack by reference! connect_async returns immediately, and callback will call in any thread later
transport.connect_async(ip, port, 10000, [&transport, id, req, ip, port](net_utils::connection_context_base& ctx, const boost::system::error_code& ec_)
{
if(!!ec_)
{
LOG_ERROR("Failed to connect to " << ip << ":" << port);
}else
{//connected ok!
epee::net_utils::async_invoke_remote_command2<demo::COMMAND_EXAMPLE_1::response>(ctx.m_connection_id, id, req, transport.get_config_object(), [&transport, ip, port](int res_code, demo::COMMAND_EXAMPLE_1::response& rsp, net_utils::connection_context_base& ctx)
{
if(res_code < 0)
{
LOG_ERROR("Failed to invoke to " << ip << ":" << port);
}else
{//invoked ok
CHECK_AND_ASSERT_MES(rsp.m_success, false, "wrong response");
CHECK_AND_ASSERT_MES(rsp.subs.size()==1, false, "wrong response");
CHECK_AND_ASSERT_MES(rsp.subs.front() == demo::get_test_data(), false, "wrong response");
LOG_PRINT_GREEN("Client COMMAND_EXAMPLE_1 async invoked ok", LOG_LEVEL_0);
}
transport.get_config_object().close(ctx.m_connection_id);
return true;
});
LOG_PRINT_GREEN("Client COMMAND_EXAMPLE_1 async invoke requested", LOG_LEVEL_0);
}
});
}else
{
net_utils::connection_context_base ctx = AUTO_VAL_INIT(ctx);
bool r = transport.connect(ip, port, 10000, ctx);
CHECK_AND_ASSERT_MES(r, false, "failed to connect to " << ip << ":" << port);
demo::COMMAND_EXAMPLE_1::response rsp = AUTO_VAL_INIT(rsp);
LOG_PRINT_GREEN("Client COMMAND_EXAMPLE_1 sync invoke requested", LOG_LEVEL_0);
r = epee::net_utils::invoke_remote_command2(ctx.m_connection_id, id, req, rsp, transport.get_config_object());
CHECK_AND_ASSERT_MES(r, false, "failed to invoke levin request");
CHECK_AND_ASSERT_MES(rsp.m_success, false, "wrong response");
CHECK_AND_ASSERT_MES(rsp.subs.size()==1, false, "wrong response");
CHECK_AND_ASSERT_MES(rsp.subs.front() == demo::get_test_data(), false, "wrong response");
transport.get_config_object().close(ctx.m_connection_id);
LOG_PRINT_GREEN("Client COMMAND_EXAMPLE_1 sync invoked ok", LOG_LEVEL_0);
}
return true;
}
int main(int argc, char* argv[])
{
TRY_ENTRY();
string_tools::set_module_name_and_folder(argv[0]);
//set up logging options
log_space::get_set_log_detalisation_level(true, LOG_LEVEL_2);
log_space::log_singletone::add_logger(LOGGER_CONSOLE, NULL, NULL);
log_space::log_singletone::add_logger(LOGGER_FILE,
log_space::log_singletone::get_default_log_file().c_str(),
log_space::log_singletone::get_default_log_folder().c_str());
LOG_PRINT("Demo server starting ...", LOG_LEVEL_0);
demo::demo_levin_server srv;
start_default_console(&srv, "#");
std::string bind_param = "0.0.0.0";
std::string port = "12345";
if(!srv.init(port, bind_param))
{
LOG_ERROR("Failed to initialize srv!");
return 1;
}
srv.run();
size_t c = 1;
while (!srv.is_stop())
{
demo::COMMAND_EXAMPLE_1::request req;
req.sub = demo::get_test_data();
bool r = communicate(srv.get_server(), demo::COMMAND_EXAMPLE_1::ID, req, "127.0.0.1", port, (c%2 == 0));
misc_utils::sleep_no_w(1000);
++c;
}
bool r = srv.wait_stop();
CHECK_AND_ASSERT_MES(r, 1, "failed to wait server stop");
srv.deinit();
LOG_PRINT("Demo server stoped.", LOG_LEVEL_0);
return 1;
CATCH_ENTRY_L0("main", 1);
}
/************************************************************************/
/* */
/************************************************************************/
namespace demo
{
bool demo_levin_server::init(const std::string& bind_port, const std::string& bind_ip)
{
m_net_server.get_config_object().m_pcommands_handler = this;
LOG_PRINT_L0("Binding on " << bind_ip << ":" << bind_port);
return m_net_server.init_server(bind_port, bind_ip);
}
bool demo_levin_server::run()
{
m_stop = false;
//here you can set worker threads count
int thrds_count = 4;
m_net_server.get_config_object().m_invoke_timeout = 10000;
m_net_server.get_config_object().m_pcommands_handler = this;
//go to loop
LOG_PRINT("Run net_service loop( " << thrds_count << " threads)...", LOG_LEVEL_0);
if(!m_net_server.run_server(thrds_count, false))
{
LOG_ERROR("Failed to run net tcp server!");
}
LOG_PRINT("net_service loop stopped.", LOG_LEVEL_0);
return true;
}
bool demo_levin_server::deinit()
{
return m_net_server.deinit_server();
}
bool demo_levin_server::send_stop_signal()
{
m_net_server.send_stop_signal();
return true;
}
int demo_levin_server::handle_command_1(int command, COMMAND_EXAMPLE_1::request& arg, COMMAND_EXAMPLE_1::response& rsp, const net_utils::connection_context_base& context)
{
CHECK_AND_ASSERT_MES(arg.sub == demo::get_test_data(), false, "wrong request");
rsp.m_success = true;
rsp.subs.push_back(arg.sub);
LOG_PRINT_GREEN("Server COMMAND_EXAMPLE_1 ok", LOG_LEVEL_0);
return 1;
}
int demo_levin_server::handle_command_2(int command, COMMAND_EXAMPLE_2::request& arg, COMMAND_EXAMPLE_2::response& rsp, const net_utils::connection_context_base& context)
{
return 1;
}
int demo_levin_server::handle_notify_1(int command, COMMAND_EXAMPLE_1::request& arg, const net_utils::connection_context_base& context)
{
return 1;
}
int demo_levin_server::handle_notify_2(int command, COMMAND_EXAMPLE_2::request& arg, const net_utils::connection_context_base& context)
{
return 1;
}
}

View File

@@ -1,76 +0,0 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Andrey N. Sabelnikov nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#pragma once
#include <boost/thread.hpp>
#include <boost/bind.hpp>
#include "net/levin_server_cp2.h"
#include "transport_defs.h"
#include "storages/levin_abstract_invoke2.h"
using namespace epee;
namespace demo
{
class demo_levin_server: public levin::levin_commands_handler<>
{
public:
bool run();
bool init(const std::string& bind_port = "11112", const std::string& bind_ip = "0.0.0.0");
bool deinit();
bool send_stop_signal();
bool is_stop(){return m_stop;}
bool wait_stop(){return m_net_server.timed_wait_server_stop(100000);}
net_utils::boosted_levin_async_server& get_server(){return m_net_server;}
private:
CHAIN_LEVIN_INVOKE_MAP(); //move levin_commands_handler interface invoke(...) callbacks into invoke map
CHAIN_LEVIN_NOTIFY_STUB(); //move levin_commands_handler interface notify(...) callbacks into nothing
BEGIN_INVOKE_MAP2(demo_levin_server)
HANDLE_INVOKE_T2(COMMAND_EXAMPLE_1, &demo_levin_server::handle_command_1)
HANDLE_INVOKE_T2(COMMAND_EXAMPLE_2, &demo_levin_server::handle_command_2)
HANDLE_NOTIFY_T2(COMMAND_EXAMPLE_1, &demo_levin_server::handle_notify_1)
HANDLE_NOTIFY_T2(COMMAND_EXAMPLE_2, &demo_levin_server::handle_notify_2)
END_INVOKE_MAP2()
//----------------- commands handlers ----------------------------------------------
int handle_command_1(int command, COMMAND_EXAMPLE_1::request& arg, COMMAND_EXAMPLE_1::response& rsp, const net_utils::connection_context_base& context);
int handle_command_2(int command, COMMAND_EXAMPLE_2::request& arg, COMMAND_EXAMPLE_2::response& rsp, const net_utils::connection_context_base& context);
int handle_notify_1(int command, COMMAND_EXAMPLE_1::request& arg, const net_utils::connection_context_base& context);
int handle_notify_2(int command, COMMAND_EXAMPLE_2::request& arg, const net_utils::connection_context_base& context);
//----------------------------------------------------------------------------------
net_utils::boosted_levin_async_server m_net_server;
std::atomic<bool> m_stop;
};
}

View File

@@ -38,6 +38,10 @@
#endif
#include <boost/thread.hpp>
#ifdef HAVE_READLINE
#include "readline_buffer.h"
#endif
namespace epee
{
class async_stdin_reader
@@ -48,6 +52,9 @@ namespace epee
, m_has_read_request(false)
, m_read_status(state_init)
{
#ifdef HAVE_READLINE
m_readline_buffer.start();
#endif
m_reader_thread = boost::thread(std::bind(&async_stdin_reader::reader_thread_func, this));
}
@@ -56,6 +63,13 @@ namespace epee
stop();
}
#ifdef HAVE_READLINE
rdln::readline_buffer& get_readline_buffer()
{
return m_readline_buffer;
}
#endif
// Not thread safe. Only one thread can call this method at once.
bool get_line(std::string& line)
{
@@ -98,6 +112,9 @@ namespace epee
m_request_cv.notify_one();
m_reader_thread.join();
#ifdef HAVE_READLINE
m_readline_buffer.stop();
#endif
}
}
@@ -133,7 +150,7 @@ namespace epee
bool wait_stdin_data()
{
#if !defined(WIN32)
#ifdef __OpenBSD__
#if defined(__OpenBSD__) || defined(__ANDROID__)
int stdin_fileno = fileno(stdin);
#else
int stdin_fileno = ::fileno(stdin);
@@ -155,6 +172,20 @@ namespace epee
else if (0 < retval)
return true;
}
#else
while (m_run.load(std::memory_order_relaxed))
{
int retval = ::WaitForSingleObject(::GetStdHandle(STD_INPUT_HANDLE), 100);
switch (retval)
{
case WAIT_FAILED:
return false;
case WAIT_OBJECT_0:
return true;
default:
break;
}
}
#endif
return true;
@@ -169,11 +200,23 @@ namespace epee
std::string line;
bool read_ok = true;
#ifdef HAVE_READLINE
reread:
#endif
if (wait_stdin_data())
{
if (m_run.load(std::memory_order_relaxed))
{
#ifdef HAVE_READLINE
switch (m_readline_buffer.get_line(line))
{
case rdln::empty: goto eof;
case rdln::partial: goto reread;
case rdln::full: break;
}
#else
std::getline(std::cin, line);
#endif
read_ok = !std::cin.eof() && !std::cin.fail();
}
}
@@ -182,6 +225,9 @@ namespace epee
read_ok = false;
}
if (std::cin.eof()) {
#ifdef HAVE_READLINE
eof:
#endif
m_read_status = state_eos;
m_response_cv.notify_one();
break;
@@ -215,6 +261,9 @@ namespace epee
private:
boost::thread m_reader_thread;
std::atomic<bool> m_run;
#ifdef HAVE_READLINE
rdln::readline_buffer m_readline_buffer;
#endif
std::string m_line;
bool m_has_read_request;
@@ -242,13 +291,13 @@ namespace epee
}
template<class t_server, class chain_handler>
bool run(t_server* psrv, chain_handler ch_handler, const std::string& prompt = "#", const std::string& usage = "")
bool run(t_server* psrv, chain_handler ch_handler, std::function<std::string(void)> prompt, const std::string& usage = "")
{
return run(prompt, usage, [&](const std::string& cmd) { return ch_handler(psrv, cmd); }, [&] { psrv->send_stop_signal(); });
}
template<class chain_handler>
bool run(chain_handler ch_handler, const std::string& prompt = "#", const std::string& usage = "", std::function<void(void)> exit_handler = NULL)
bool run(chain_handler ch_handler, std::function<std::string(void)> prompt, const std::string& usage = "", std::function<void(void)> exit_handler = NULL)
{
return run(prompt, usage, [&](const std::string& cmd) { return ch_handler(cmd); }, exit_handler);
}
@@ -261,20 +310,29 @@ namespace epee
void print_prompt()
{
if (!m_prompt.empty())
std::string prompt = m_prompt();
if (!prompt.empty())
{
epee::log_space::set_console_color(epee::log_space::console_color_yellow, true);
std::cout << m_prompt;
if (' ' != m_prompt.back())
#ifdef HAVE_READLINE
std::string color_prompt = "\001\033[1;33m\002" + prompt;
if (' ' != prompt.back())
color_prompt += " ";
color_prompt += "\001\033[0m\002";
m_stdin_reader.get_readline_buffer().set_prompt(color_prompt);
#else
epee::set_console_color(epee::console_color_yellow, true);
std::cout << prompt;
if (' ' != prompt.back())
std::cout << ' ';
epee::log_space::reset_console_color();
epee::reset_console_color();
std::cout.flush();
#endif
}
}
private:
template<typename t_cmd_handler>
bool run(const std::string& prompt, const std::string& usage, const t_cmd_handler& cmd_handler, std::function<void(void)> exit_handler)
bool run(std::function<std::string(void)> prompt, const std::string& usage, const t_cmd_handler& cmd_handler, std::function<void(void)> exit_handler)
{
bool continue_handle = true;
m_prompt = prompt;
@@ -296,7 +354,7 @@ namespace epee
}
if (!get_line_ret)
{
LOG_PRINT("Failed to read line.", LOG_LEVEL_0);
MERROR("Failed to read line.");
}
string_tools::trim(command);
@@ -315,6 +373,9 @@ namespace epee
}
else
{
#ifdef HAVE_READLINE
rdln::suspend_readline pause_readline;
#endif
std::cout << "unknown command: " << command << std::endl;
std::cout << usage;
}
@@ -332,7 +393,7 @@ namespace epee
private:
async_stdin_reader m_stdin_reader;
std::atomic<bool> m_running = {true};
std::string m_prompt;
std::function<std::string(void)> m_prompt;
};
@@ -418,6 +479,9 @@ namespace epee
lookup::mapped_type & vt = m_command_handlers[cmd];
vt.first = hndlr;
vt.second = usage;
#ifdef HAVE_READLINE
rdln::readline_buffer::add_completion(cmd);
#endif
}
bool process_command_vec(const std::vector<std::string>& cmd)
@@ -451,19 +515,23 @@ namespace epee
std::unique_ptr<boost::thread> m_console_thread;
async_console_handler m_console_handler;
public:
bool start_handling(const std::string& prompt, const std::string& usage_string = "", std::function<void(void)> exit_handler = NULL)
bool start_handling(std::function<std::string(void)> prompt, const std::string& usage_string = "", std::function<void(void)> exit_handler = NULL)
{
m_console_thread.reset(new boost::thread(boost::bind(&console_handlers_binder::run_handling, this, prompt, usage_string, exit_handler)));
m_console_thread->detach();
return true;
}
bool start_handling(const std::string &prompt, const std::string& usage_string = "", std::function<void(void)> exit_handler = NULL)
{
return start_handling([prompt](){ return prompt; }, usage_string, exit_handler);
}
void stop_handling()
{
m_console_handler.stop();
}
bool run_handling(const std::string& prompt, const std::string& usage_string, std::function<void(void)> exit_handler = NULL)
bool run_handling(std::function<std::string(void)> prompt, const std::string& usage_string, std::function<void(void)> exit_handler = NULL)
{
return m_console_handler.run(boost::bind(&console_handlers_binder::process_command_str, this, _1), prompt, usage_string, exit_handler);
}

View File

@@ -28,197 +28,13 @@
#ifndef _FILE_IO_UTILS_H_
#define _FILE_IO_UTILS_H_
//#include <sys/types.h>
//#include <sys/stat.h>
#include <iostream>
#include <boost/filesystem.hpp>
#ifndef MAKE64
#define MAKE64(low,high) ((__int64)(((DWORD)(low)) | ((__int64)((DWORD)(high))) << 32))
#endif
#ifdef WINDOWS_PLATFORM
#include <psapi.h>
#include <strsafe.h>
#include <string.h>
#include <mbstring.h>
#endif
namespace epee
{
namespace file_io_utils
{
#ifdef WINDOWS_PLATFORM
inline
std::string get_temp_file_name_a()
{
std::string str_result;
char sz_temp[MAX_PATH*2] = {0};
if(!::GetTempPathA( sizeof( sz_temp ), sz_temp ))
return str_result;
char sz_temp_file[MAX_PATH*2] = {0};
if(!::GetTempFileNameA( sz_temp, "mail", 0, sz_temp_file))
return str_result;
sz_temp_file[sizeof(sz_temp_file)-1] = 0; //be happy!
str_result = sz_temp_file;
return str_result;
}
#ifdef BOOST_LEXICAL_CAST_INCLUDED
inline
bool get_not_used_filename(const std::string& folder, OUT std::string& result_name)
{
DWORD folder_attr = ::GetFileAttributesA(folder.c_str());
if(folder_attr == INVALID_FILE_ATTRIBUTES)
return false;
if(!(folder_attr&FILE_ATTRIBUTE_DIRECTORY))
return false;
std::string base_name = folder + "\\tmp";
std::string tmp_name;
bool name_found = false;
int current_index = 0;
tmp_name = base_name + boost::lexical_cast<std::string>(current_index) + ".tmp";
while(!name_found)
{
if(INVALID_FILE_ATTRIBUTES == ::GetFileAttributesA(tmp_name.c_str()))
name_found = true;
else
{
current_index++;
tmp_name = base_name + boost::lexical_cast<std::string>(current_index) + ".tmp";
}
}
result_name = tmp_name;
return true;
}
#endif
inline
std::string get_temp_folder_a()
{
std::string str_result;
char sz_temp[MAX_PATH*2] = {0};
if(!::GetTempPathA( sizeof( sz_temp ), sz_temp ))
return str_result;
sz_temp[(sizeof(sz_temp)/sizeof(sz_temp[0])) -1] = 0;
str_result = sz_temp;
return str_result;
}
std::string convert_from_device_path_to_standart(const std::string& path)
{
STRSAFE_LPSTR pszFilename = (STRSAFE_LPSTR)path.c_str();
// Translate path with device name to drive letters.
char szTemp[4000] = {0};
if (::GetLogicalDriveStringsA(sizeof(szTemp)-1, szTemp))
{
char szName[MAX_PATH];
char szDrive[3] = " :";
BOOL bFound = FALSE;
char* p = szTemp;
do
{
// Copy the drive letter to the template string
*szDrive = *p;
// Look up each device name
if (::QueryDosDeviceA(szDrive, szName, sizeof(szName)))
{
UINT uNameLen = strlen(szName);
if (uNameLen < MAX_PATH)
{
bFound = _mbsnbicmp((const unsigned char*)pszFilename, (const unsigned char*)szName,
uNameLen) == 0;
if (bFound)
{
// Reconstruct pszFilename using szTempFile
// Replace device path with DOS path
char szTempFile[MAX_PATH] = {0};
StringCchPrintfA(szTempFile,
MAX_PATH,
"%s%s",
szDrive,
pszFilename+uNameLen);
return szTempFile;
//::StringCchCopyNA(pszFilename, MAX_PATH+1, szTempFile, strlen(szTempFile));
}
}
}
// Go to the next NULL character.
while (*p++);
} while (!bFound && *p); // end of string
}
return "";
}
inline
std::string get_process_path_by_pid(DWORD pid)
{
std::string res;
HANDLE hprocess = 0;
if( hprocess = ::OpenProcess( PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, FALSE, pid) )
{
char buff[MAX_PATH]= {0};
if(!::GetModuleFileNameExA( hprocess, 0, buff, MAX_PATH - 1 ))
res = "Unknown_b";
else
{
buff[MAX_PATH - 1]=0; //be happy!
res = buff;
std::string::size_type a = res.rfind( '\\' );
if ( a != std::string::npos )
res.erase( 0, a+1);
}
::CloseHandle( hprocess );
}else
res = "Unknown_a";
return res;
}
inline
std::wstring get_temp_file_name_w()
{
std::wstring str_result;
wchar_t sz_temp[MAX_PATH*2] = {0};
if(!::GetTempPathW( sizeof(sz_temp)/sizeof(sz_temp[0]), sz_temp ))
return str_result;
wchar_t sz_temp_file[MAX_PATH+1] = {0};
if(!::GetTempFileNameW( sz_temp, L"mail", 0, sz_temp_file))
return str_result;
sz_temp_file[(sizeof(sz_temp_file)/sizeof(sz_temp_file[0]))-1] = 0; //be happy!
str_result = sz_temp_file;
return str_result;
}
#endif
inline
bool is_file_exist(const std::string& path)
{
@@ -226,35 +42,6 @@ namespace file_io_utils
return boost::filesystem::exists(p);
}
/*
inline
bool save_string_to_handle(HANDLE hfile, const std::string& str)
{
if( INVALID_HANDLE_VALUE != hfile )
{
DWORD dw;
if( !::WriteFile( hfile, str.data(), (DWORD) str.size(), &dw, NULL) )
{
int err_code = GetLastError();
//LOG_PRINT("Failed to write to file handle: " << hfile<< " Last error code:" << err_code << " : " << log_space::get_win32_err_descr(err_code), LOG_LEVEL_2);
return false;
}
::CloseHandle(hfile);
return true;
}else
{
//LOG_WIN32_ERROR(::GetLastError());
return false;
}
return false;
}*/
inline
bool save_string_to_file(const std::string& path_to_file, const std::string& str)
{
@@ -275,32 +62,6 @@ namespace file_io_utils
}
}
/*
inline
bool load_form_handle(HANDLE hfile, std::string& str)
{
if( INVALID_HANDLE_VALUE != hfile )
{
bool res = true;
DWORD dw = 0;
DWORD fsize = ::GetFileSize(hfile, &dw);
if(fsize > 300000000)
{
::CloseHandle(hfile);
return false;
}
if(fsize)
{
str.resize(fsize);
if(!::ReadFile( hfile, (LPVOID)str.data(), (DWORD)str.size(), &dw, NULL))
res = false;
}
::CloseHandle(hfile);
return res;
}
return false;
}
*/
inline
bool get_file_time(const std::string& path_to_file, OUT time_t& ft)
{
@@ -371,84 +132,6 @@ namespace file_io_utils
return false;
}
}
/*
bool remove_dir_and_subirs(const char* path_to_dir);
inline
bool clean_dir(const char* path_to_dir)
{
if(!path_to_dir)
return false;
std::string folder = path_to_dir;
WIN32_FIND_DATAA find_data = {0};
HANDLE hfind = ::FindFirstFileA((folder + "\\*.*").c_str(), &find_data);
if(INVALID_HANDLE_VALUE == hfind)
return false;
do{
if(!strcmp("..", find_data.cFileName) || (!strcmp(".", find_data.cFileName)))
continue;
if(find_data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)
{
if(!remove_dir_and_subirs((folder + "\\" + find_data.cFileName).c_str()))
return false;
}else
{
if(!::DeleteFileA((folder + "\\" + find_data.cFileName).c_str()))
return false;
}
}while(::FindNextFileA(hfind, &find_data));
::FindClose(hfind);
return true;
}
*/
#ifdef WINDOWS_PLATFORM
inline bool get_folder_content(const std::string& path, std::list<WIN32_FIND_DATAA>& OUT target_list)
{
WIN32_FIND_DATAA find_data = {0};
HANDLE hfind = ::FindFirstFileA((path + "\\*.*").c_str(), &find_data);
if(INVALID_HANDLE_VALUE == hfind)
return false;
do{
if(!strcmp("..", find_data.cFileName) || (!strcmp(".", find_data.cFileName)))
continue;
target_list.push_back(find_data);
}while(::FindNextFileA(hfind, &find_data));
::FindClose(hfind);
return true;
}
#endif
inline bool get_folder_content(const std::string& path, std::list<std::string>& OUT target_list, bool only_files = false)
{
try
{
boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
for ( boost::filesystem::directory_iterator itr( path ); itr != end_itr; ++itr )
{
if ( only_files && boost::filesystem::is_directory(itr->status()) )
{
continue;
}
target_list.push_back(itr->path().filename().string());
}
}
catch(...)
{
return false;
}
return true;
}
}
}

View File

@@ -0,0 +1,65 @@
// Copyright (c) 2017, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include <array>
#include <cstdint>
#include <iosfwd>
#include <string>
#include "span.h"
namespace epee
{
struct to_hex
{
//! \return A std::string containing hex of `src`.
static std::string string(const span<const std::uint8_t> src);
//! \return An array containing hex of `src`.
template<std::size_t N>
static std::array<char, N * 2> array(const std::array<std::uint8_t, N>& src) noexcept
{
std::array<char, N * 2> out{{}};
static_assert(N <= 128, "keep the stack size down");
buffer_unchecked(out.data(), {src.data(), src.size()});
return out;
}
//! Append `src` as hex to `out`.
static void buffer(std::ostream& out, const span<const std::uint8_t> src);
//! Append `< + src + >` as hex to `out`.
static void formatted(std::ostream& out, const span<const std::uint8_t> src);
private:
//! Write `src` bytes as hex to `out`. `out` must be twice the length
static void buffer_unchecked(char* out, const span<const std::uint8_t> src) noexcept;
};
}

View File

@@ -74,7 +74,7 @@ namespace md5
static void MD5Init(MD5_CTX * context);
static void MD5Update( MD5_CTX *context, const unsigned char *input, unsigned int inputLen );
static void MD5Final ( unsigned char digest[16], MD5_CTX *context );
static void hmac_md5(const unsigned char* text, int text_len, const unsigned char* key, int key_len, unsigned char *digest);
static inline void hmac_md5(const unsigned char* text, int text_len, const unsigned char* key, int key_len, unsigned char *digest);
inline bool md5( unsigned char *input, int ilen, unsigned char output[16] )

View File

@@ -58,14 +58,11 @@ These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/* do i need all of this just for htonl()? damn. */
//#include <sys/types.h>
//#include <sys/param.h>
//#include <sys/socket.h>
//#include <netinet/in.h>
#ifdef _WIN32
# include <winsock2.h>
#else
# include <arpa/inet.h>
#endif
#include "md5global.h"
#include "md5_l.h"
#include "hmac-md5.h"

File diff suppressed because it is too large Load Diff

View File

@@ -48,16 +48,18 @@ namespace epee
namespace misc_utils
{
inline uint64_t get_tick_count()
inline uint64_t get_ns_count()
{
#if defined(_MSC_VER)
return ::GetTickCount64();
return ::GetTickCount64() * 1000000;
#elif defined(WIN32)
# if defined(WIN64)
return GetTickCount64();
# else
return GetTickCount();
# endif
static LARGE_INTEGER pcfreq = {0};
LARGE_INTEGER ticks;
if (!pcfreq.QuadPart)
QueryPerformanceFrequency(&pcfreq);
QueryPerformanceCounter(&ticks);
ticks.QuadPart *= 1000000000; /* we want nsec */
return ticks.QuadPart / pcfreq.QuadPart;
#elif defined(__MACH__)
clock_serv_t cclock;
mach_timespec_t mts;
@@ -66,16 +68,21 @@ namespace misc_utils
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
return (mts.tv_sec * 1000) + (mts.tv_nsec/1000000);
return (mts.tv_sec * 1000000000) + (mts.tv_nsec);
#else
struct timespec ts;
if(clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
return 0;
}
return (ts.tv_sec * 1000) + (ts.tv_nsec/1000000);
return (ts.tv_sec * 1000000000) + (ts.tv_nsec);
#endif
}
inline uint64_t get_tick_count()
{
return get_ns_count() / 1000000;
}
inline int call_sys_cmd(const std::string& cmd)
{

View File

@@ -38,6 +38,9 @@
#pragma comment(lib, "Ws2_32.lib")
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
namespace net_utils
@@ -293,7 +296,7 @@ namespace net_utils
}
//----------------------------------------------------------------------------------------
template<class THandler>
bool abstract_tcp_server<THandler>::invoke_connection(SOCKET hnew_sock, long ip_from, int post_from)
bool abstract_tcp_server<THandler>::invoke_connection(SOCKET hnew_sock, const network_address &remote_address)
{
m_connections_lock.lock();
m_connections.push_back(thread_context());
@@ -301,8 +304,7 @@ namespace net_utils
m_connections.back().m_socket = hnew_sock;
m_connections.back().powner = this;
m_connections.back().m_self_it = --m_connections.end();
m_connections.back().m_context.m_remote_ip = ip_from;
m_connections.back().m_context.m_remote_port = post_from;
m_connections.back().m_context.m_remote_address = remote_address;
m_connections.back().m_htread = threads_helper::create_thread(ConnectionHandlerProc, &m_connections.back());
return true;

View File

@@ -55,9 +55,11 @@
#include "net_utils_base.h"
#include "syncobj.h"
#include "../../../../src/p2p/connection_basic.hpp"
#include "../../../../contrib/otshell_utils/utils.hpp"
#include "../../../../src/p2p/network_throttle-detail.hpp"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#define ABSTRACT_SERVER_SEND_QUE_MAX_COUNT 1000
namespace epee
@@ -67,7 +69,7 @@ namespace net_utils
struct i_connection_filter
{
virtual bool is_remote_ip_allowed(uint32_t adress)=0;
virtual bool is_remote_host_allowed(const epee::net_utils::network_address &address)=0;
protected:
virtual ~i_connection_filter(){}
};
@@ -95,7 +97,7 @@ namespace net_utils
i_connection_filter * &pfilter
,t_connection_type connection_type);
virtual ~connection();
virtual ~connection() noexcept(false);
/// Get the socket associated with the connection.
boost::asio::ip::tcp::socket& socket();
@@ -300,7 +302,6 @@ namespace net_utils
boost::thread::id m_main_thread_id;
critical_section m_threads_lock;
volatile uint32_t m_thread_index; // TODO change to std::atomic
void detach_threads();
t_connection_type m_connection_type;

View File

@@ -51,9 +51,8 @@
#include "../../../../src/cryptonote_core/cryptonote_core.h" // e.g. for the send_stop_signal()
#include "../../../../contrib/otshell_utils/utils.hpp"
#include "../../../../src/p2p/data_logger.hpp"
using namespace nOT::nUtils; // TODO
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#define CONNECTION_CLEANUP_TIME 30 // seconds
@@ -83,12 +82,12 @@ PRAGMA_WARNING_DISABLE_VS(4355)
m_throttle_speed_in("speed_in", "throttle_speed_in"),
m_throttle_speed_out("speed_out", "throttle_speed_out")
{
_info_c("net/sleepRPC", "test, connection constructor set m_connection_type="<<m_connection_type);
MINFO("test, connection constructor set m_connection_type="<<m_connection_type);
}
PRAGMA_WARNING_DISABLE_VS(4355)
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
connection<t_protocol_handler>::~connection()
connection<t_protocol_handler>::~connection() noexcept(false)
{
if(!m_was_shutdown)
{
@@ -134,6 +133,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
boost::system::error_code ec;
auto remote_ep = socket_.remote_endpoint(ec);
CHECK_AND_NO_ASSERT_MES(!ec, false, "Failed to get remote endpoint: " << ec.message() << ':' << ec.value());
CHECK_AND_NO_ASSERT_MES(remote_ep.address().is_v4(), false, "IPv6 not supported here");
auto local_ep = socket_.local_endpoint(ec);
CHECK_AND_NO_ASSERT_MES(!ec, false, "Failed to get local endpoint: " << ec.message() << ':' << ec.value());
@@ -146,14 +146,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
// that stuff turns out to be included, even though it's from src... Taking advantage
random_uuid = crypto::rand<boost::uuids::uuid>();
context.set_details(random_uuid, ip_, remote_ep.port(), is_income);
context.set_details(random_uuid, new epee::net_utils::ipv4_network_address(ip_, remote_ep.port()), is_income);
_dbg3("[sock " << socket_.native_handle() << "] new connection from " << print_connection_context_short(context) <<
" to " << local_ep.address().to_string() << ':' << local_ep.port() <<
", total sockets objects " << m_ref_sock_count);
if(m_pfilter && !m_pfilter->is_remote_ip_allowed(context.m_remote_ip))
if(m_pfilter && !m_pfilter->is_remote_host_allowed(context.m_remote_address))
{
_dbg2("[sock " << socket_.native_handle() << "] ip denied " << string_tools::get_ip_string_from_int32(context.m_remote_ip) << ", shutdowning connection");
_dbg2("[sock " << socket_.native_handle() << "] host denied " << context.m_remote_address.host_str() << ", shutdowning connection");
close();
return false;
}
@@ -209,14 +209,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
bool connection<t_protocol_handler>::add_ref()
{
TRY_ENTRY();
//_dbg3("[sock " << socket_.native_handle() << "] add_ref, m_peer_number=" << mI->m_peer_number);
CRITICAL_REGION_LOCAL(m_self_refs_lock);
//_dbg3("[sock " << socket_.native_handle() << "] add_ref 2, m_peer_number=" << mI->m_peer_number);
// Use safe_shared_from_this, because of this is public method and it can be called on the object being deleted
auto self = safe_shared_from_this();
if(!self)
return false;
//_dbg3("[sock " << socket_.native_handle() << "] add_ref, m_peer_number=" << mI->m_peer_number);
CRITICAL_REGION_LOCAL(self->m_self_refs_lock);
//_dbg3("[sock " << socket_.native_handle() << "] add_ref 2, m_peer_number=" << mI->m_peer_number);
if(m_was_shutdown)
return false;
m_self_refs.push_back(self);
@@ -229,7 +229,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
{
TRY_ENTRY();
boost::shared_ptr<connection<t_protocol_handler> > back_connection_copy;
LOG_PRINT_L4("[sock " << socket_.native_handle() << "] release");
LOG_TRACE_CC(context, "[sock " << socket_.native_handle() << "] release");
CRITICAL_REGION_BEGIN(m_self_refs_lock);
CHECK_AND_ASSERT_MES(m_self_refs.size(), false, "[sock " << socket_.native_handle() << "] m_self_refs empty at connection<t_protocol_handler>::release() call");
//erasing from container without additional copy can cause start deleting object, including m_self_refs
@@ -266,8 +266,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
address = endpoint.address().to_string();
port = boost::lexical_cast<std::string>(endpoint.port());
}
_mark_c("net/kind" ,
" connection type " << to_string( m_connection_type ) << " "
MINFO(" connection type " << to_string( m_connection_type ) << " "
<< socket_.local_endpoint().address().to_string() << ":" << socket_.local_endpoint().port()
<< " <--> " << address << ":" << port);
}
@@ -306,7 +305,6 @@ PRAGMA_WARNING_DISABLE_VS(4355)
delay *= 0.5;
if (delay > 0) {
long int ms = (long int)(delay * 100);
epee::net_utils::data_logger::get_instance().add_data("sleep_down", ms);
boost::this_thread::sleep_for(boost::chrono::milliseconds(ms));
}
} while(delay > 0);
@@ -397,14 +395,14 @@ PRAGMA_WARNING_DISABLE_VS(4355)
const t_safe chunksize_max = chunksize_good * 2 ;
const bool allow_split = (m_connection_type == e_connection_type_RPC) ? false : true; // do not split RPC data
ASRT(! (chunksize_max<0) ); // make sure it is unsigned before removin sign with cast:
CHECK_AND_ASSERT_MES(! (chunksize_max<0), false, "Negative chunksize_max" ); // make sure it is unsigned before removin sign with cast:
long long unsigned int chunksize_max_unsigned = static_cast<long long unsigned int>( chunksize_max ) ;
if (allow_split && (cb > chunksize_max_unsigned)) {
{ // LOCK: chunking
epee::critical_region_t<decltype(m_chunking_lock)> send_guard(m_chunking_lock); // *** critical ***
_dbg3_c("net/out/size", "do_send() will SPLIT into small chunks, from packet="<<cb<<" B for ptr="<<ptr);
MDEBUG("do_send() will SPLIT into small chunks, from packet="<<cb<<" B for ptr="<<ptr);
t_safe all = cb; // all bytes to send
t_safe pos = 0; // current sending position
// 01234567890
@@ -419,39 +417,39 @@ PRAGMA_WARNING_DISABLE_VS(4355)
while (pos < all) {
t_safe lenall = all-pos; // length from here to end
t_safe len = std::min( chunksize_good , lenall); // take a smaller part
ASRT(len<=chunksize_good);
CHECK_AND_ASSERT_MES(len<=chunksize_good, false, "len too large");
// pos=8; len=4; all=10; len=3;
ASRT(! (len<0) ); // check before we cast away sign:
CHECK_AND_ASSERT_MES(! (len<0), false, "negative len"); // check before we cast away sign:
unsigned long long int len_unsigned = static_cast<long long int>( len );
ASRT(len>0); // (redundand)
ASRT(len_unsigned < std::numeric_limits<size_t>::max()); // yeap we want strong < then max size, to be sure
CHECK_AND_ASSERT_MES(len>0, false, "len not strictly positive"); // (redundant)
CHECK_AND_ASSERT_MES(len_unsigned < std::numeric_limits<size_t>::max(), false, "Invalid len_unsigned"); // yeap we want strong < then max size, to be sure
void *chunk_start = ((char*)ptr) + pos;
_fact_c("net/out/size","chunk_start="<<chunk_start<<" ptr="<<ptr<<" pos="<<pos);
ASRT(chunk_start >= ptr); // not wrapped around address?
MDEBUG("chunk_start="<<chunk_start<<" ptr="<<ptr<<" pos="<<pos);
CHECK_AND_ASSERT_MES(chunk_start >= ptr, false, "Pointer wraparound"); // not wrapped around address?
//std::memcpy( (void*)buf, chunk_start, len);
_dbg3_c("net/out/size", "part of " << lenall << ": pos="<<pos << " len="<<len);
MDEBUG("part of " << lenall << ": pos="<<pos << " len="<<len);
bool ok = do_send_chunk(chunk_start, len); // <====== ***
all_ok = all_ok && ok;
if (!all_ok) {
_dbg1_c("net/out/size", "do_send() DONE ***FAILED*** from packet="<<cb<<" B for ptr="<<ptr);
_dbg1("do_send() SEND was aborted in middle of big package - this is mostly harmless "
MDEBUG("do_send() DONE ***FAILED*** from packet="<<cb<<" B for ptr="<<ptr);
MDEBUG("do_send() SEND was aborted in middle of big package - this is mostly harmless "
<< " (e.g. peer closed connection) but if it causes trouble tell us at #monero-dev. " << cb);
return false; // partial failure in sending
}
pos = pos+len; ASRT(pos >0);
pos = pos+len;
CHECK_AND_ASSERT_MES(pos >0, false, "pos <= 0");
// (in catch block, or uniq pointer) delete buf;
} // each chunk
_dbg3_c("net/out/size", "do_send() DONE SPLIT from packet="<<cb<<" B for ptr="<<ptr);
_dbg3 ( "do_send() DONE SPLIT from packet="<<cb<<" B for ptr="<<ptr);
MDEBUG("do_send() DONE SPLIT from packet="<<cb<<" B for ptr="<<ptr);
_info_c("net/sleepRPC", "do_send() m_connection_type = " << m_connection_type);
MDEBUG("do_send() m_connection_type = " << m_connection_type);
return all_ok; // done - e.g. queued - all the chunks of current do_send call
} // LOCK: chunking
@@ -490,7 +488,9 @@ PRAGMA_WARNING_DISABLE_VS(4355)
sleep_before_packet(cb, 1, 1);
}
epee::critical_region_t<decltype(m_send_que_lock)> send_guard(m_send_que_lock); // *** critical ***
m_send_que_lock.lock(); // *** critical ***
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){m_send_que_lock.unlock();});
long int retry=0;
const long int retry_limit = 5*4;
while (m_send_que.size() > ABSTRACT_SERVER_SEND_QUE_MAX_COUNT)
@@ -503,15 +503,15 @@ PRAGMA_WARNING_DISABLE_VS(4355)
}*/
long int ms = 250 + (rand()%50);
_info_c("net/sleep", "Sleeping because QUEUE is FULL, in " << __FUNCTION__ << " for " << ms << " ms before packet_size="<<cb); // XXX debug sleep
MDEBUG("Sleeping because QUEUE is FULL, in " << __FUNCTION__ << " for " << ms << " ms before packet_size="<<cb); // XXX debug sleep
m_send_que_lock.unlock();
boost::this_thread::sleep(boost::posix_time::milliseconds( ms ) );
m_send_que_lock.lock();
_dbg1("sleep for queue: " << ms);
if (retry > retry_limit) {
send_guard.unlock();
_erro("send que size is more than ABSTRACT_SERVER_SEND_QUE_MAX_COUNT(" << ABSTRACT_SERVER_SEND_QUE_MAX_COUNT << "), shutting down connection");
// _dbg1_c("net/sleep", "send que size is more than ABSTRACT_SERVER_SEND_QUE_MAX_COUNT(" << ABSTRACT_SERVER_SEND_QUE_MAX_COUNT << "), shutting down connection");
close();
MWARNING("send que size is more than ABSTRACT_SERVER_SEND_QUE_MAX_COUNT(" << ABSTRACT_SERVER_SEND_QUE_MAX_COUNT << "), shutting down connection");
shutdown();
return false;
}
}
@@ -522,10 +522,10 @@ PRAGMA_WARNING_DISABLE_VS(4355)
if(m_send_que.size() > 1)
{ // active operation should be in progress, nothing to do, just wait last operation callback
auto size_now = cb;
_info_c("net/out/size", "do_send() NOW just queues: packet="<<size_now<<" B, is added to queue-size="<<m_send_que.size());
MDEBUG("do_send() NOW just queues: packet="<<size_now<<" B, is added to queue-size="<<m_send_que.size());
//do_send_handler_delayed( ptr , size_now ); // (((H))) // empty function
LOG_PRINT_L4("[sock " << socket_.native_handle() << "] Async send requested " << m_send_que.front().size());
LOG_TRACE_CC(context, "[sock " << socket_.native_handle() << "] Async send requested " << m_send_que.front().size());
}
else
{ // no active operation
@@ -537,11 +537,11 @@ PRAGMA_WARNING_DISABLE_VS(4355)
}
auto size_now = m_send_que.front().size();
_dbg1_c("net/out/size", "do_send() NOW SENSD: packet="<<size_now<<" B");
MDEBUG("do_send() NOW SENSD: packet="<<size_now<<" B");
if (speed_limit_is_enabled())
do_send_handler_write( ptr , size_now ); // (((H)))
ASRT( size_now == m_send_que.front().size() );
CHECK_AND_ASSERT_MES( size_now == m_send_que.front().size(), false, "Unexpected queue size");
boost::asio::async_write(socket_, boost::asio::buffer(m_send_que.front().data(), size_now ) ,
//strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_write, self, _1, _2)
@@ -599,7 +599,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
void connection<t_protocol_handler>::handle_write(const boost::system::error_code& e, size_t cb)
{
TRY_ENTRY();
LOG_PRINT_L4("[sock " << socket_.native_handle() << "] Async send calledback " << cb);
LOG_TRACE_CC(context, "[sock " << socket_.native_handle() << "] Async send calledback " << cb);
if (e)
{
@@ -632,10 +632,10 @@ PRAGMA_WARNING_DISABLE_VS(4355)
{
//have more data to send
auto size_now = m_send_que.front().size();
_dbg1_c("net/out/size", "handle_write() NOW SENDS: packet="<<size_now<<" B" <<", from queue size="<<m_send_que.size());
MDEBUG("handle_write() NOW SENDS: packet="<<size_now<<" B" <<", from queue size="<<m_send_que.size());
if (speed_limit_is_enabled())
do_send_handler_write_from_queue(e, m_send_que.front().size() , m_send_que.size()); // (((H)))
ASRT( size_now == m_send_que.front().size() );
CHECK_AND_ASSERT_MES( size_now == m_send_que.front().size(), void(), "Unexpected queue size");
boost::asio::async_write(socket_, boost::asio::buffer(m_send_que.front().data(), size_now) ,
// strand_.wrap(
boost::bind(&connection<t_protocol_handler>::handle_write, connection<t_protocol_handler>::shared_from_this(), _1, _2)
@@ -657,8 +657,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
void connection<t_protocol_handler>::setRpcStation()
{
m_connection_type = e_connection_type_RPC;
_fact_c("net/sleepRPC", "set m_connection_type = RPC ");
_info_c("net/kind", "set m_connection_type = RPC ");
MDEBUG("set m_connection_type = RPC ");
}
@@ -680,7 +679,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
m_sock_count(0), m_sock_number(0), m_threads_count(0),
m_pfilter(NULL), m_thread_index(0),
m_connection_type( connection_type ),
new_connection_(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type))
new_connection_()
{
create_server_type_map();
m_thread_name_prefix = "NET";
@@ -694,7 +693,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
m_sock_count(0), m_sock_number(0), m_threads_count(0),
m_pfilter(NULL), m_thread_index(0),
m_connection_type(connection_type),
new_connection_(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, connection_type))
new_connection_()
{
create_server_type_map();
m_thread_name_prefix = "NET";
@@ -724,7 +723,7 @@ PRAGMA_WARNING_DISABLE_VS(4355)
m_address = address;
// Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
boost::asio::ip::tcp::resolver resolver(io_service_);
boost::asio::ip::tcp::resolver::query query(address, boost::lexical_cast<std::string>(port));
boost::asio::ip::tcp::resolver::query query(address, boost::lexical_cast<std::string>(port), boost::asio::ip::tcp::resolver::query::canonical_name);
boost::asio::ip::tcp::endpoint endpoint = *resolver.resolve(query);
acceptor_.open(endpoint.protocol());
acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
@@ -732,7 +731,8 @@ PRAGMA_WARNING_DISABLE_VS(4355)
acceptor_.listen();
boost::asio::ip::tcp::endpoint binded_endpoint = acceptor_.local_endpoint();
m_port = binded_endpoint.port();
_fact_c("net/RPClog", "start accept");
MDEBUG("start accept");
new_connection_.reset(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type));
acceptor_.async_accept(new_connection_->socket(),
boost::bind(&boosted_tcp_server<t_protocol_handler>::handle_accept, this,
boost::asio::placeholders::error));
@@ -749,7 +749,7 @@ DISABLE_GCC_WARNING(maybe-uninitialized)
uint32_t p = 0;
if (port.size() && !string_tools::get_xtype_from_string(p, port)) {
LOG_ERROR("Failed to convert port no = " << port);
MERROR("Failed to convert port no = " << port);
return false;
}
return this->init_server(p, address);
@@ -763,7 +763,7 @@ POP_WARNINGS
uint32_t local_thr_index = boost::interprocess::ipcdetail::atomic_inc32(&m_thread_index);
std::string thread_name = std::string("[") + m_thread_name_prefix;
thread_name += boost::to_string(local_thr_index) + "]";
log_space::log_singletone::set_thread_log_prefix(thread_name);
MLOG_SET_THREAD_NAME(thread_name);
// _fact("Thread name: " << m_thread_name_prefix);
while(!m_stop_signal_sent)
{
@@ -792,8 +792,7 @@ POP_WARNINGS
auto it = server_type_map.find(m_thread_name_prefix);
if (it==server_type_map.end()) throw std::runtime_error("Unknown prefix/server type:" + std::string(prefix_name));
auto connection_type = it->second; // the value of type
_info_c("net/RPClog", "Set server type to: " << connection_type << " from name: " << m_thread_name_prefix);
_info_c("net/RPClog", "prefix_name = " << prefix_name);
MINFO("Set server type to: " << connection_type << " from name: " << m_thread_name_prefix << ", prefix_name = " << prefix_name);
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
@@ -808,7 +807,7 @@ POP_WARNINGS
TRY_ENTRY();
m_threads_count = threads_count;
m_main_thread_id = boost::this_thread::get_id();
log_space::log_singletone::set_thread_log_prefix("[SRV_MAIN]");
MLOG_SET_THREAD_NAME("[SRV_MAIN]");
add_idle_handler(boost::bind(&boosted_tcp_server::cleanup_connections, this), 5000);
while(!m_stop_signal_sent)
{
@@ -824,7 +823,7 @@ POP_WARNINGS
}
CRITICAL_REGION_END();
// Wait for all threads in the pool to exit.
if (wait) // && ! ::cryptonote::core::get_is_stopping()) // TODO fast_exit
if (wait)
{
_fact("JOINING all threads");
for (std::size_t i = 0; i < m_threads.size(); ++i) {
@@ -894,10 +893,6 @@ POP_WARNINGS
template<class t_protocol_handler>
void boosted_tcp_server<t_protocol_handler>::send_stop_signal()
{
if (::cryptonote::core::get_fast_exit() == true)
{
detach_threads();
}
m_stop_signal_sent = true;
TRY_ENTRY();
connections_mutex.lock();
@@ -933,13 +928,12 @@ POP_WARNINGS
template<class t_protocol_handler>
void boosted_tcp_server<t_protocol_handler>::handle_accept(const boost::system::error_code& e)
{
_fact_c("net/RPClog", "handle_accept");
MDEBUG("handle_accept");
TRY_ENTRY();
if (!e)
{
if (m_connection_type == e_connection_type_RPC) {
_note_c("net/rpc", "New server for RPC connections");
_fact_c("net/RPClog", "New server for RPC connections");
MDEBUG("New server for RPC connections");
new_connection_->setRpcStation(); // hopefully this is not needed actually
}
connection_ptr conn(std::move(new_connection_));
@@ -965,13 +959,13 @@ POP_WARNINGS
connection_ptr new_connection_l(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type) );
connections_mutex.lock();
connections_.push_back(std::make_pair(boost::get_system_time(), new_connection_l));
LOG_PRINT_L2("connections_ size now " << connections_.size());
MDEBUG("connections_ size now " << connections_.size());
connections_mutex.unlock();
boost::asio::ip::tcp::socket& sock_ = new_connection_l->socket();
//////////////////////////////////////////////////////////////////////////
boost::asio::ip::tcp::resolver resolver(io_service_);
boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), adr, port);
boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), adr, port, boost::asio::ip::tcp::resolver::query::canonical_name);
boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query);
boost::asio::ip::tcp::resolver::iterator end;
if(iterator == end)
@@ -1011,7 +1005,7 @@ POP_WARNINGS
boost::unique_lock<boost::mutex> lock(local_shared_context->connect_mut);
auto connect_callback = [](boost::system::error_code ec_, boost::shared_ptr<local_async_context> shared_context)
{
shared_context->connect_mut.lock(); shared_context->ec = ec_; shared_context->connect_mut.unlock(); shared_context->cond.notify_one();
shared_context->connect_mut.lock(); shared_context->ec = ec_; shared_context->cond.notify_one(); shared_context->connect_mut.unlock();
};
sock_.async_connect(remote_endpoint, boost::bind<void>(connect_callback, _1, local_shared_context));
@@ -1052,7 +1046,7 @@ POP_WARNINGS
}
else
{
_erro("[sock " << new_connection_->socket().native_handle() << "] Failed to start connection, connections_count = " << m_sock_count);
_erro("[sock " << new_connection_l->socket().native_handle() << "] Failed to start connection, connections_count = " << m_sock_count);
}
new_connection_l->save_dbg_log();
@@ -1069,13 +1063,13 @@ POP_WARNINGS
connection_ptr new_connection_l(new connection<t_protocol_handler>(io_service_, m_config, m_sock_count, m_sock_number, m_pfilter, m_connection_type) );
connections_mutex.lock();
connections_.push_back(std::make_pair(boost::get_system_time(), new_connection_l));
LOG_PRINT_L2("connections_ size now " << connections_.size());
MDEBUG("connections_ size now " << connections_.size());
connections_mutex.unlock();
boost::asio::ip::tcp::socket& sock_ = new_connection_l->socket();
//////////////////////////////////////////////////////////////////////////
boost::asio::ip::tcp::resolver resolver(io_service_);
boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), adr, port);
boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), adr, port, boost::asio::ip::tcp::resolver::query::canonical_name);
boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query);
boost::asio::ip::tcp::resolver::iterator end;
if(iterator == end)
@@ -1141,14 +1135,6 @@ POP_WARNINGS
return true;
CATCH_ENTRY_L0("boosted_tcp_server<t_protocol_handler>::connect_async", false);
}
//---------------------------------------------------------------------------------
template<class t_protocol_handler>
void boosted_tcp_server<t_protocol_handler>::detach_threads()
{
for (auto thread : m_threads)
thread->detach();
}
} // namespace
} // namespace

View File

@@ -42,6 +42,9 @@
#include "net_utils_base.h"
#include "pragma_comp_defs.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#define LEVIN_DEFAULT_DATA_BUFF_SIZE 2000
namespace epee

View File

@@ -27,6 +27,9 @@
#pragma comment(lib, "Ws2_32.lib")
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
namespace net_utils
@@ -468,7 +471,7 @@ bool cp_server_impl<TProtocol>::run_server(int threads_count = 0)
}
//-------------------------------------------------------------
template<class TProtocol>
bool cp_server_impl<TProtocol>::add_new_connection(SOCKET new_sock, long ip_from, int port_from)
bool cp_server_impl<TProtocol>::add_new_connection(SOCKET new_sock, const network_address &address_from)
{
PROFILE_FUNC("[add_new_connection]");
@@ -484,8 +487,7 @@ bool cp_server_impl<TProtocol>::add_new_connection(SOCKET new_sock, long ip_from
m_connections_lock.unlock();
conn.init_buffers();
conn.m_sock = new_sock;
conn.context.m_remote_ip = ip_from;
conn.context.m_remote_port = port_from;
conn.context.m_remote_address = address_from;
conn.m_completion_port = m_completion_port;
{
PROFILE_FUNC("[add_new_connection] CreateIoCompletionPort");

View File

@@ -0,0 +1,170 @@
// Copyright (c) 2014-2017, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include <boost/optional/optional.hpp>
#include <boost/utility/string_ref.hpp>
#include <cstdint>
#include <functional>
#include <string>
#include <utility>
#include "http_base.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils
{
namespace http
{
struct login
{
login() : username(), password() {}
login(std::string username_, std::string password_)
: username(std::move(username_)), password(std::move(password_))
{}
std::string username;
std::string password;
};
//! Implements RFC 2617 digest auth. Digests from RFC 7616 can be added.
class http_server_auth
{
public:
struct session
{
session(login credentials_)
: credentials(std::move(credentials_)), nonce(), counter(0)
{}
login credentials;
std::string nonce;
std::uint32_t counter;
};
http_server_auth() : user() {}
http_server_auth(login credentials);
//! \return Auth response, or `boost::none` iff `request` had valid auth.
boost::optional<http_response_info> get_response(const http_request_info& request)
{
if (user)
return do_get_response(request);
return boost::none;
}
private:
boost::optional<http_response_info> do_get_response(const http_request_info& request);
boost::optional<session> user;
};
//! Implements RFC 2617 digest auth. Digests from RFC 7616 can be added.
class http_client_auth
{
public:
enum status : std::uint8_t { kSuccess = 0, kBadPassword, kParseFailure };
struct session
{
session(login credentials_)
: credentials(std::move(credentials_)), server(), counter(0)
{}
struct keys
{
using algorithm =
std::function<std::string(const session&, boost::string_ref, boost::string_ref)>;
keys() : nonce(), opaque(), realm(), generator() {}
keys(std::string nonce_, std::string opaque_, std::string realm_, algorithm generator_)
: nonce(std::move(nonce_))
, opaque(std::move(opaque_))
, realm(std::move(realm_))
, generator(std::move(generator_))
{}
std::string nonce;
std::string opaque;
std::string realm;
algorithm generator;
};
login credentials;
keys server;
std::uint32_t counter;
};
http_client_auth() : user() {}
http_client_auth(login credentials);
/*!
Clients receiving a 401 response code from the server should call this
function to process the server auth. Then, before every client request,
`get_auth_field()` should be called to retrieve the newest
authorization request.
\return `kBadPassword` if client will never be able to authenticate,
`kParseFailure` if all server authentication responses were invalid,
and `kSuccess` if `get_auth_field` is ready to generate authorization
fields.
*/
status handle_401(const http_response_info& response)
{
if (user)
return do_handle_401(response);
return kBadPassword;
}
/*!
After calling `handle_401`, clients should call this function to
generate an authentication field for every request.
\return A HTTP "Authorization" field if `handle_401(...)` previously
returned `kSuccess`.
*/
boost::optional<std::pair<std::string, std::string>> get_auth_field(
const boost::string_ref method, const boost::string_ref uri)
{
if (user)
return do_get_auth_field(method, uri);
return boost::none;
}
private:
status do_handle_401(const http_response_info&);
boost::optional<std::pair<std::string, std::string>> do_get_auth_field(boost::string_ref, boost::string_ref);
boost::optional<session> user;
};
}
}
}

View File

@@ -29,8 +29,15 @@
#pragma once
#include <boost/lexical_cast.hpp>
#include <boost/regex.hpp>
#include <boost/utility/string_ref.hpp>
#include <string>
#include <utility>
#include "string_tools.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils
@@ -86,6 +93,15 @@ namespace net_utils
return std::string();
}
static inline void add_field(std::string& out, const boost::string_ref name, const boost::string_ref value)
{
out.append(name.data(), name.size()).append(": ");
out.append(value.data(), value.size()).append("\r\n");
}
static inline void add_field(std::string& out, const std::pair<std::string, std::string>& field)
{
add_field(out, field.first, field.second);
}
struct http_header_info
@@ -98,6 +114,7 @@ namespace net_utils
std::string m_content_encoding; //"Content-Encoding:"
std::string m_host; //"Host:"
std::string m_cookie; //"Cookie:"
std::string m_user_agent; //"User-Agent:"
fields_list m_etc_fields;
void clear()
@@ -110,6 +127,7 @@ namespace net_utils
m_content_encoding.clear();
m_host.clear();
m_cookie.clear();
m_user_agent.clear();
m_etc_fields.clear();
}
};

View File

@@ -30,6 +30,8 @@
#include <boost/shared_ptr.hpp>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/optional/optional.hpp>
#include <boost/utility/string_ref.hpp>
//#include <mbstring.h>
#include <algorithm>
#include <cctype>
@@ -45,6 +47,7 @@
#include "string_tools.h"
#include "reg_exp_definer.h"
#include "http_base.h"
#include "http_auth.h"
#include "to_nonconst_iterator.h"
#include "net_parse_helpers.h"
@@ -52,6 +55,9 @@
//#pragma comment(lib, "shlwapi.lib")
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
extern epee::critical_section gregexp_lock;
@@ -101,14 +107,14 @@ using namespace std;
//---------------------------------------------------------------------------
static inline const char* get_hex_vals()
{
static char hexVals[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
static const char hexVals[16] = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
return hexVals;
}
static inline const char* get_unsave_chars()
{
//static char unsave_chars[] = "\"<>%\\^[]`+$,@:;/!#?=&";
static char unsave_chars[] = "\"<>%\\^[]`+$,@:;!#&";
static const char unsave_chars[] = "\"<>%\\^[]`+$,@:;!#&";
return unsave_chars;
}
@@ -156,6 +162,17 @@ using namespace std;
return csTmp;
}
static inline int get_index(const char *s, char c) { const char *ptr = (const char*)memchr(s, c, 16); return ptr ? ptr-s : -1; }
static inline
std::string hex_to_dec_2bytes(const char *s)
{
const char *hex = get_hex_vals();
int i0 = get_index(hex, toupper(s[0]));
int i1 = get_index(hex, toupper(s[1]));
if (i0 < 0 || i1 < 0)
return std::string("%") + std::string(1, s[0]) + std::string(1, s[1]);
return std::string(1, i0 * 16 | i1);
}
static inline std::string convert(char val)
{
@@ -180,6 +197,25 @@ using namespace std;
return result;
}
static inline std::string convert_from_url_format(const std::string& uri)
{
std::string result;
for(size_t i = 0; i!= uri.size(); i++)
{
if(uri[i] == '%' && i + 2 < uri.size())
{
result += hex_to_dec_2bytes(uri.c_str() + i + 1);
i += 2;
}
else
result += uri[i];
}
return result;
}
static inline std::string convert_to_url_format_force_all(const std::string& uri)
{
@@ -203,9 +239,6 @@ using namespace std;
class http_simple_client: public i_target_handler
{
public:
private:
enum reciev_machine_state
{
@@ -230,7 +263,7 @@ using namespace std;
blocked_mode_client m_net_client;
std::string m_host_buff;
std::string m_port;
unsigned int m_timeout;
http_client_auth m_auth;
std::string m_header_cache;
http_response_info m_response_info;
size_t m_len_in_summary;
@@ -243,23 +276,48 @@ using namespace std;
critical_section m_lock;
public:
void set_host_name(const std::string& name)
explicit http_simple_client()
: i_target_handler()
, m_net_client()
, m_host_buff()
, m_port()
, m_auth()
, m_header_cache()
, m_response_info()
, m_len_in_summary(0)
, m_len_in_remain(0)
, m_pcontent_encoding_handler(nullptr)
, m_state()
, m_chunked_state()
, m_chunked_cache()
, m_lock()
{}
const std::string &get_host() const { return m_host_buff; };
const std::string &get_port() const { return m_port; };
bool set_server(const std::string& address, boost::optional<login> user)
{
http::url_content parsed{};
const bool r = parse_url(address, parsed);
CHECK_AND_ASSERT_MES(r, false, "failed to parse url: " << address);
set_server(std::move(parsed.host), std::to_string(parsed.port), std::move(user));
return true;
}
void set_server(std::string host, std::string port, boost::optional<login> user)
{
CRITICAL_REGION_LOCAL(m_lock);
m_host_buff = name;
disconnect();
m_host_buff = std::move(host);
m_port = std::move(port);
m_auth = user ? http_client_auth{std::move(*user)} : http_client_auth{};
}
bool connect(const std::string& host, int port, unsigned int timeout)
{
return connect(host, std::to_string(port), timeout);
}
bool connect(const std::string& host, const std::string& port, unsigned int timeout)
bool connect(std::chrono::milliseconds timeout)
{
CRITICAL_REGION_LOCAL(m_lock);
m_host_buff = host;
m_port = port;
m_timeout = timeout;
return m_net_client.connect(host, port, timeout, timeout);
return m_net_client.connect(m_host_buff, m_port, timeout);
}
//---------------------------------------------------------------------------
bool disconnect()
@@ -281,60 +339,97 @@ using namespace std;
piece_of_transfer.clear();
return true;
}
//---------------------------------------------------------------------------
virtual bool on_header(const http_response_info &headers)
{
return true;
}
//---------------------------------------------------------------------------
inline
bool invoke_get(const std::string& uri, const std::string& body = std::string(), const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list())
bool invoke_get(const boost::string_ref uri, std::chrono::milliseconds timeout, const std::string& body = std::string(), const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list())
{
CRITICAL_REGION_LOCAL(m_lock);
return invoke(uri, "GET", body, ppresponse_info, additional_params);
return invoke(uri, "GET", body, timeout, ppresponse_info, additional_params);
}
//---------------------------------------------------------------------------
inline bool invoke(const std::string& uri, const std::string& method, const std::string& body, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list())
inline bool invoke(const boost::string_ref uri, const boost::string_ref method, const std::string& body, std::chrono::milliseconds timeout, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list())
{
CRITICAL_REGION_LOCAL(m_lock);
if(!is_connected())
{
LOG_PRINT("Reconnecting...", LOG_LEVEL_3);
if(!connect(m_host_buff, m_port, m_timeout))
MDEBUG("Reconnecting...");
if(!connect(timeout))
{
LOG_PRINT("Failed to connect to " << m_host_buff << ":" << m_port, LOG_LEVEL_3);
MDEBUG("Failed to connect to " << m_host_buff << ":" << m_port);
return false;
}
}
m_response_info.clear();
std::string req_buff = method + " ";
req_buff += uri + " HTTP/1.1\r\n" +
"Host: "+ m_host_buff +"\r\n" + "Content-Length: " + boost::lexical_cast<std::string>(body.size()) + "\r\n";
std::string req_buff{};
req_buff.reserve(2048);
req_buff.append(method.data(), method.size()).append(" ").append(uri.data(), uri.size()).append(" HTTP/1.1\r\n");
add_field(req_buff, "Host", m_host_buff);
add_field(req_buff, "Content-Length", std::to_string(body.size()));
//handle "additional_params"
for(fields_list::const_iterator it = additional_params.begin(); it!=additional_params.end(); it++)
req_buff += it->first + ": " + it->second + "\r\n";
req_buff += "\r\n";
//--
for(const auto& field : additional_params)
add_field(req_buff, field);
bool res = m_net_client.send(req_buff);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
if(body.size())
res = m_net_client.send(body);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
for (unsigned sends = 0; sends < 2; ++sends)
{
const std::size_t initial_size = req_buff.size();
const auto auth = m_auth.get_auth_field(method, uri);
if (auth)
add_field(req_buff, *auth);
if(ppresponse_info)
*ppresponse_info = &m_response_info;
req_buff += "\r\n";
//--
m_state = reciev_machine_state_header;
return handle_reciev();
bool res = m_net_client.send(req_buff, timeout);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
if(body.size())
res = m_net_client.send(body, timeout);
CHECK_AND_ASSERT_MES(res, false, "HTTP_CLIENT: Failed to SEND");
m_response_info.clear();
m_state = reciev_machine_state_header;
if (!handle_reciev(timeout))
return false;
if (m_response_info.m_response_code != 401)
{
if(ppresponse_info)
*ppresponse_info = std::addressof(m_response_info);
return true;
}
switch (m_auth.handle_401(m_response_info))
{
case http_client_auth::kSuccess:
break;
case http_client_auth::kBadPassword:
sends = 2;
break;
default:
case http_client_auth::kParseFailure:
LOG_ERROR("Bad server response for authentication");
return false;
}
req_buff.resize(initial_size); // rollback for new auth generation
}
LOG_ERROR("Client has incorrect username/password for server requiring authentication");
return false;
}
//---------------------------------------------------------------------------
inline bool invoke_post(const std::string& uri, const std::string& body, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list())
inline bool invoke_post(const boost::string_ref uri, const std::string& body, std::chrono::milliseconds timeout, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list())
{
CRITICAL_REGION_LOCAL(m_lock);
return invoke(uri, "POST", body, ppresponse_info, additional_params);
return invoke(uri, "POST", body, timeout, ppresponse_info, additional_params);
}
private:
//---------------------------------------------------------------------------
inline bool handle_reciev()
inline bool handle_reciev(std::chrono::milliseconds timeout)
{
CRITICAL_REGION_LOCAL(m_lock);
bool keep_handling = true;
@@ -344,9 +439,9 @@ using namespace std;
{
if(need_more_data)
{
if(!m_net_client.recv(recv_buffer))
if(!m_net_client.recv(recv_buffer, timeout))
{
LOG_PRINT("Unexpected reciec fail", LOG_LEVEL_3);
MERROR("Unexpected recv fail");
m_state = reciev_machine_state_error;
}
if(!recv_buffer.size())
@@ -418,6 +513,12 @@ using namespace std;
m_header_cache.erase(m_header_cache.begin()+pos+4, m_header_cache.end());
analize_cached_header_and_invoke_state();
if (!on_header(m_response_info))
{
MDEBUG("Connection cancelled by on_header");
m_state = reciev_machine_state_done;
return false;
}
m_header_cache.clear();
if(!recv_buff.size() && (m_state != reciev_machine_state_error && m_state != reciev_machine_state_done))
need_more_data = true;
@@ -434,13 +535,17 @@ using namespace std;
CRITICAL_REGION_LOCAL(m_lock);
if(!recv_buff.size())
{
LOG_PRINT("Warning: Content-Len mode, but connection unexpectedly closed", LOG_LEVEL_3);
MERROR("Warning: Content-Len mode, but connection unexpectedly closed");
m_state = reciev_machine_state_done;
return true;
}
CHECK_AND_ASSERT_MES(m_len_in_remain >= recv_buff.size(), false, "m_len_in_remain >= recv_buff.size()");
m_len_in_remain -= recv_buff.size();
m_pcontent_encoding_handler->update_in(recv_buff);
if (!m_pcontent_encoding_handler->update_in(recv_buff))
{
m_state = reciev_machine_state_done;
return false;
}
if(m_len_in_remain == 0)
m_state = reciev_machine_state_done;
@@ -548,7 +653,7 @@ using namespace std;
CRITICAL_REGION_LOCAL(m_lock);
if(!recv_buff.size())
{
LOG_PRINT("Warning: CHUNKED mode, but connection unexpectedly closed", LOG_LEVEL_3);
MERROR("Warning: CHUNKED mode, but connection unexpectedly closed");
m_state = reciev_machine_state_done;
return true;
}
@@ -613,7 +718,11 @@ using namespace std;
m_len_in_remain = 0;
}
m_pcontent_encoding_handler->update_in(chunk_body);
if (!m_pcontent_encoding_handler->update_in(chunk_body))
{
m_state = reciev_machine_state_error;
return false;
}
if(!m_len_in_remain)
m_chunked_state = http_chunked_state_chunk_head;
@@ -635,13 +744,13 @@ using namespace std;
inline
bool parse_header(http_header_info& body_info, const std::string& m_cache_to_process)
{
LOG_FRAME("http_stream_filter::parse_cached_header(*)", LOG_LEVEL_4);
MTRACE("http_stream_filter::parse_cached_header(*)");
STATIC_REGEXP_EXPR_1(rexp_mach_field,
"\n?((Connection)|(Referer)|(Content-Length)|(Content-Type)|(Transfer-Encoding)|(Content-Encoding)|(Host)|(Cookie)"
// 12 3 4 5 6 7 8 9
"\n?((Connection)|(Referer)|(Content-Length)|(Content-Type)|(Transfer-Encoding)|(Content-Encoding)|(Host)|(Cookie)|(User-Agent)"
// 12 3 4 5 6 7 8 9 10
"|([\\w-]+?)) ?: ?((.*?)(\r?\n))[^\t ]",
//10 1112 13
//11 1213 14
boost::regex::icase | boost::regex::normal);
boost::smatch result;
@@ -653,8 +762,8 @@ using namespace std;
//lookup all fields and fill well-known fields
while( boost::regex_search( it_current_bound, it_end_bound, result, rexp_mach_field, boost::match_default) && result[0].matched)
{
const size_t field_val = 12;
//const size_t field_etc_name = 10;
const size_t field_val = 13;
//const size_t field_etc_name = 11;
int i = 2; //start position = 2
if(result[i++].matched)//"Connection"
@@ -675,8 +784,10 @@ using namespace std;
}
else if(result[i++].matched)//"Cookie"
body_info.m_cookie = result[field_val];
else if(result[i++].matched)//"User-Agent"
body_info.m_user_agent = result[field_val];
else if(result[i++].matched)//e.t.c (HAVE TO BE MATCHED!)
{;}
body_info.m_etc_fields.emplace_back(result[11], result[field_val]);
else
{CHECK_AND_ASSERT_MES(false, false, "http_stream_filter::parse_cached_header() not matched last entry in:"<<m_cache_to_process);}
@@ -801,7 +912,7 @@ using namespace std;
}else
{ //Apparently there are no signs of the form of transfer, will receive data until the connection is closed
m_state = reciev_machine_state_error;
LOG_PRINT("Undefinded transfer type, consider http_body_transfer_connection_close method. header: " << m_header_cache, LOG_LEVEL_2);
MERROR("Undefinded transfer type, consider http_body_transfer_connection_close method. header: " << m_header_cache);
return false;
}
return false;
@@ -843,33 +954,6 @@ using namespace std;
return true;
}
};
/************************************************************************/
/* */
/************************************************************************/
//inline
template<class t_transport>
bool invoke_request(const std::string& url, t_transport& tr, unsigned int timeout, const http_response_info** ppresponse_info, const std::string& method = "GET", const std::string& body = std::string(), const fields_list& additional_params = fields_list())
{
http::url_content u_c;
bool res = parse_url(url, u_c);
if(!tr.is_connected() && !u_c.host.empty())
{
CHECK_AND_ASSERT_MES(res, false, "failed to parse url: " << url);
if(!u_c.port)
u_c.port = 80;//default for http
res = tr.connect(u_c.host, static_cast<int>(u_c.port), timeout);
CHECK_AND_ASSERT_MES(res, false, "failed to connect " << u_c.host << ":" << u_c.port);
}
return tr.invoke(u_c.uri, method, body, ppresponse_info, additional_params);
}
}
}
}

View File

@@ -1,98 +0,0 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Andrey N. Sabelnikov nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#pragma once
#include "storages/serializeble_struct_helper.h"
namespace epee
{
namespace net_utils
{
namespace http
{
template<class TArg, class TResult, class TTransport>
bool invoke_http_json_remote_command(const std::string& url, TArg& out_struct, TResult& result_struct, TTransport& transport, unsigned int timeout = 5000, const std::string& method = "GET")
{
std::string req_param;
StorageNamed::InMemStorageSpace::json::store_t_to_json(out_struct, req_param);
const http_response_info* pri = NULL;
if(!invoke_request(url, transport, timeout, &pri, method, req_param))
{
LOG_PRINT_L1("Failed to invoke http request to " << url);
return false;
}
if(!pri->m_response_code)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", internal error (null response ptr)");
return false;
}
if(pri->m_response_code != 200)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", wrong response code: " << pri->m_response_code);
return false;
}
return StorageNamed::InMemStorageSpace::json::load_t_from_json(result_struct, pri->m_body);
}
template<class TArg, class TResult, class TTransport>
bool invoke_http_bin_remote_command(const std::string& url, TArg& out_struct, TResult& result_struct, TTransport& transport, unsigned int timeout = 5000, const std::string& method = "GET")
{
std::string req_param;
epee::StorageNamed::save_struct_as_storage_to_buff(out_struct, req_param);
const http_response_info* pri = NULL;
if(!invoke_request(url, transport, timeout, &pri, method, req_param))
{
LOG_PRINT_L1("Failed to invoke http request to " << url);
return false;
}
if(!pri->m_response_code)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", internal error (null response ptr)");
return false;
}
if(pri->m_response_code != 200)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", wrong response code: " << pri->m_response_code);
return false;
}
return epee::StorageNamed::load_struct_from_storage_buff(result_struct, pri->m_body);
}
}
}
}

View File

@@ -26,6 +26,9 @@
#pragma once
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils

View File

@@ -32,6 +32,9 @@
#include <atlutil.h>
#pragma comment(lib, "Wininet.lib")
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils

View File

@@ -30,11 +30,16 @@
#ifndef _HTTP_SERVER_H_
#define _HTTP_SERVER_H_
#include <boost/optional/optional.hpp>
#include <string>
#include "net_utils_base.h"
#include "to_nonconst_iterator.h"
#include "http_auth.h"
#include "http_base.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils
@@ -49,6 +54,7 @@ namespace net_utils
struct http_server_config
{
std::string m_folder;
boost::optional<login> m_user;
critical_section m_lock;
};
@@ -168,11 +174,20 @@ namespace net_utils
http_custom_handler(i_service_endpoint* psnd_hndlr, config_type& config, t_connection_context& conn_context)
: simple_http_connection_handler<t_connection_context>(psnd_hndlr, config),
m_config(config),
m_conn_context(conn_context)
m_conn_context(conn_context),
m_auth(m_config.m_user ? http_server_auth{*m_config.m_user} : http_server_auth{})
{}
inline bool handle_request(const http_request_info& query_info, http_response_info& response)
{
CHECK_AND_ASSERT_MES(m_config.m_phandler, false, "m_config.m_phandler is NULL!!!!");
const auto auth_response = m_auth.get_response(query_info);
if (auth_response)
{
response = std::move(*auth_response);
return true;
}
//fill with default values
response.m_mime_tipe = "text/plain";
response.m_response_code = 200;
@@ -201,6 +216,7 @@ namespace net_utils
//simple_http_connection_handler::config_type m_stub_config;
config_type& m_config;
t_connection_context& m_conn_context;
http_server_auth m_auth;
};
}
}

View File

@@ -33,6 +33,9 @@
#include "file_io_utils.h"
#include "net_parse_helpers.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
#define HTTP_MAX_URI_LEN 9000
#define HTTP_MAX_HEADER_LEN 100000
@@ -133,7 +136,7 @@ namespace net_utils
std::string boundary;
if(!match_boundary(content_type, boundary))
{
LOG_PRINT("Failed to match boundary in content type: " << content_type, LOG_LEVEL_0);
MERROR("Failed to match boundary in content type: " << content_type);
return false;
}
@@ -155,7 +158,7 @@ namespace net_utils
pos = body.find(boundary, std::distance(body.begin(), it_begin));
if(std::string::npos == pos)
{
LOG_PRINT("Error: Filed to match closing multipart tag", LOG_LEVEL_0);
MERROR("Error: Filed to match closing multipart tag");
it_end = body.end();
}else
{
@@ -177,7 +180,7 @@ namespace net_utils
out_values.push_back(multipart_entry());
if(!handle_part_of_multipart(it_begin, it_end, out_values.back()))
{
LOG_PRINT("Failed to handle_part_of_multipart", LOG_LEVEL_0);
MERROR("Failed to handle_part_of_multipart");
return false;
}
@@ -285,7 +288,8 @@ namespace net_utils
}
break;
}
analize_cached_request_header_and_invoke_state(pos);
if (!analize_cached_request_header_and_invoke_state(pos))
return false;
break;
}
case http_state_retriving_body:
@@ -330,8 +334,6 @@ namespace net_utils
template<class t_connection_context>
bool simple_http_connection_handler<t_connection_context>::handle_invoke_query_line()
{
LOG_FRAME("simple_http_connection_handler<t_connection_context>::handle_recognize_protocol_out(*)", LOG_LEVEL_3);
STATIC_REGEXP_EXPR_1(rexp_match_command_line, "^(((OPTIONS)|(GET)|(HEAD)|(POST)|(PUT)|(DELETE)|(TRACE)) (\\S+) HTTP/(\\d+).(\\d+))\r?\n", boost::regex::icase | boost::regex::normal);
// 123 4 5 6 7 8 9 10 11 12
//size_t match_len = 0;
@@ -378,8 +380,6 @@ namespace net_utils
{
//LOG_PRINT_L4("HTTP HEAD:\r\n" << m_cache.substr(0, pos));
LOG_FRAME("simple_http_connection_handler<t_connection_context>::analize_cached_request_header_and_invoke_state(*)", LOG_LEVEL_3);
m_query_info.m_full_request_buf_size = pos;
m_query_info.m_request_head.assign(m_cache.begin(), m_cache.begin()+pos);
@@ -387,6 +387,7 @@ namespace net_utils
{
LOG_ERROR("simple_http_connection_handler<t_connection_context>::analize_cached_request_header_and_invoke_state(): failed to anilize request header: " << m_cache);
m_state = http_state_error;
return false;
}
m_cache.erase(0, pos);
@@ -470,13 +471,11 @@ namespace net_utils
template<class t_connection_context>
bool simple_http_connection_handler<t_connection_context>::parse_cached_header(http_header_info& body_info, const std::string& m_cache_to_process, size_t pos)
{
LOG_FRAME("http_stream_filter::parse_cached_header(*)", LOG_LEVEL_3);
STATIC_REGEXP_EXPR_1(rexp_mach_field,
"\n?((Connection)|(Referer)|(Content-Length)|(Content-Type)|(Transfer-Encoding)|(Content-Encoding)|(Host)|(Cookie)"
// 12 3 4 5 6 7 8 9
"\n?((Connection)|(Referer)|(Content-Length)|(Content-Type)|(Transfer-Encoding)|(Content-Encoding)|(Host)|(Cookie)|(User-Agent)"
// 12 3 4 5 6 7 8 9 10
"|([\\w-]+?)) ?: ?((.*?)(\r?\n))[^\t ]",
//10 1112 13
//11 1213 14
boost::regex::icase | boost::regex::normal);
boost::smatch result;
@@ -488,8 +487,8 @@ namespace net_utils
//lookup all fields and fill well-known fields
while( boost::regex_search( it_current_bound, it_end_bound, result, rexp_mach_field, boost::match_default) && result[0].matched)
{
const size_t field_val = 12;
const size_t field_etc_name = 10;
const size_t field_val = 13;
const size_t field_etc_name = 11;
int i = 2; //start position = 2
if(result[i++].matched)//"Connection"
@@ -508,6 +507,8 @@ namespace net_utils
body_info.m_host = result[field_val];
else if(result[i++].matched)//"Cookie"
body_info.m_cookie = result[field_val];
else if(result[i++].matched)//"User-Agent"
body_info.m_user_agent = result[field_val];
else if(result[i++].matched)//e.t.c (HAVE TO BE MATCHED!)
body_info.m_etc_fields.push_back(std::pair<std::string, std::string>(result[field_etc_name], result[field_val]));
else
@@ -546,7 +547,7 @@ namespace net_utils
LOG_PRINT_L3("HTTP_RESPONSE_HEAD: << \r\n" << response_data);
m_psnd_hndlr->do_send((void*)response_data.data(), response_data.size());
if(response.m_body.size())
if(response.m_body.size() && (query_info.m_http_method != http::http_method_head))
m_psnd_hndlr->do_send((void*)response.m_body.data(), response.m_body.size());
return res;
}
@@ -565,7 +566,7 @@ namespace net_utils
m_config.m_lock.unlock();
if(!file_io_utils::load_file_to_string(destination_file_path.c_str(), response.m_body))
{
LOG_PRINT("URI \""<< query_info.m_full_request_str.substr(0, query_info.m_full_request_str.size()-2) << "\" [" << destination_file_path << "] Not Found (404 )" , LOG_LEVEL_1);
MWARNING("URI \""<< query_info.m_full_request_str.substr(0, query_info.m_full_request_str.size()-2) << "\" [" << destination_file_path << "] Not Found (404 )");
response.m_body = get_not_found_response_body(query_info.m_URI);
response.m_response_code = 404;
response.m_response_comment = "Not found";
@@ -573,7 +574,7 @@ namespace net_utils
return true;
}
LOG_PRINT(" -->> " << query_info.m_full_request_str << "\r\n<<--OK" , LOG_LEVEL_3);
MDEBUG(" -->> " << query_info.m_full_request_str << "\r\n<<--OK");
response.m_response_code = 200;
response.m_response_comment = "OK";
response.m_mime_tipe = get_file_mime_tipe(uri_to_path);

View File

@@ -32,6 +32,10 @@
#include "abstract_tcp_server_cp.h"
#include "http_server.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils

View File

@@ -32,6 +32,10 @@
#include "abstract_tcp_server2.h"
#include "http_protocol_handler.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
namespace net_utils

View File

@@ -31,12 +31,15 @@
#include "storages/portable_storage.h"
#include "storages/portable_storage_template_helper.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
#define CHAIN_HTTP_TO_MAP2(context_type) bool handle_http_request(const epee::net_utils::http::http_request_info& query_info, \
epee::net_utils::http::http_response_info& response, \
context_type& m_conn_context) \
{\
LOG_PRINT_L2("HTTP [" << epee::string_tools::get_ip_string_from_int32(m_conn_context.m_remote_ip ) << "] " << query_info.m_http_method_str << " " << query_info.m_URI); \
LOG_PRINT_L2("HTTP [" << m_conn_context.m_remote_address.host_str() << "] " << query_info.m_http_method_str << " " << query_info.m_URI); \
response.m_response_code = 200; \
response.m_response_comment = "Ok"; \
if(!handle_http_request_map(query_info, response, m_conn_context)) \
@@ -77,7 +80,7 @@
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
response_info.m_mime_tipe = "application/json"; \
response_info.m_header_info.m_content_type = " application/json"; \
LOG_PRINT( s_pattern << " processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2); \
MDEBUG( s_pattern << " processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms"); \
}
#define MAP_URI_AUTO_JON2(s_pattern, callback_f, command_type) MAP_URI_AUTO_JON2_IF(s_pattern, callback_f, command_type, true)
@@ -104,7 +107,7 @@
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
response_info.m_mime_tipe = " application/octet-stream"; \
response_info.m_header_info.m_content_type = " application/octet-stream"; \
LOG_PRINT( s_pattern << "() processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2); \
MDEBUG( s_pattern << "() processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms"); \
}
#define CHAIN_URI_MAP2(callback) else {callback(query_info, response_info, m_conn_context);handled = true;}
@@ -166,10 +169,10 @@
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
response_info.m_mime_tipe = "application/json"; \
response_info.m_header_info.m_content_type = " application/json"; \
LOG_PRINT( query_info.m_URI << "[" << method_name << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2);
MDEBUG( query_info.m_URI << "[" << method_name << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms");
#define MAP_JON_RPC_WE(method_name, callback_f, command_type) \
else if(callback_name == method_name) \
#define MAP_JON_RPC_WE_IF(method_name, callback_f, command_type, cond) \
else if((callback_name == method_name) && (cond)) \
{ \
PREPARE_OBJECTS_FROM_JSON(command_type) \
epee::json_rpc::error_response fail_resp = AUTO_VAL_INIT(fail_resp); \
@@ -184,6 +187,8 @@
return true;\
}
#define MAP_JON_RPC_WE(method_name, callback_f, command_type) MAP_JON_RPC_WE_IF(method_name, callback_f, command_type, true)
#define MAP_JON_RPC_WERI(method_name, callback_f, command_type) \
else if(callback_name == method_name) \
{ \

View File

@@ -36,6 +36,9 @@
#include "net/http_server_cp2.h"
#include "net/http_server_handlers_map2.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.http"
namespace epee
{
@@ -52,7 +55,8 @@ namespace epee
: m_net_server(external_io_service)
{}
bool init(const std::string& bind_port = "0", const std::string& bind_ip = "0.0.0.0")
bool init(const std::string& bind_port = "0", const std::string& bind_ip = "0.0.0.0",
boost::optional<net_utils::http::login> user = boost::none)
{
//set self as callback handler
@@ -61,7 +65,9 @@ namespace epee
//here set folder for hosting reqests
m_net_server.get_config_object().m_folder = "";
LOG_PRINT_L0("Binding on " << bind_ip << ":" << bind_port);
m_net_server.get_config_object().m_user = std::move(user);
MGINFO("Binding on " << bind_ip << ":" << bind_port);
bool res = m_net_server.init_server(bind_port, bind_ip);
if(!res)
{
@@ -74,15 +80,14 @@ namespace epee
bool run(size_t threads_count, bool wait = true)
{
//go to loop
LOG_PRINT("Run net_service loop( " << threads_count << " threads)...", LOG_LEVEL_0);
_fact_c("net/RPClog", "Run net_service loop( " << threads_count << " threads)...");
MINFO("Run net_service loop( " << threads_count << " threads)...");
if(!m_net_server.run_server(threads_count, wait))
{
LOG_ERROR("Failed to run net tcp server!");
}
if(wait)
LOG_PRINT("net_service loop stopped.", LOG_LEVEL_0);
MINFO("net_service loop stopped.");
return true;
}

View File

@@ -30,6 +30,10 @@
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#include "string_tools.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
namespace levin
@@ -95,7 +99,7 @@ int levin_client_impl::invoke(int command, const std::string& in_buff, std::stri
if(head.m_signature!=LEVIN_SIGNATURE)
{
LOG_PRINT_L1("Signature missmatch in response");
LOG_PRINT_L1("Signature mismatch in response");
return -1;
}
@@ -156,7 +160,7 @@ inline
if(head.m_signature!=LEVIN_SIGNATURE)
{
LOG_PRINT_L1("Signature missmatch in response");
LOG_PRINT_L1("Signature mismatch in response");
return -1;
}

View File

@@ -31,6 +31,9 @@
#include "net_helper.h"
#include "levin_base.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
@@ -405,7 +408,7 @@ namespace levin
if(head.m_signature!=LEVIN_SIGNATURE)
{
LOG_ERROR("Signature missmatch in response");
LOG_ERROR("Signature mismatch in response");
return false;
}
@@ -489,8 +492,7 @@ namespace levin
{
net_utils::connection_context_base conn_context;
conn_context.m_remote_ip = m_ip;
conn_context.m_remote_port = m_port;
conn_context.m_remote_address = m_address;
if(head.m_have_to_return_data)
{
std::string return_buff;

View File

@@ -31,6 +31,9 @@
#include "levin_base.h"
#include "serializeble_struct_helper.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
namespace levin
@@ -91,7 +94,7 @@ namespace levin
}
if(head.m_cb != buff.size()-sizeof(levin::bucket_head))
{
LOG_PRINT_L3("sizes missmatch, at load_struct_from_levin_message");
LOG_PRINT_L3("sizes mismatch, at load_struct_from_levin_message");
return false;
}
@@ -118,7 +121,7 @@ namespace levin
}
if(head.m_cb != buff.size()-sizeof(levin::bucket_head))
{
LOG_ERROR("sizes missmatch, at load_struct_from_levin_message");
LOG_ERROR("sizes mismatch, at load_struct_from_levin_message");
return false;
}

View File

@@ -32,6 +32,9 @@
#include <boost/uuid/uuid_generators.hpp>
#include "levin_base.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
namespace levin
@@ -85,7 +88,7 @@ namespace levin
{
if(!m_config.m_pcommands_handler)
{
LOG_ERROR("Command handler not set!");
LOG_ERROR_CC(m_conn_context, "Command handler not set!");
return false;
}
m_cach_in_buffer.append((const char*)ptr, cb);
@@ -100,7 +103,7 @@ namespace levin
{
if(m_cach_in_buffer.size() >= sizeof(uint64_t) && *((uint64_t*)m_cach_in_buffer.data()) != LEVIN_SIGNATURE)
{
LOG_ERROR("Signature missmatch on accepted connection");
LOG_ERROR_CC(m_conn_context, "Signature mismatch on accepted connection");
return false;
}
is_continue = false;
@@ -110,7 +113,7 @@ namespace levin
bucket_head* phead = (bucket_head*)m_cach_in_buffer.data();
if(LEVIN_SIGNATURE != phead->m_signature)
{
LOG_ERROR("Signature missmatch on accepted connection");
LOG_ERROR_CC(m_conn_context, "Signature mismatch on accepted connection");
return false;
}
m_current_head = *phead;
@@ -154,7 +157,7 @@ namespace levin
m_state = conn_state_reading_head;
break;
default:
LOG_ERROR("Undefined state in levin_server_impl::connection_handler, m_state=" << m_state);
LOG_ERROR_CC(m_conn_context, "Undefined state in levin_server_impl::connection_handler, m_state=" << m_state);
return false;
}
}

View File

@@ -25,6 +25,7 @@
//
#pragma once
#include <boost/asio/deadline_timer.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/unordered_map.hpp>
#include <boost/interprocess/detail/atomic.hpp>
@@ -38,6 +39,12 @@
#include <random>
#include <chrono>
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#ifndef MIN_BYTES_WANTED
#define MIN_BYTES_WANTED 512
#endif
namespace epee
{
@@ -81,6 +88,8 @@ public:
bool request_callback(boost::uuids::uuid connection_id);
template<class callback_t>
bool foreach_connection(callback_t cb);
template<class callback_t>
bool for_connection(const boost::uuids::uuid &connection_id, callback_t cb);
size_t get_connections_count();
async_protocol_handler_config():m_pcommands_handler(NULL), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE)
@@ -136,22 +145,24 @@ public:
virtual bool is_timer_started() const=0;
virtual void cancel()=0;
virtual bool cancel_timer()=0;
virtual void reset_timer()=0;
};
template <class callback_t>
struct anvoke_handler: invoke_response_handler_base
{
anvoke_handler(const callback_t& cb, uint64_t timeout, async_protocol_handler& con, int command)
:m_cb(cb), m_con(con), m_timer(con.m_pservice_endpoint->get_io_service()), m_timer_started(false),
:m_cb(cb), m_timeout(timeout), m_con(con), m_timer(con.m_pservice_endpoint->get_io_service()), m_timer_started(false),
m_cancel_timer_called(false), m_timer_cancelled(false), m_command(command)
{
if(m_con.start_outer_call())
{
MDEBUG(con.get_context_ref() << "anvoke_handler, timeout: " << timeout);
m_timer.expires_from_now(boost::posix_time::milliseconds(timeout));
m_timer.async_wait([&con, command, cb](const boost::system::error_code& ec)
m_timer.async_wait([&con, command, cb, timeout](const boost::system::error_code& ec)
{
if(ec == boost::asio::error::operation_aborted)
return;
LOG_PRINT_CC(con.get_context_ref(), "Timeout on invoke operation happened, command: " << command, LOG_LEVEL_2);
MINFO(con.get_context_ref() << "Timeout on invoke operation happened, command: " << command << " timeout: " << timeout);
std::string fake;
cb(LEVIN_ERROR_CONNECTION_TIMEDOUT, fake, con.get_context_ref());
con.close();
@@ -168,6 +179,7 @@ public:
bool m_timer_started;
bool m_cancel_timer_called;
bool m_timer_cancelled;
uint64_t m_timeout;
int m_command;
virtual bool handle(int res, const std::string& buff, typename async_protocol_handler::connection_context& context)
{
@@ -200,6 +212,28 @@ public:
}
return m_timer_cancelled;
}
virtual void reset_timer()
{
boost::system::error_code ignored_ec;
if (!m_cancel_timer_called && m_timer.cancel(ignored_ec) > 0)
{
callback_t& cb = m_cb;
uint64_t timeout = m_timeout;
async_protocol_handler& con = m_con;
int command = m_command;
m_timer.expires_from_now(boost::posix_time::milliseconds(m_timeout));
m_timer.async_wait([&con, cb, command, timeout](const boost::system::error_code& ec)
{
if(ec == boost::asio::error::operation_aborted)
return;
MINFO(con.get_context_ref() << "Timeout on invoke operation happened, command: " << command << " timeout: " << timeout);
std::string fake;
cb(LEVIN_ERROR_CONNECTION_TIMEDOUT, fake, con.get_context_ref());
con.close();
con.finish_outer_call();
});
}
}
};
critical_section m_invoke_response_handlers_lock;
std::list<boost::shared_ptr<invoke_response_handler_base> > m_invoke_response_handlers;
@@ -244,15 +278,15 @@ public:
}
CHECK_AND_ASSERT_MES_NO_RET(0 == boost::interprocess::ipcdetail::atomic_read32(&m_wait_count), "Failed to wait for operation completion. m_wait_count = " << m_wait_count);
LOG_PRINT_CC(m_connection_context, "~async_protocol_handler()", LOG_LEVEL_4);
MTRACE(m_connection_context << "~async_protocol_handler()");
}
bool start_outer_call()
{
LOG_PRINT_CC_L4(m_connection_context, "[levin_protocol] -->> start_outer_call");
MTRACE(m_connection_context << "[levin_protocol] -->> start_outer_call");
if(!m_pservice_endpoint->add_ref())
{
LOG_PRINT_CC_RED(m_connection_context, "[levin_protocol] -->> start_outer_call failed", LOG_LEVEL_4);
MERROR(m_connection_context << "[levin_protocol] -->> start_outer_call failed");
return false;
}
boost::interprocess::ipcdetail::atomic_inc32(&m_wait_count);
@@ -260,7 +294,7 @@ public:
}
bool finish_outer_call()
{
LOG_PRINT_CC_L4(m_connection_context, "[levin_protocol] <<-- finish_outer_call");
MTRACE(m_connection_context << "[levin_protocol] <<-- finish_outer_call");
boost::interprocess::ipcdetail::atomic_dec32(&m_wait_count);
m_pservice_endpoint->release();
return true;
@@ -316,13 +350,13 @@ public:
if(!m_config.m_pcommands_handler)
{
LOG_ERROR_CC(m_connection_context, "Commands handler not set!");
MERROR(m_connection_context << "Commands handler not set!");
return false;
}
if(m_cache_in_buffer.size() + cb > m_config.m_max_packet_size)
{
LOG_ERROR_CC(m_connection_context, "Maximum packet size exceed!, m_max_packet_size = " << m_config.m_max_packet_size
MWARNING(m_connection_context << "Maximum packet size exceed!, m_max_packet_size = " << m_config.m_max_packet_size
<< ", packet received " << m_cache_in_buffer.size() + cb
<< ", connection will be closed.");
return false;
@@ -339,6 +373,13 @@ public:
if(m_cache_in_buffer.size() < m_current_head.m_cb)
{
is_continue = false;
if(cb >= MIN_BYTES_WANTED && !m_invoke_response_handlers.empty())
{
//async call scenario
boost::shared_ptr<invoke_response_handler_base> response_handler = m_invoke_response_handlers.front();
response_handler->reset_timer();
MDEBUG(m_connection_context << "LEVIN_PACKET partial msg received. len=" << cb);
}
break;
}
{
@@ -353,7 +394,7 @@ public:
bool is_response = (m_oponent_protocol_ver == LEVIN_PROTOCOL_VER_1 && m_current_head.m_flags&LEVIN_PACKET_RESPONSE);
LOG_PRINT_CC_L4(m_connection_context, "LEVIN_PACKET_RECIEVED. [len=" << m_current_head.m_cb
MDEBUG(m_connection_context << "LEVIN_PACKET_RECIEVED. [len=" << m_current_head.m_cb
<< ", flags" << m_current_head.m_flags
<< ", r?=" << m_current_head.m_have_to_return_data
<<", cmd = " << m_current_head.m_command
@@ -373,7 +414,7 @@ public:
invoke_response_handlers_guard.unlock();
if(timer_cancelled)
response_handler->handle(m_current_head.m_command, buff_to_invoke, m_connection_context);
response_handler->handle(m_current_head.m_return_code, buff_to_invoke, m_connection_context);
}
else
{
@@ -381,7 +422,7 @@ public:
//use sync call scenario
if(!boost::interprocess::ipcdetail::atomic_read32(&m_wait_count) && !boost::interprocess::ipcdetail::atomic_read32(&m_close_called))
{
LOG_ERROR_CC(m_connection_context, "no active invoke when response came, wtf?");
MERROR(m_connection_context << "no active invoke when response came, wtf?");
return false;
}else
{
@@ -413,7 +454,7 @@ public:
if(!m_pservice_endpoint->do_send(send_buff.data(), send_buff.size()))
return false;
CRITICAL_REGION_END();
LOG_PRINT_CC_L4(m_connection_context, "LEVIN_PACKET_SENT. [len=" << m_current_head.m_cb
MDEBUG(m_connection_context << "LEVIN_PACKET_SENT. [len=" << m_current_head.m_cb
<< ", flags" << m_current_head.m_flags
<< ", r?=" << m_current_head.m_have_to_return_data
<<", cmd = " << m_current_head.m_command
@@ -431,7 +472,7 @@ public:
{
if(m_cache_in_buffer.size() >= sizeof(uint64_t) && *((uint64_t*)m_cache_in_buffer.data()) != LEVIN_SIGNATURE)
{
LOG_ERROR_CC(m_connection_context, "Signature mismatch, connection will be closed");
MWARNING(m_connection_context << "Signature mismatch, connection will be closed");
return false;
}
is_continue = false;
@@ -585,19 +626,25 @@ public:
}
CRITICAL_REGION_END();
LOG_PRINT_CC_L4(m_connection_context, "LEVIN_PACKET_SENT. [len=" << head.m_cb
MDEBUG(m_connection_context << "LEVIN_PACKET_SENT. [len=" << head.m_cb
<< ", f=" << head.m_flags
<< ", r?=" << head.m_have_to_return_data
<< ", cmd = " << head.m_command
<< ", ver=" << head.m_protocol_version);
uint64_t ticks_start = misc_utils::get_tick_count();
size_t prev_size = 0;
while(!boost::interprocess::ipcdetail::atomic_read32(&m_invoke_buf_ready) && !m_deletion_initiated && !m_protocol_released)
{
if(m_cache_in_buffer.size() - prev_size >= MIN_BYTES_WANTED)
{
prev_size = m_cache_in_buffer.size();
ticks_start = misc_utils::get_tick_count();
}
if(misc_utils::get_tick_count() - ticks_start > m_config.m_invoke_timeout)
{
LOG_PRINT_CC_L2(m_connection_context, "invoke timeout (" << m_config.m_invoke_timeout << "), closing connection ");
MWARNING(m_connection_context << "invoke timeout (" << m_config.m_invoke_timeout << "), closing connection ");
close();
return LEVIN_ERROR_CONNECTION_TIMEDOUT;
}
@@ -650,7 +697,7 @@ public:
return -1;
}
CRITICAL_REGION_END();
LOG_PRINT_CC_L4(m_connection_context, "LEVIN_PACKET_SENT. [len=" << head.m_cb <<
LOG_DEBUG_CC(m_connection_context, "LEVIN_PACKET_SENT. [len=" << head.m_cb <<
", f=" << head.m_flags <<
", r?=" << head.m_have_to_return_data <<
", cmd = " << head.m_command <<
@@ -759,6 +806,18 @@ bool async_protocol_handler_config<t_connection_context>::foreach_connection(cal
return true;
}
//------------------------------------------------------------------------------------------
template<class t_connection_context> template<class callback_t>
bool async_protocol_handler_config<t_connection_context>::for_connection(const boost::uuids::uuid &connection_id, callback_t cb)
{
CRITICAL_REGION_LOCAL(m_connects_lock);
async_protocol_handler<t_connection_context>* aph = find_connection(connection_id);
if (!aph)
return false;
if(!cb(aph->get_context_ref()))
return false;
return true;
}
//------------------------------------------------------------------------------------------
template<class t_connection_context>
size_t async_protocol_handler_config<t_connection_context>::get_connections_count()
{

View File

@@ -173,7 +173,7 @@ namespace net_utils
stop_handling = true;
return false;
default:
LOG_ERROR("Error in munin state machine! Unkonwon state=" << m_machine_state);
LOG_ERROR("Error in munin state machine! Unknown state=" << m_machine_state);
stop_handling = true;
m_machine_state = http_state_error;
return false;

View File

@@ -37,6 +37,7 @@
#include <ostream>
#include <string>
#include <boost/asio.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/preprocessor/selection/min.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/lambda/lambda.hpp>
@@ -46,6 +47,9 @@
//#include "profile_tools.h"
#include "../string_tools.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#ifndef MAKE_IP
#define MAKE_IP( a1, a2, a3, a4 ) (a1|(a2<<8)|(a3<<16)|(a4<<24))
#endif
@@ -95,7 +99,7 @@ namespace net_utils
// No deadline is required until the first socket operation is started. We
// set the deadline to positive infinity so that the actor takes no action
// until a specific deadline is set.
m_deadline.expires_at(boost::posix_time::pos_infin);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
// Start the persistent actor that checks for deadline expiry.
check_deadline();
@@ -108,26 +112,16 @@ namespace net_utils
shutdown();
}
inline void set_recv_timeout(int reciev_timeout)
{
m_reciev_timeout = reciev_timeout;
}
inline
bool connect(const std::string& addr, int port, unsigned int connect_timeout, unsigned int reciev_timeout, const std::string& bind_ip = "0.0.0.0")
bool connect(const std::string& addr, int port, std::chrono::milliseconds timeout, const std::string& bind_ip = "0.0.0.0")
{
return connect(addr, std::to_string(port), connect_timeout, reciev_timeout, bind_ip);
return connect(addr, std::to_string(port), timeout, bind_ip);
}
inline
bool connect(const std::string& addr, const std::string& port, unsigned int connect_timeout, unsigned int reciev_timeout, const std::string& bind_ip = "0.0.0.0")
bool connect(const std::string& addr, const std::string& port, std::chrono::milliseconds timeout, const std::string& bind_ip = "0.0.0.0")
{
m_connect_timeout = connect_timeout;
m_reciev_timeout = reciev_timeout;
m_connected = false;
if(!m_reciev_timeout)
m_reciev_timeout = m_connect_timeout;
try
{
m_socket.close();
@@ -137,7 +131,7 @@ namespace net_utils
//////////////////////////////////////////////////////////////////////////
boost::asio::ip::tcp::resolver resolver(m_io_service);
boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), addr, port);
boost::asio::ip::tcp::resolver::query query(boost::asio::ip::tcp::v4(), addr, port, boost::asio::ip::tcp::resolver::query::canonical_name);
boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query);
boost::asio::ip::tcp::resolver::iterator end;
if(iterator == end)
@@ -161,7 +155,7 @@ namespace net_utils
}
m_deadline.expires_from_now(boost::posix_time::milliseconds(m_connect_timeout));
m_deadline.expires_from_now(timeout);
boost::system::error_code ec = boost::asio::error::would_block;
@@ -176,23 +170,23 @@ namespace net_utils
if (!ec && m_socket.is_open())
{
m_connected = true;
m_deadline.expires_at(boost::posix_time::pos_infin);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
return true;
}else
{
LOG_PRINT("Some problems at connect, message: " << ec.message(), LOG_LEVEL_3);
MWARNING("Some problems at connect, message: " << ec.message());
return false;
}
}
catch(const boost::system::system_error& er)
{
LOG_PRINT("Some problems at connect, message: " << er.what(), LOG_LEVEL_4);
MDEBUG("Some problems at connect, message: " << er.what());
return false;
}
catch(...)
{
LOG_PRINT("Some fatal problems.", LOG_LEVEL_4);
MDEBUG("Some fatal problems.");
return false;
}
@@ -228,12 +222,12 @@ namespace net_utils
inline
bool send(const std::string& buff)
bool send(const std::string& buff, std::chrono::milliseconds timeout)
{
try
{
m_deadline.expires_from_now(boost::posix_time::milliseconds(m_reciev_timeout));
m_deadline.expires_from_now(timeout);
// Set up the variable that receives the result of the asynchronous
// operation. The error code is set to would_block to signal that the
@@ -261,7 +255,7 @@ namespace net_utils
return false;
}else
{
m_deadline.expires_at(boost::posix_time::pos_infin);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
}
}
@@ -319,7 +313,7 @@ namespace net_utils
return false;
}else
{
m_deadline.expires_at(boost::posix_time::pos_infin);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
}
}
@@ -347,7 +341,7 @@ namespace net_utils
}
inline
bool recv(std::string& buff)
bool recv(std::string& buff, std::chrono::milliseconds timeout)
{
try
@@ -355,7 +349,7 @@ namespace net_utils
// Set a deadline for the asynchronous operation. Since this function uses
// a composed operation (async_read_until), the deadline applies to the
// entire operation, rather than individual reads from the socket.
m_deadline.expires_from_now(boost::posix_time::milliseconds(m_reciev_timeout));
m_deadline.expires_from_now(timeout);
// Set up the variable that receives the result of the asynchronous
// operation. The error code is set to would_block to signal that the
@@ -387,21 +381,21 @@ namespace net_utils
if (ec)
{
LOG_PRINT_L4("READ ENDS: Connection err_code " << ec.value());
MTRACE("READ ENDS: Connection err_code " << ec.value());
if(ec == boost::asio::error::eof)
{
LOG_PRINT_L4("Connection err_code eof.");
MTRACE("Connection err_code eof.");
//connection closed there, empty
return true;
}
LOG_PRINT_L3("Problems at read: " << ec.message());
MDEBUG("Problems at read: " << ec.message());
m_connected = false;
return false;
}else
{
LOG_PRINT_L4("READ ENDS: Success. bytes_tr: " << bytes_transfered);
m_deadline.expires_at(boost::posix_time::pos_infin);
MTRACE("READ ENDS: Success. bytes_tr: " << bytes_transfered);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
}
/*if(!bytes_transfered)
@@ -429,7 +423,7 @@ namespace net_utils
}
inline bool recv_n(std::string& buff, int64_t sz)
inline bool recv_n(std::string& buff, int64_t sz, std::chrono::milliseconds timeout)
{
try
@@ -437,7 +431,7 @@ namespace net_utils
// Set a deadline for the asynchronous operation. Since this function uses
// a composed operation (async_read_until), the deadline applies to the
// entire operation, rather than individual reads from the socket.
m_deadline.expires_from_now(boost::posix_time::milliseconds(m_reciev_timeout));
m_deadline.expires_from_now(timeout);
// Set up the variable that receives the result of the asynchronous
// operation. The error code is set to would_block to signal that the
@@ -474,12 +468,12 @@ namespace net_utils
return false;
}else
{
m_deadline.expires_at(boost::posix_time::pos_infin);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
}
if(bytes_transfered != buff.size())
{
LOG_ERROR("Transferred missmatch with transfer_at_least value: m_bytes_transferred=" << bytes_transfered << " at_least value=" << buff.size());
LOG_ERROR("Transferred mismatch with transfer_at_least value: m_bytes_transferred=" << bytes_transfered << " at_least value=" << buff.size());
return false;
}
@@ -536,7 +530,7 @@ namespace net_utils
// Check whether the deadline has passed. We compare the deadline against
// the current time since a new asynchronous operation may have moved the
// deadline before this actor had a chance to run.
if (m_deadline.expires_at() <= boost::asio::deadline_timer::traits_type::now())
if (m_deadline.expires_at() <= std::chrono::steady_clock::now())
{
// The deadline has passed. The socket is closed so that any outstanding
// asynchronous operations are cancelled. This allows the blocked
@@ -547,7 +541,7 @@ namespace net_utils
// There is no longer an active deadline. The expiry is set to positive
// infinity so that the actor takes no action until a new deadline is set.
m_deadline.expires_at(boost::posix_time::pos_infin);
m_deadline.expires_at(std::chrono::steady_clock::time_point::max());
}
// Put the actor back to sleep.
@@ -559,11 +553,9 @@ namespace net_utils
protected:
boost::asio::io_service m_io_service;
boost::asio::ip::tcp::socket m_socket;
int m_connect_timeout;
int m_reciev_timeout;
bool m_initialized;
bool m_connected;
boost::asio::deadline_timer m_deadline;
boost::asio::steady_timer m_deadline;
volatile uint32_t m_shutdowned;
};

View File

@@ -31,6 +31,8 @@
#include "http_base.h"
#include "reg_exp_definer.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{

View File

@@ -29,8 +29,16 @@
#ifndef _NET_UTILS_BASE_H_
#define _NET_UTILS_BASE_H_
#include <typeinfo>
#include <boost/asio/io_service.hpp>
#include <boost/uuid/uuid.hpp>
#include "serialization/keyvalue_serialization.h"
#include "net/local_ip.h"
#include "string_tools.h"
#include "misc_log_ex.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
#ifndef MAKE_IP
#define MAKE_IP( a1, a2, a3, a4 ) (a1|(a2<<8)|(a3<<16)|(a4<<24))
@@ -41,14 +49,110 @@ namespace epee
{
namespace net_utils
{
struct network_address_base
{
public:
bool operator==(const network_address_base &other) const { return m_full_id == other.m_full_id; }
bool operator!=(const network_address_base &other) const { return !operator==(other); }
bool operator<(const network_address_base &other) const { return m_full_id < other.m_full_id; }
bool is_same_host(const network_address_base &other) const { return m_host_id == other.m_host_id; }
virtual std::string str() const = 0;
virtual std::string host_str() const = 0;
virtual bool is_loopback() const = 0;
virtual bool is_local() const = 0;
virtual uint8_t get_type_id() const = 0;
protected:
// A very simple non cryptographic hash function by Fowler, Noll, Vo
uint64_t fnv1a(const uint8_t *data, size_t len) const {
uint64_t h = 0xcbf29ce484222325;
while (len--)
h = (h ^ *data++) * 0x100000001b3;
return h;
}
uint64_t m_host_id;
uint64_t m_full_id;
};
struct ipv4_network_address: public network_address_base
{
void init_ids()
{
m_host_id = fnv1a((const uint8_t*)&m_ip, sizeof(m_ip));
m_full_id = fnv1a((const uint8_t*)&m_ip, sizeof(m_ip) + sizeof(m_port));
}
public:
ipv4_network_address(uint32_t ip, uint16_t port): network_address_base(), m_ip(ip), m_port(port) { init_ids(); }
uint32_t ip() const { return m_ip; }
uint16_t port() const { return m_port; }
virtual std::string str() const { return epee::string_tools::get_ip_string_from_int32(m_ip) + ":" + std::to_string(m_port); }
virtual std::string host_str() const { return epee::string_tools::get_ip_string_from_int32(m_ip); }
virtual bool is_loopback() const { return epee::net_utils::is_ip_loopback(m_ip); }
virtual bool is_local() const { return epee::net_utils::is_ip_local(m_ip); }
virtual uint8_t get_type_id() const { return ID; }
public: // serialization
static const uint8_t ID = 1;
#pragma pack(push)
#pragma pack(1)
uint32_t m_ip;
uint16_t m_port;
#pragma pack(pop)
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(m_ip)
KV_SERIALIZE(m_port)
if (!is_store)
const_cast<ipv4_network_address&>(this_ref).init_ids();
END_KV_SERIALIZE_MAP()
};
class network_address: public boost::shared_ptr<network_address_base>
{
public:
network_address() {}
network_address(ipv4_network_address *address): boost::shared_ptr<network_address_base>(address) {}
bool operator==(const network_address &other) const { return (*this)->operator==(*other); }
bool operator!=(const network_address &other) const { return (*this)->operator!=(*other); }
bool operator<(const network_address &other) const { return (*this)->operator<(*other); }
bool is_same_host(const network_address &other) const { return (*this)->is_same_host(*other); }
std::string str() const { return (*this) ? (*this)->str() : "<none>"; }
std::string host_str() const { return (*this) ? (*this)->host_str() : "<none>"; }
bool is_loopback() const { return (*this)->is_loopback(); }
bool is_local() const { return (*this)->is_local(); }
uint8_t get_type_id() const { return (*this)->get_type_id(); }
template<typename Type> Type &as() { if (get_type_id() != Type::ID) throw std::runtime_error("Bad type"); return *(Type*)get(); }
template<typename Type> const Type &as() const { if (get_type_id() != Type::ID) throw std::runtime_error("Bad type"); return *(const Type*)get(); }
BEGIN_KV_SERIALIZE_MAP()
uint8_t type = is_store ? this_ref.get_type_id() : 0;
epee::serialization::selector<is_store>::serialize(type, stg, hparent_section, "type");
switch (type)
{
case ipv4_network_address::ID:
if (!is_store)
const_cast<network_address&>(this_ref).reset(new ipv4_network_address(0, 0));
KV_SERIALIZE(template as<ipv4_network_address>());
break;
default: MERROR("Unsupported network address type: " << type); return false;
}
END_KV_SERIALIZE_MAP()
};
inline bool create_network_address(network_address &address, const std::string &string, uint16_t default_port = 0)
{
uint32_t ip;
uint16_t port;
if (epee::string_tools::parse_peer_from_string(ip, port, string))
{
if (default_port && !port)
port = default_port;
address.reset(new ipv4_network_address(ip, port));
return true;
}
return false;
}
/************************************************************************/
/* */
/************************************************************************/
struct connection_context_base
{
const boost::uuids::uuid m_connection_id;
const uint32_t m_remote_ip;
const uint32_t m_remote_port;
const network_address m_remote_address;
const bool m_is_income;
const time_t m_started;
time_t m_last_recv;
@@ -59,12 +163,11 @@ namespace net_utils
double m_current_speed_up;
connection_context_base(boost::uuids::uuid connection_id,
long remote_ip, int remote_port, bool is_income,
const network_address &remote_address, bool is_income,
time_t last_recv = 0, time_t last_send = 0,
uint64_t recv_cnt = 0, uint64_t send_cnt = 0):
m_connection_id(connection_id),
m_remote_ip(remote_ip),
m_remote_port(remote_port),
m_remote_address(remote_address),
m_is_income(is_income),
m_started(time(NULL)),
m_last_recv(last_recv),
@@ -76,8 +179,7 @@ namespace net_utils
{}
connection_context_base(): m_connection_id(),
m_remote_ip(0),
m_remote_port(0),
m_remote_address(new ipv4_network_address(0,0)),
m_is_income(false),
m_started(time(NULL)),
m_last_recv(0),
@@ -90,17 +192,17 @@ namespace net_utils
connection_context_base& operator=(const connection_context_base& a)
{
set_details(a.m_connection_id, a.m_remote_ip, a.m_remote_port, a.m_is_income);
set_details(a.m_connection_id, a.m_remote_address, a.m_is_income);
return *this;
}
private:
template<class t_protocol_handler>
friend class connection;
void set_details(boost::uuids::uuid connection_id, long remote_ip, int remote_port, bool is_income)
void set_details(boost::uuids::uuid connection_id, const network_address &remote_address, bool is_income)
{
this->~connection_context_base();
new(this) connection_context_base(connection_id, remote_ip, remote_port, is_income);
new(this) connection_context_base(connection_id, remote_address, is_income);
}
};
@@ -119,7 +221,7 @@ namespace net_utils
virtual bool add_ref()=0;
virtual bool release()=0;
protected:
virtual ~i_service_endpoint(){}
virtual ~i_service_endpoint() noexcept(false) {}
};
@@ -130,7 +232,7 @@ namespace net_utils
std::string print_connection_context(const connection_context_base& ctx)
{
std::stringstream ss;
ss << epee::string_tools::get_ip_string_from_int32(ctx.m_remote_ip) << ":" << ctx.m_remote_port << " " << epee::string_tools::get_str_from_guid_a(ctx.m_connection_id) << (ctx.m_is_income ? " INC":" OUT");
ss << ctx.m_remote_address->str() << " " << epee::string_tools::get_str_from_guid_a(ctx.m_connection_id) << (ctx.m_is_income ? " INC":" OUT");
return ss.str();
}
@@ -138,24 +240,28 @@ namespace net_utils
std::string print_connection_context_short(const connection_context_base& ctx)
{
std::stringstream ss;
ss << epee::string_tools::get_ip_string_from_int32(ctx.m_remote_ip) << ":" << ctx.m_remote_port << (ctx.m_is_income ? " INC":" OUT");
ss << ctx.m_remote_address->str() << (ctx.m_is_income ? " INC":" OUT");
return ss.str();
}
#define LOG_PRINT_CC(ct, message, log_level) LOG_PRINT("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_PRINT_CC_GREEN(ct, message, log_level) LOG_PRINT_GREEN("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_PRINT_CC_RED(ct, message, log_level) LOG_PRINT_RED("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_PRINT_CC_BLUE(ct, message, log_level) LOG_PRINT_BLUE("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_PRINT_CC_YELLOW(ct, message, log_level) LOG_PRINT_YELLOW("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_PRINT_CC_CYAN(ct, message, log_level) LOG_PRINT_CYAN("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_PRINT_CC_MAGENTA(ct, message, log_level) LOG_PRINT_MAGENTA("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, log_level)
#define LOG_ERROR_CC(ct, message) LOG_PRINT_RED("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message, LOG_LEVEL_2)
inline MAKE_LOGGABLE(connection_context_base, ct, os)
{
os << "[" << epee::net_utils::print_connection_context_short(ct) << "] ";
return os;
}
#define LOG_PRINT_CC_L0(ct, message) LOG_PRINT_L0("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
#define LOG_PRINT_CC_L1(ct, message) LOG_PRINT_L1("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
#define LOG_PRINT_CC_L2(ct, message) LOG_PRINT_L2("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
#define LOG_PRINT_CC_L3(ct, message) LOG_PRINT_L3("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
#define LOG_PRINT_CC_L4(ct, message) LOG_PRINT_L4("[" << epee::net_utils::print_connection_context_short(ct) << "]" << message)
#define LOG_ERROR_CC(ct, message) MERROR(ct << message)
#define LOG_WARNING_CC(ct, message) MWARNING(ct << message)
#define LOG_INFO_CC(ct, message) MINFO(ct << message)
#define LOG_DEBUG_CC(ct, message) MDEBUG(ct << message)
#define LOG_TRACE_CC(ct, message) MTRACE(ct << message)
#define LOG_CC(level, ct, message) MLOG(level, ct << message)
#define LOG_PRINT_CC_L0(ct, message) LOG_PRINT_L0(ct << message)
#define LOG_PRINT_CC_L1(ct, message) LOG_PRINT_L1(ct << message)
#define LOG_PRINT_CC_L2(ct, message) LOG_PRINT_L2(ct << message)
#define LOG_PRINT_CC_L3(ct, message) LOG_PRINT_L3(ct << message)
#define LOG_PRINT_CC_L4(ct, message) LOG_PRINT_L4(ct << message)
#define LOG_PRINT_CCONTEXT_L0(message) LOG_PRINT_CC_L0(context, message)
#define LOG_PRINT_CCONTEXT_L1(message) LOG_PRINT_CC_L1(context, message)
@@ -163,13 +269,6 @@ namespace net_utils
#define LOG_PRINT_CCONTEXT_L3(message) LOG_PRINT_CC_L3(context, message)
#define LOG_ERROR_CCONTEXT(message) LOG_ERROR_CC(context, message)
#define LOG_PRINT_CCONTEXT_GREEN(message, log_level) LOG_PRINT_CC_GREEN(context, message, log_level)
#define LOG_PRINT_CCONTEXT_RED(message, log_level) LOG_PRINT_CC_RED(context, message, log_level)
#define LOG_PRINT_CCONTEXT_BLUE(message, log_level) LOG_PRINT_CC_BLUE(context, message, log_level)
#define LOG_PRINT_CCONTEXT_YELLOW(message, log_level) LOG_PRINT_CC_YELLOW(context, message, log_level)
#define LOG_PRINT_CCONTEXT_CYAN(message, log_level) LOG_PRINT_CC_CYAN(context, message, log_level)
#define LOG_PRINT_CCONTEXT_MAGENTA(message, log_level) LOG_PRINT_CC_MAGENTA(context, message, log_level)
#define CHECK_AND_ASSERT_MES_CC(condition, return_val, err_message) CHECK_AND_ASSERT_MES(condition, return_val, "[" << epee::net_utils::print_connection_context_short(context) << "]" << err_message)
}

View File

@@ -52,13 +52,20 @@ namespace epee
#endif
#define START_WAY_POINTS() uint64_t _____way_point_time = epee::misc_utils::get_tick_count();
#define WAY_POINT(name) {uint64_t delta = epee::misc_utils::get_tick_count()-_____way_point_time; LOG_PRINT("Way point " << name << ": " << delta, LOG_LEVEL_2);_____way_point_time = misc_utils::get_tick_count();}
#define WAY_POINT2(name, avrg_obj) {uint64_t delta = epee::misc_utils::get_tick_count()-_____way_point_time; avrg_obj.push(delta); LOG_PRINT("Way point " << name << ": " << delta, LOG_LEVEL_2);_____way_point_time = misc_utils::get_tick_count();}
#define WAY_POINT(name) {uint64_t delta = epee::misc_utils::get_tick_count()-_____way_point_time; MDEBUG("Way point " << name << ": " << delta);_____way_point_time = misc_utils::get_tick_count();}
#define WAY_POINT2(name, avrg_obj) {uint64_t delta = epee::misc_utils::get_tick_count()-_____way_point_time; avrg_obj.push(delta); MDEBUG("Way point " << name << ": " << delta);_____way_point_time = misc_utils::get_tick_count();}
#define TIME_MEASURE_START(var_name) uint64_t var_name = epee::misc_utils::get_tick_count();
#define TIME_MEASURE_PAUSE(var_name) var_name = epee::misc_utils::get_tick_count() - var_name;
#define TIME_MEASURE_RESTART(var_name) var_name = epee::misc_utils::get_tick_count() - var_name;
#define TIME_MEASURE_FINISH(var_name) var_name = epee::misc_utils::get_tick_count() - var_name;
#define TIME_MEASURE_NS_START(var_name) uint64_t var_name = epee::misc_utils::get_ns_count();
#define TIME_MEASURE_NS_PAUSE(var_name) var_name = epee::misc_utils::get_ns_count() - var_name;
#define TIME_MEASURE_NS_RESTART(var_name) var_name = epee::misc_utils::get_ns_count() - var_name;
#define TIME_MEASURE_NS_FINISH(var_name) var_name = epee::misc_utils::get_ns_count() - var_name;
namespace profile_tools
{
struct local_call_account
@@ -67,7 +74,7 @@ namespace profile_tools
{}
~local_call_account()
{
LOG_PRINT2("profile_details.log", "PROFILE "<<m_pname<<":av_time:\t" << (m_count_of_call ? (m_summary_time_used/m_count_of_call):0) <<" sum_time:\t"<<m_summary_time_used<<" call_count:\t" << m_count_of_call, LOG_LEVEL_0);
MINFO("PROFILE "<<m_pname<<":av_time:\t" << (m_count_of_call ? (m_summary_time_used/m_count_of_call):0) <<" sum_time:\t"<<m_summary_time_used<<" call_count:\t" << m_count_of_call);
}
size_t m_count_of_call;

View File

@@ -0,0 +1,45 @@
#pragma once
#include <streambuf>
#include <sstream>
#include <iostream>
#include <vector>
#include <algorithm>
namespace rdln
{
typedef enum { empty, partial, full } linestatus;
class readline_buffer : public std::stringbuf
{
public:
readline_buffer();
void start();
void stop();
bool is_running() const
{
return m_cout_buf != NULL;
}
linestatus get_line(std::string& line) const;
void set_prompt(const std::string& prompt);
static void add_completion(const std::string& command);
static const std::vector<std::string>& get_completions();
protected:
virtual int sync();
private:
std::streambuf* m_cout_buf;
static std::vector<std::string>& completion_commands();
};
class suspend_readline
{
public:
suspend_readline();
~suspend_readline();
private:
readline_buffer* m_buffer;
bool m_restart;
};
}

View File

@@ -70,6 +70,15 @@ public: \
#define KV_SERIALIZE_N(varialble, val_name) \
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name);
template<typename T> inline void serialize_default(const T &t, T v) { }
template<typename T> inline void serialize_default(T &t, T v) { t = v; }
#define KV_SERIALIZE_OPT_N(variable, val_name, default_value) \
do { \
if (!epee::serialization::selector<is_store>::serialize(this_ref.variable, stg, hparent_section, val_name)) \
epee::serialize_default(this_ref.variable, default_value); \
} while (0);
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, val_name) \
epee::serialization::selector<is_store>::serialize_t_val_as_blob(this_ref.varialble, stg, hparent_section, val_name);
@@ -86,6 +95,7 @@ public: \
#define KV_SERIALIZE_VAL_POD_AS_BLOB(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_N(varialble, #varialble)
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, #varialble) //skip is_pod compile time check
#define KV_SERIALIZE_CONTAINER_POD_AS_BLOB(varialble) KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, #varialble)
#define KV_SERIALIZE_OPT(variable,default_value) KV_SERIALIZE_OPT_N(variable, #variable, default_value)
}

View File

@@ -126,7 +126,6 @@ namespace epee
static bool serialize_stl_container_pod_val_as_blob(const stl_container& container, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
{
if(!container.size()) return true;
typename stl_container::const_iterator it = container.begin();
std::string mb;
mb.resize(sizeof(typename stl_container::value_type)*container.size());
typename stl_container::value_type* p_elem = (typename stl_container::value_type*)mb.data();

130
contrib/epee/include/span.h Normal file
View File

@@ -0,0 +1,130 @@
// Copyright (c) 2017, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include <cstdint>
#include <memory>
#include <type_traits>
namespace epee
{
/*!
\brief Non-owning sequence of data. Does not deep copy
Inspired by `gsl::span` and/or `boost::iterator_range`. This class is
intended to be used as a parameter type for functions that need to take a
writable or read-only sequence of data. Most common cases are `span<char>`
and `span<std::uint8_t>`. Using as a class member is only recommended if
clearly documented as not doing a deep-copy. C-arrays are easily convertible
to this type.
\note Conversion from C string literal to `span<const char>` will include
the NULL-terminator.
\note Never allows derived-to-base pointer conversion; an array of derived
types is not an array of base types.
*/
template<typename T>
class span
{
/* Supporting class types is tricky - the {ptr,len} constructor will allow
derived-to-base conversions. This is NOT desireable because an array of
derived types is not an array of base types. It is possible to handle
this case, implement when/if needed. */
static_assert(!std::is_class<T>(), "no class types are currently allowed");
public:
using value_type = T;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using pointer = T*;
using const_pointer = const T*;
using reference = T&;
using const_reference = const T&;
using iterator = pointer;
using const_iterator = const_pointer;
constexpr span() noexcept : ptr(nullptr), len(0) {}
constexpr span(std::nullptr_t) noexcept : span() {}
constexpr span(T* const src_ptr, const std::size_t count) noexcept
: ptr(src_ptr), len(count) {}
//! Conversion from C-array. Prevents common bugs with sizeof + arrays.
template<std::size_t N>
constexpr span(T (&src)[N]) noexcept : span(src, N) {}
constexpr span(const span&) noexcept = default;
span& operator=(const span&) noexcept = default;
constexpr iterator begin() const noexcept { return ptr; }
constexpr const_iterator cbegin() const noexcept { return ptr; }
constexpr iterator end() const noexcept { return begin() + size(); }
constexpr const_iterator cend() const noexcept { return cbegin() + size(); }
constexpr bool empty() const noexcept { return size() == 0; }
constexpr pointer data() const noexcept { return ptr; }
constexpr std::size_t size() const noexcept { return len; }
constexpr std::size_t size_bytes() const noexcept { return size() * sizeof(value_type); }
private:
T* ptr;
std::size_t len;
};
//! \return `span<const T::value_type>` from a STL compatible `src`.
template<typename T>
constexpr span<const typename T::value_type> to_span(const T& src)
{
// compiler provides diagnostic if size() is not size_t.
return {src.data(), src.size()};
}
template<typename T>
constexpr bool has_padding() noexcept
{
return !std::is_pod<T>() || alignof(T) != 1;
}
//! \return Cast data from `src` as `span<const std::uint8_t>`.
template<typename T>
span<const std::uint8_t> to_byte_span(const span<const T> src) noexcept
{
static_assert(!has_padding<T>(), "source type may have padding");
return {reinterpret_cast<const std::uint8_t*>(src.data()), src.size_bytes()};
}
//! \return `span<const std::uint8_t>` which represents the bytes at `&src`.
template<typename T>
span<const std::uint8_t> as_byte_span(const T& src) noexcept
{
static_assert(!std::is_empty<T>(), "empty types will not work -> sizeof == 1");
static_assert(!has_padding<T>(), "source type may have padding");
return {reinterpret_cast<const std::uint8_t*>(std::addressof(src)), sizeof(T)};
}
}

View File

@@ -1,132 +0,0 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Andrey N. Sabelnikov nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#pragma once
#include "inmemtoxml.h"
//#include "levin/levin_server.h"
namespace epee
{
class activity_printer_base
{
public:
activity_printer_base(){}
virtual ~activity_printer_base(){}
};
template<class A>
class notify_activity_printer: public activity_printer_base
{
public:
notify_activity_printer(int level, A& arg, bool is_notify_mode = true):m_ref_arg(arg), m_level(level), m_is_notify_mode(is_notify_mode)
{
m_command_name = typeid(m_ref_arg).name();
m_command_name.erase(0, 7);
m_command_name.erase(m_command_name.size()-10, m_command_name.size()-1);
if(level == log_space::get_set_log_detalisation_level())
{
LOG_PRINT(m_command_name, level);
}
else if(level+1 == log_space::get_set_log_detalisation_level())
{
LOG_PRINT(" -->>" << m_command_name, level);
}
else if(level+2 == log_space::get_set_log_detalisation_level())
{
LOG_PRINT(" -->>" << m_command_name << "\n" << StorageNamed::xml::get_t_as_xml(m_ref_arg), level);
}
}
virtual ~notify_activity_printer()
{
if(m_is_notify_mode)
{
if(m_level+1 == log_space::get_set_log_detalisation_level())
{
LOG_PRINT(" <<--" << m_command_name, m_level);
}
}
}
protected:
std::string m_command_name;
A& m_ref_arg;
int m_level;
bool m_is_notify_mode;
};
template<class A, class R>
class command_activity_printer: public notify_activity_printer<A>
{
public:
command_activity_printer(int level, A& arg, R& rsp):notify_activity_printer(level, arg, false), m_ref_rsp(rsp)
{
}
virtual ~command_activity_printer()
{
if(m_level+1 == log_space::get_set_log_detalisation_level())
{
LOG_PRINT(" <<--" << m_command_name, m_level);
}
else if(m_level+2 == log_space::get_set_log_detalisation_level())
{
LOG_PRINT(" <<--" << m_command_name << "\n" << StorageNamed::trace_as_xml(m_ref_rsp), m_level);
}
}
private:
R& m_ref_rsp;
};
template<class A, class R>
activity_printer_base* create_activity_printer(int level, A& arg, R& rsp)
{
return new command_activity_printer<A, R>(level, arg, rsp);
}
template<class A>
activity_printer_base* create_activity_printer(int level, A& arg)
{
return new notify_activity_printer<A>(level, arg);
}
}
#define PRINT_COMMAND_ACTIVITY(level) boost::shared_ptr<activity_printer_base> local_activity_printer(create_activity_printer(level, in_struct, out_struct));
#define PRINT_NOTIFY_ACTIVITY(level) boost::shared_ptr<activity_printer_base> local_activity_printer(create_activity_printer(level, in_struct));
#define PRINT_ACTIVITY(level) \
{std::string some_str = typeid(in_struct).name(); \
some_str.erase(0, 7); \
some_str.erase(some_str.size()-10, some_str.size()-1); \
LOG_PRINT(some_str, level);}
}

View File

@@ -26,6 +26,9 @@
//
#pragma once
#include <boost/utility/string_ref.hpp>
#include <chrono>
#include <string>
#include "portable_storage_template_helper.h"
#include "net/http_base.h"
#include "net/http_server_handlers_map2.h"
@@ -35,28 +38,28 @@ namespace epee
namespace net_utils
{
template<class t_request, class t_response, class t_transport>
bool invoke_http_json_remote_command2(const std::string& url, t_request& out_struct, t_response& result_struct, t_transport& transport, unsigned int timeout = 5000, const std::string& method = "GET")
bool invoke_http_json(const boost::string_ref uri, const t_request& out_struct, t_response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref method = "GET")
{
std::string req_param;
if(!serialization::store_t_to_json(out_struct, req_param))
return false;
const http::http_response_info* pri = NULL;
if(!invoke_request(url, transport, timeout, &pri, method, req_param))
if(!transport.invoke(uri, method, req_param, timeout, std::addressof(pri)))
{
LOG_PRINT_L1("Failed to invoke http request to " << url);
LOG_PRINT_L1("Failed to invoke http request to " << uri);
return false;
}
if(!pri->m_response_code)
if(!pri)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", internal error (null response ptr)");
LOG_PRINT_L1("Failed to invoke http request to " << uri << ", internal error (null response ptr)");
return false;
}
if(pri->m_response_code != 200)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", wrong response code: " << pri->m_response_code);
LOG_PRINT_L1("Failed to invoke http request to " << uri << ", wrong response code: " << pri->m_response_code);
return false;
}
@@ -66,28 +69,28 @@ namespace epee
template<class t_request, class t_response, class t_transport>
bool invoke_http_bin_remote_command2(const std::string& url, t_request& out_struct, t_response& result_struct, t_transport& transport, unsigned int timeout = 5000, const std::string& method = "GET")
bool invoke_http_bin(const boost::string_ref uri, const t_request& out_struct, t_response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref method = "GET")
{
std::string req_param;
if(!serialization::store_t_to_binary(out_struct, req_param))
return false;
const http::http_response_info* pri = NULL;
if(!invoke_request(url, transport, timeout, &pri, method, req_param))
if(!transport.invoke(uri, method, req_param, timeout, std::addressof(pri)))
{
LOG_PRINT_L1("Failed to invoke http request to " << url);
LOG_PRINT_L1("Failed to invoke http request to " << uri);
return false;
}
if(!pri->m_response_code)
if(!pri)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", internal error (null response ptr)");
LOG_PRINT_L1("Failed to invoke http request to " << uri << ", internal error (null response ptr)");
return false;
}
if(pri->m_response_code != 200)
{
LOG_PRINT_L1("Failed to invoke http request to " << url << ", wrong response code: " << pri->m_response_code);
LOG_PRINT_L1("Failed to invoke http request to " << uri << ", wrong response code: " << pri->m_response_code);
return false;
}
@@ -95,15 +98,15 @@ namespace epee
}
template<class t_request, class t_response, class t_transport>
bool invoke_http_json_rpc(const std::string& url, const std::string& method_name, t_request& out_struct, t_response& result_struct, t_transport& transport, unsigned int timeout = 5000, const std::string& http_method = "GET", const std::string& req_id = "0")
bool invoke_http_json_rpc(const boost::string_ref uri, std::string method_name, const t_request& out_struct, t_response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET", const std::string& req_id = "0")
{
epee::json_rpc::request<t_request> req_t = AUTO_VAL_INIT(req_t);
req_t.jsonrpc = "2.0";
req_t.id = req_id;
req_t.method = method_name;
req_t.method = std::move(method_name);
req_t.params = out_struct;
epee::json_rpc::response<t_response, epee::json_rpc::error> resp_t = AUTO_VAL_INIT(resp_t);
if(!epee::net_utils::invoke_http_json_remote_command2(url, req_t, resp_t, transport, timeout, http_method))
if(!epee::net_utils::invoke_http_json(uri, req_t, resp_t, transport, timeout, http_method))
{
return false;
}
@@ -117,9 +120,9 @@ namespace epee
}
template<class t_command, class t_transport>
bool invoke_http_json_rpc(const std::string& url, typename t_command::request& out_struct, typename t_command::response& result_struct, t_transport& transport, unsigned int timeout = 5000, const std::string& http_method = "GET", const std::string& req_id = "0")
bool invoke_http_json_rpc(const boost::string_ref uri, typename t_command::request& out_struct, typename t_command::response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET", const std::string& req_id = "0")
{
return invoke_http_json_rpc(url, t_command::methodname(), out_struct, result_struct, transport, timeout, http_method, req_id);
return invoke_http_json_rpc(uri, t_command::methodname(), out_struct, result_struct, transport, timeout, http_method, req_id);
}
}

View File

@@ -30,6 +30,9 @@
#include <boost/utility/value_init.hpp>
#include "net/levin_base.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net"
namespace epee
{
namespace net_utils
@@ -48,7 +51,7 @@ namespace epee
int res = transport.invoke(command, buff_to_send, buff_to_recv);
if( res <=0 )
{
LOG_PRINT_RED("Failed to invoke command " << command << " return code " << res, LOG_LEVEL_1);
MERROR("Failed to invoke command " << command << " return code " << res);
return false;
}
serialization::portable_storage stg_ret;
@@ -112,7 +115,7 @@ namespace epee
{
typename serialization::portable_storage stg;
const_cast<t_arg&>(out_struct).store(stg);//TODO: add true const support to searilzation
std::string buff_to_send, buff_to_recv;
std::string buff_to_send;
stg.store_to_binary(buff_to_send);
int res = transport.invoke_async(command, buff_to_send, conn_id, [cb, command](int code, const std::string& buff, typename t_transport::connection_context& context)->bool
{
@@ -148,13 +151,13 @@ namespace epee
serialization::portable_storage stg;
out_struct.store(stg);
std::string buff_to_send, buff_to_recv;
std::string buff_to_send;
stg.store_to_binary(buff_to_send);
int res = transport.notify(command, buff_to_send, conn_id);
if(res <=0 )
{
LOG_PRINT_RED_L0("Failed to notify command " << command << " return code " << res);
MERROR("Failed to notify command " << command << " return code " << res);
return false;
}
return true;
@@ -281,7 +284,7 @@ namespace epee
#define END_INVOKE_MAP2() \
LOG_ERROR("Unkonown command:" << command); \
LOG_ERROR("Unknown command:" << command); \
return LEVIN_ERROR_CONNECTION_HANDLER_NOT_DEFINED; \
}
}

View File

@@ -158,7 +158,7 @@ namespace epee
pbuff->m_signature_b != PORTABLE_STORAGE_SIGNATUREB
)
{
LOG_ERROR("portable_storage: wrong binary format - signature missmatch");
LOG_ERROR("portable_storage: wrong binary format - signature mismatch");
return false;
}
if(pbuff->m_ver != PORTABLE_STORAGE_FORMAT_VER)

View File

@@ -68,7 +68,7 @@ namespace epee
++m_counter_ref;
CHECK_AND_ASSERT_THROW_MES(m_counter_ref < EPEE_PORTABLE_STORAGE_RECURSION_LIMIT_INTERNAL, "Wrong blob data in portable storage: recursion limitation (" << EPEE_PORTABLE_STORAGE_RECURSION_LIMIT_INTERNAL << ") exceeded");
}
~recursuion_limitation_guard()
~recursuion_limitation_guard() noexcept(false)
{
CHECK_AND_ASSERT_THROW_MES(m_counter_ref != 0, "Internal error: m_counter_ref == 0 while ~recursuion_limitation_guard()");
--m_counter_ref;

View File

@@ -365,12 +365,12 @@ namespace epee
}
catch(const std::exception& ex)
{
LOG_PRINT_RED_L0("Failed to parse json, what: " << ex.what());
MERROR("Failed to parse json, what: " << ex.what());
return false;
}
catch(...)
{
LOG_PRINT_RED_L0("Failed to parse json");
MERROR("Failed to parse json");
return false;
}
}

View File

@@ -29,7 +29,7 @@
#define _STRING_CODING_H_
#include <string>
//#include "md5_l.h"
namespace epee
{
namespace string_encoding
@@ -62,23 +62,6 @@ namespace string_encoding
(char*)str_trgt.data(), (int)str_trgt.size(), 0, 0);
return str_trgt;*/
}
#ifdef WINDOWS_PLATFORM_EX
inline std::string convert_to_ansii_win(const std::wstring& str_from)
{
int code_page = CP_ACP;
std::string str_trgt;
if(!str_from.size())
return str_trgt;
int cb = ::WideCharToMultiByte( code_page, 0, str_from.data(), (__int32)str_from.size(), 0, 0, 0, 0 );
if(!cb)
return str_trgt;
str_trgt.resize(cb);
::WideCharToMultiByte( code_page, 0, str_from.data(), (int)str_from.size(),
(char*)str_trgt.data(), (int)str_trgt.size(), 0, 0);
return str_trgt;
}
#endif
inline std::string convert_to_ansii(const std::string& str_from)
{
@@ -254,41 +237,6 @@ namespace string_encoding
return ret;
}
//md5
#ifdef MD5_H
inline
std::string get_buf_as_hex_string(const void* pbuf, size_t len)
{
std::ostringstream result;
const unsigned char* p_buff = (const unsigned char*)pbuf;
for(unsigned int i=0;i<len;i++)
{ // convert md to hex-represented string (hex-letters in upper case!)
result << std::setw(2) << std::setfill('0')
<< std::setbase(16) << std::nouppercase
<< (int)*p_buff++;
}
return result.str();
}
inline
std::string get_md5_as_hexstring(const void* pbuff, size_t len)
{
unsigned char output[16] = {0};
md5::md5((unsigned char*)pbuff, static_cast<unsigned int>(len), output);
return get_buf_as_hex_string(output, sizeof(output));
}
inline
std::string get_md5_as_hexstring(const std::string& src)
{
return get_md5_as_hexstring(src.data(), src.size());
}
#endif
}
}

View File

@@ -29,17 +29,22 @@
#ifndef _STRING_TOOLS_H_
#define _STRING_TOOLS_H_
//#include <objbase.h>
// Previously pulled in by ASIO, further cleanup still required ...
#ifdef _WIN32
# include <winsock2.h>
# include <windows.h>
#endif
#include <locale>
#include <cstdlib>
#include <iomanip>
//#include <strsafe.h>
#include <string>
#include <type_traits>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/asio.hpp>
#include <boost/algorithm/string/compare.hpp>
#include <boost/algorithm/string.hpp>
#include "hex.h"
#include "span.h"
#include "warnings.h"
@@ -55,38 +60,12 @@ namespace epee
{
namespace string_tools
{
inline std::wstring get_str_from_guid(const boost::uuids::uuid& rid)
{
return boost::lexical_cast<std::wstring>(rid);
}
//----------------------------------------------------------------------------
inline std::string get_str_from_guid_a(const boost::uuids::uuid& rid)
{
return boost::lexical_cast<std::string>(rid);
}
//----------------------------------------------------------------------------
inline bool get_guid_from_string( boost::uuids::uuid& inetifer, std::wstring str_id)
{
if(str_id.size() < 36)
return false;
if('{' == *str_id.begin())
str_id.erase(0, 1);
if('}' == *(--str_id.end()))
str_id.erase(--str_id.end());
try
{
inetifer = boost::lexical_cast<boost::uuids::uuid>(str_id);
return true;
}
catch(...)
{
return false;
}
}
//----------------------------------------------------------------------------
inline bool get_guid_from_string(OUT boost::uuids::uuid& inetifer, const std::string& str_id)
{
std::string local_str_id = str_id;
@@ -109,39 +88,18 @@ namespace string_tools
return false;
}
}
//----------------------------------------------------------------------------
template<class CharT>
std::basic_string<CharT> buff_to_hex(const std::basic_string<CharT>& s)
//----------------------------------------------------------------------------
inline std::string buff_to_hex_nodelimer(const std::string& src)
{
using namespace std;
basic_stringstream<CharT> hexStream;
hexStream << hex << noshowbase << setw(2);
for(typename std::basic_string<CharT>::const_iterator it = s.begin(); it != s.end(); it++)
{
hexStream << "0x"<< static_cast<unsigned int>(static_cast<unsigned char>(*it)) << " ";
}
return hexStream.str();
return to_hex::string(to_byte_span(to_span(src)));
}
//----------------------------------------------------------------------------
template<class CharT>
std::basic_string<CharT> buff_to_hex_nodelimer(const std::basic_string<CharT>& s)
{
using namespace std;
basic_stringstream<CharT> hexStream;
hexStream << hex << noshowbase;
for(typename std::basic_string<CharT>::const_iterator it = s.begin(); it != s.end(); it++)
{
hexStream << setw(2) << setfill('0') << static_cast<unsigned int>(static_cast<unsigned char>(*it));
}
return hexStream.str();
}
//----------------------------------------------------------------------------
template<class CharT>
bool parse_hexstr_to_binbuff(const std::basic_string<CharT>& s, std::basic_string<CharT>& res)
bool parse_hexstr_to_binbuff(const std::basic_string<CharT>& s, std::basic_string<CharT>& res, bool allow_partial_byte = false)
{
res.clear();
if (!allow_partial_byte && (s.size() & 1))
return false;
try
{
long v = 0;
@@ -169,6 +127,7 @@ namespace string_tools
template<class t_pod_type>
bool parse_tpod_from_hex_string(const std::string& str_hash, t_pod_type& t_pod)
{
static_assert(std::is_pod<t_pod_type>::value, "expected pod type");
std::string buf;
bool res = epee::string_tools::parse_hexstr_to_binbuff(str_hash, buf);
if (!res || buf.size() != sizeof(t_pod_type))
@@ -214,22 +173,6 @@ DISABLE_GCC_WARNING(maybe-uninitialized)
return true;
}
POP_WARNINGS
//---------------------------------------------------
template<typename int_t>
bool get_xnum_from_hex_string(const std::string str, int_t& res )
{
try
{
std::stringstream ss;
ss << std::hex << str;
ss >> res;
return true;
}
catch(...)
{
return false;
}
}
//----------------------------------------------------------------------------
template<class XType>
inline bool xtype_to_string(const XType& val, std::string& str)
@@ -245,139 +188,39 @@ POP_WARNINGS
return true;
}
typedef std::map<std::string, std::string> command_line_params_a;
typedef std::map<std::wstring, std::wstring> command_line_params_w;
template<class t_string>
bool parse_commandline(std::map<t_string, t_string>& res, int argc, char** argv)
{
t_string key;
for(int i = 1; i < argc; i++)
{
if(!argv[i])
break;
t_string s = argv[i];
std::string::size_type p = s.find('=');
if(std::string::npos == p)
{
res[s] = "";
}else
{
std::string ss;
t_string nm = s.substr(0, p);
t_string vl = s.substr(p+1, s.size());
res[nm] = vl;
}
}
return true;
}
/* template<typename t_type>
bool get_xparam_from_command_line(const std::map<std::string, std::string>& res, const std::basic_string<typename t_string::value_type> & key, t_type& val)
{
}
*/
template<class t_string, typename t_type>
bool get_xparam_from_command_line(const std::map<t_string, t_string>& res, const t_string & key, t_type& val)
{
typename std::map<t_string, t_string>::const_iterator it = res.find(key);
if(it == res.end())
return false;
if(it->second.size())
{
return get_xtype_from_string(val, it->second);
}
return true;
}
template<class t_string, typename t_type>
t_type get_xparam_from_command_line(const std::map<t_string, t_string>& res, const t_string & key, const t_type& default_value)
{
typename std::map<t_string, t_string>::const_iterator it = res.find(key);
if(it == res.end())
return default_value;
if(it->second.size())
{
t_type s;
get_xtype_from_string(s, it->second);
return s;
}
return default_value;
}
template<class t_string>
bool have_in_command_line(const std::map<t_string, t_string>& res, const std::basic_string<typename t_string::value_type>& key)
{
typename std::map<t_string, t_string>::const_iterator it = res.find(key);
if(it == res.end())
return false;
return true;
}
//----------------------------------------------------------------------------
//#ifdef _WINSOCK2API_
inline std::string get_ip_string_from_int32(uint32_t ip)
{
in_addr adr;
adr.s_addr = ip;
const char* pbuf = inet_ntoa(adr);
if(pbuf)
return pbuf;
else
return "[failed]";
}
std::string get_ip_string_from_int32(uint32_t ip);
//----------------------------------------------------------------------------
inline bool get_ip_int32_from_string(uint32_t& ip, const std::string& ip_str)
{
ip = inet_addr(ip_str.c_str());
if(INADDR_NONE == ip)
return false;
return true;
}
bool get_ip_int32_from_string(uint32_t& ip, const std::string& ip_str);
//----------------------------------------------------------------------------
inline bool parse_peer_from_string(uint32_t& ip, uint32_t& port, const std::string& addres)
inline bool parse_peer_from_string(uint32_t& ip, uint16_t& port, const std::string& addres)
{
//parse ip and address
std::string::size_type p = addres.find(':');
std::string ip_str, port_str;
if(p == std::string::npos)
{
return false;
port = 0;
ip_str = addres;
}
else
{
ip_str = addres.substr(0, p);
port_str = addres.substr(p+1, addres.size());
}
std::string ip_str = addres.substr(0, p);
std::string port_str = addres.substr(p+1, addres.size());
if(!get_ip_int32_from_string(ip, ip_str))
{
return false;
}
if(!get_xtype_from_string(port, port_str))
if(p != std::string::npos && !get_xtype_from_string(port, port_str))
{
return false;
}
return true;
}
//#endif
//----------------------------------------------------------------------------
template<typename t>
inline std::string get_t_as_hex_nwidth(const t& v, std::streamsize w = 8)
{
std::stringstream ss;
ss << std::setfill ('0') << std::setw (w) << std::hex << std::noshowbase;
ss << v;
return ss.str();
}
inline std::string num_to_string_fast(int64_t val)
{
/*
@@ -387,68 +230,6 @@ POP_WARNINGS
return boost::lexical_cast<std::string>(val);
}
//----------------------------------------------------------------------------
inline bool string_to_num_fast(const std::string& buff, int64_t& val)
{
//return get_xtype_from_string(val, buff);
#if (defined _MSC_VER)
val = _atoi64(buff.c_str());
#else
val = atoll(buff.c_str());
#endif
/*
* val = atoi64(buff.c_str());
*/
if(buff != "0" && val == 0)
return false;
return true;
}
//----------------------------------------------------------------------------
inline bool string_to_num_fast(const std::string& buff, int& val)
{
val = atoi(buff.c_str());
if(buff != "0" && val == 0)
return false;
return true;
}
//----------------------------------------------------------------------------
#ifdef WINDOWS_PLATFORM
inline std::string system_time_to_string(const SYSTEMTIME& st)
{
/*
TIME_ZONE_INFORMATION tzi;
GetTimeZoneInformation(&tzi);
SystemTimeToTzSpecificLocalTime(&tzi, &stUTC, &stLocal);
*/
char szTime[25], szDate[25];
::GetTimeFormatA(
LOCALE_USER_DEFAULT, // locale
TIME_FORCE24HOURFORMAT, // options
&st, // time
NULL, // time format string
szTime, // formatted string buffer
25 // size of string buffer
);
::GetDateFormatA(
LOCALE_USER_DEFAULT, // locale
NULL, // options
&st, // date
NULL, // date format
szDate, // formatted string buffer
25 // size of buffer
);
szTime[24] = szDate[24] = 0; //be happy :)
std::string res = szDate;
(res += " " )+= szTime;
return res;
}
#endif
//----------------------------------------------------------------------------
inline bool compare_no_case(const std::string& str1, const std::string& str2)
{
@@ -456,33 +237,6 @@ POP_WARNINGS
return !boost::iequals(str1, str2);
}
//----------------------------------------------------------------------------
inline bool compare_no_case(const std::wstring& str1, const std::wstring& str2)
{
return !boost::iequals(str1, str2);
}
//----------------------------------------------------------------------------
inline bool is_match_prefix(const std::wstring& str1, const std::wstring& prefix)
{
if(prefix.size()>str1.size())
return false;
if(!compare_no_case(str1.substr(0, prefix.size()), prefix))
return true;
else
return false;
}
//----------------------------------------------------------------------------
inline bool is_match_prefix(const std::string& str1, const std::string& prefix)
{
if(prefix.size()>str1.size())
return false;
if(!compare_no_case(str1.substr(0, prefix.size()), prefix))
return true;
else
return false;
}
//----------------------------------------------------------------------------
inline std::string& get_current_module_name()
{
static std::string module_name;
@@ -560,17 +314,29 @@ POP_WARNINGS
return str;
}
//----------------------------------------------------------------------------
inline std::string pad_string(std::string s, size_t n, char c = ' ', bool prepend = false)
{
if (s.size() < n)
{
if (prepend)
s = std::string(n - s.size(), c) + s;
else
s.append(n - s.size(), c);
}
return s;
}
//----------------------------------------------------------------------------
template<class t_pod_type>
std::string pod_to_hex(const t_pod_type& s)
{
std::string buff;
buff.assign(reinterpret_cast<const char*>(&s), sizeof(s));
return buff_to_hex_nodelimer(buff);
static_assert(std::is_pod<t_pod_type>::value, "expected pod type");
return to_hex::string(as_byte_span(s));
}
//----------------------------------------------------------------------------
template<class t_pod_type>
bool hex_to_pod(const std::string& hex_str, t_pod_type& s)
{
static_assert(std::is_pod<t_pod_type>::value, "expected pod type");
std::string hex_str_tr = trim(hex_str);
if(sizeof(s)*2 != hex_str.size())
return false;
@@ -595,20 +361,6 @@ POP_WARNINGS
return res;
}
//----------------------------------------------------------------------------
inline std::string get_filename_from_path(const std::string& str)
{
std::string res;
std::string::size_type pos = str.rfind('\\');
if(std::string::npos == pos)
return str;
res = str.substr(pos+1, str.size()-pos);
return res;
}
//----------------------------------------------------------------------------
inline std::string cut_off_extension(const std::string& str)
{
std::string res;
@@ -619,127 +371,6 @@ POP_WARNINGS
res = str.substr(0, pos);
return res;
}
//----------------------------------------------------------------------------
#ifdef _WININET_
inline std::string get_string_from_systemtime(const SYSTEMTIME& sys_time)
{
std::string result_string;
char buff[100] = {0};
BOOL res = ::InternetTimeFromSystemTimeA(&sys_time, INTERNET_RFC1123_FORMAT, buff, 99);
if(!res)
{
LOG_ERROR("Failed to load SytemTime to string");
}
result_string = buff;
return result_string;
}
//-------------------------------------------------------------------------------------
inline SYSTEMTIME get_systemtime_from_string(const std::string& buff)
{
SYSTEMTIME result_time = {0};
BOOL res = ::InternetTimeToSystemTimeA(buff.c_str(), &result_time, NULL);
if(!res)
{
LOG_ERROR("Failed to load SytemTime from string " << buff << "interval set to 15 minutes");
}
return result_time;
}
#endif
#ifdef WINDOWS_PLATFORM
static const DWORD INFO_BUFFER_SIZE = 10000;
static const wchar_t* get_pc_name()
{
static wchar_t info[INFO_BUFFER_SIZE];
static DWORD bufCharCount = INFO_BUFFER_SIZE;
static bool init = false;
if (!init) {
if (!GetComputerNameW( info, &bufCharCount ))
info[0] = 0;
else
init = true;
}
return info;
}
static const wchar_t* get_user_name()
{
static wchar_t info[INFO_BUFFER_SIZE];
static DWORD bufCharCount = INFO_BUFFER_SIZE;
static bool init = false;
if (!init) {
if (!GetUserNameW( info, &bufCharCount ))
info[0] = 0;
else
init = true;
}
return info;
}
#endif
#ifdef _LM_
static const wchar_t* get_domain_name()
{
static wchar_t info[INFO_BUFFER_SIZE];
static DWORD bufCharCount = 0;
static bool init = false;
if (!init) {
LPWSTR domain( NULL );
NETSETUP_JOIN_STATUS status;
info[0] = 0;
if (NET_API_STATUS result = NetGetJoinInformation( NULL, &domain, &status ))
{
LOG_ERROR("get_domain_name error: " << log_space::get_win32_err_descr(result));
} else
{
StringCchCopyW( info, sizeof(info)/sizeof( info[0] ), domain );
NetApiBufferFree((void*)domain);
init = true;
}
}
return info;
}
#endif
#ifdef WINDOWS_PLATFORM
inline
std::string load_resource_string_a(int id, const char* pmodule_name = NULL)
{
//slow realization
HMODULE h = ::GetModuleHandleA( pmodule_name );
char buff[2000] = {0};
::LoadStringA( h, id, buff, sizeof(buff));
buff[sizeof(buff)-1] = 0; //be happy :)
return buff;
}
inline
std::wstring load_resource_string_w(int id, const char* pmodule_name = NULL)
{
//slow realization
HMODULE h = ::GetModuleHandleA( pmodule_name );
wchar_t buff[2000] = {0};
::LoadStringW( h, id, buff, sizeof(buff) / sizeof( buff[0] ) );
buff[(sizeof(buff)/sizeof(buff[0]))-1] = 0; //be happy :)
return buff;
}
#endif
}
}
#endif //_STRING_TOOLS_H_

View File

@@ -1,21 +1,21 @@
# Copyright (c) 2014-2016, The Monero Project
#
# Copyright (c) 2014-2017, The Monero Project
#
# All rights reserved.
#
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
#
# 1. Redistributions of source code must retain the above copyright notice, this list of
# conditions and the following disclaimer.
#
#
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
# of conditions and the following disclaimer in the documentation and/or other
# materials provided with the distribution.
#
#
# 3. Neither the name of the copyright holder nor the names of its contributors may be
# used to endorse or promote products derived from this software without specific
# prior written permission.
#
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
@@ -26,31 +26,27 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set(simpleminer_sources
simpleminer.cpp)
if (USE_READLINE AND GNU_READLINE_FOUND)
add_library(epee STATIC hex.cpp http_auth.cpp mlog.cpp string_tools.cpp readline_buffer.cpp)
else()
add_library(epee STATIC hex.cpp http_auth.cpp mlog.cpp string_tools.cpp)
endif()
set(simpleminer_headers)
# Build and install libepee if we're building for GUI
if (BUILD_GUI_DEPS)
if(IOS)
set(lib_folder lib-${ARCH})
else()
set(lib_folder lib)
endif()
install(TARGETS epee
ARCHIVE DESTINATION ${lib_folder})
endif()
set(simpleminer_private_headers
simpleminer.h
simpleminer_protocol_defs.h
target_helper.h)
bitmonero_private_headers(simpleminer
${simpleminer_private_headers})
bitmonero_add_executable(simpleminer
${simpleminer_sources}
${simpleminer_headers}
${simpleminer_private_headers})
target_link_libraries(simpleminer
LINK_PRIVATE
cryptonote_core
common
target_link_libraries(epee
PUBLIC
cncrypto
easylogging
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_REGEX_LIBRARY}
${Boost_CHRONO_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
PRIVATE
${EXTRA_LIBRARIES})

82
contrib/epee/src/hex.cpp Normal file
View File

@@ -0,0 +1,82 @@
// Copyright (c) 2017, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "hex.h"
#include <iterator>
#include <limits>
#include <ostream>
#include <stdexcept>
namespace epee
{
namespace
{
template<typename T>
void write_hex(T&& out, const span<const std::uint8_t> src)
{
static constexpr const char hex[] = u8"0123456789abcdef";
static_assert(sizeof(hex) == 17, "bad string size");
for (const std::uint8_t byte : src)
{
*out = hex[byte >> 4];
++out;
*out = hex[byte & 0x0F];
++out;
}
}
}
std::string to_hex::string(const span<const std::uint8_t> src)
{
if (std::numeric_limits<std::size_t>::max() / 2 < src.size())
throw std::range_error("hex_view::to_string exceeded maximum size");
std::string out{};
out.resize(src.size() * 2);
buffer_unchecked(std::addressof(out[0]), src);
return out;
}
void to_hex::buffer(std::ostream& out, const span<const std::uint8_t> src)
{
write_hex(std::ostreambuf_iterator<char>{out}, src);
}
void to_hex::formatted(std::ostream& out, const span<const std::uint8_t> src)
{
out.put('<');
buffer(out, src);
out.put('>');
}
void to_hex::buffer_unchecked(char* out, const span<const std::uint8_t> src) noexcept
{
return write_hex(out, src);
}
}

View File

@@ -0,0 +1,778 @@
// Copyright (c) 2014-2017, The Monero Project
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of
// conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other
// materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "net/http_auth.h"
#include <array>
#include <boost/algorithm/string/find_iterator.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/fusion/adapted/std_tuple.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
#include <boost/fusion/algorithm/iteration/iter_fold.hpp>
#include <boost/fusion/algorithm/query/any.hpp>
#include <boost/fusion/iterator/distance.hpp>
#include <boost/fusion/iterator/value_of.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/range/algorithm/copy.hpp>
#include <boost/range/algorithm/find_if.hpp>
#include <boost/range/iterator_range_core.hpp>
#include <boost/range/join.hpp>
#include <boost/spirit/include/karma_generate.hpp>
#include <boost/spirit/include/karma_uint.hpp>
#include <boost/spirit/include/qi_alternative.hpp>
#include <boost/spirit/include/qi_and_predicate.hpp>
#include <boost/spirit/include/qi_char.hpp>
#include <boost/spirit/include/qi_char_class.hpp>
#include <boost/spirit/include/qi_difference.hpp>
#include <boost/spirit/include/qi_kleene.hpp>
#include <boost/spirit/include/qi_parse.hpp>
#include <boost/spirit/include/qi_plus.hpp>
#include <boost/spirit/include/qi_no_case.hpp>
#include <boost/spirit/include/qi_not_predicate.hpp>
#include <boost/spirit/include/qi_raw.hpp>
#include <boost/spirit/include/qi_rule.hpp>
#include <boost/spirit/include/qi_sequence.hpp>
#include <boost/spirit/include/qi_string.hpp>
#include <boost/spirit/include/qi_symbols.hpp>
#include <boost/spirit/include/qi_uint.hpp>
#include <cassert>
#include <iterator>
#include <limits>
#include <tuple>
#include <type_traits>
#include "crypto/crypto.h"
#include "hex.h"
#include "md5_l.h"
#include "string_coding.h"
/* This file uses the `u8` prefix and specifies all chars by ASCII numeric
value. This is for maximum portability - C++ does not actually specify ASCII
as the encoding type for unprefixed string literals, etc. Although rare, the
effort required to support rare compiler encoding types is low.
Also be careful of qi::ascii character classes (`qi::asci::alpha`, etc.) -
non-ASCII characters will cause undefined behavior in the table lookup until
boost 1.60. The expression `&qi::ascii::char_` will fail on non-ASCII
characters without "consuming" the input character. */
namespace
{
namespace http = epee::net_utils::http;
// string_ref is only constexpr if length is given
template<std::size_t N>
constexpr boost::string_ref ceref(const char (&arg)[N])
{
return boost::string_ref(arg, N - 1);
}
constexpr const auto client_auth_field = ceref(u8"Authorization");
constexpr const auto server_auth_field = ceref(u8"WWW-authenticate");
constexpr const auto auth_realm = ceref(u8"monero-rpc");
constexpr const char comma = 44;
constexpr const char equal_sign = 61;
constexpr const char quote = 34;
constexpr const char zero = 48;
constexpr const auto sess_algo = ceref(u8"-sess");
constexpr const unsigned client_reserve_size = 512; //!< std::string::reserve size for clients
//// Digest Algorithms
struct md5_
{
static constexpr const boost::string_ref name = ceref(u8"MD5");
struct update
{
template<typename T>
void operator()(const T& arg) const
{
const boost::iterator_range<const char*> data(boost::as_literal(arg));
md5::MD5Update(
std::addressof(ctx),
reinterpret_cast<const std::uint8_t*>(data.begin()),
data.size()
);
}
void operator()(const std::string& arg) const
{
(*this)(boost::string_ref(arg));
}
md5::MD5_CTX& ctx;
};
template<typename... T>
std::array<char, 32> operator()(const T&... args) const
{
md5::MD5_CTX ctx{};
md5::MD5Init(std::addressof(ctx));
boost::fusion::for_each(std::tie(args...), update{ctx});
std::array<std::uint8_t, 16> digest{{}};
md5::MD5Final(digest.data(), std::addressof(ctx));
return epee::to_hex::array(digest);
}
};
constexpr const boost::string_ref md5_::name;
//! Digest Algorithms available for HTTP Digest Auth. Sort better algos to the left
constexpr const std::tuple<md5_> digest_algorithms{};
//// Various String Utilities
struct ascii_tolower_
{
template<typename Char>
constexpr Char operator()(Char value) const noexcept
{
static_assert(std::is_integral<Char>::value, "only integral types supported");
return (65 <= value && value <= 90) ? (value + 32) : value;
}
};
constexpr const ascii_tolower_ ascii_tolower{};
struct ascii_iequal_
{
template<typename Char>
constexpr bool operator()(Char left, Char right) const noexcept
{
return ascii_tolower(left) == ascii_tolower(right);
}
};
constexpr const ascii_iequal_ ascii_iequal{};
struct http_list_separator_
{
template<typename Char>
bool operator()(Char value) const noexcept
{
static_assert(std::is_integral<Char>::value, "only integral types supported");
return boost::spirit::char_encoding::ascii::isascii_(value) &&
(value == comma || boost::spirit::char_encoding::ascii::isspace(value));
}
};
constexpr const http_list_separator_ http_list_separator{};
std::string to_string(boost::iterator_range<const char*> source)
{
return {source.begin(), source.size()};
}
template<typename T>
void add_first_field(std::string& str, const char* const name, const T& value)
{
str.append(name);
str.push_back(equal_sign);
boost::copy(value, std::back_inserter(str));
}
template<typename T>
void add_field(std::string& str, const char* const name, const T& value)
{
str.push_back(comma);
add_first_field(str, name, value);
}
template<typename T>
using quoted_result = boost::joined_range<
const boost::joined_range<const boost::string_ref, const T>, const boost::string_ref
>;
template<typename T>
quoted_result<T> quoted(const T& arg)
{
return boost::range::join(boost::range::join(ceref(u8"\""), arg), ceref(u8"\""));
}
//// Digest Authentication
template<typename Digest>
typename std::result_of<Digest()>::type generate_a1(
Digest digest, const http::login& creds, const boost::string_ref realm)
{
return digest(creds.username, u8":", realm, u8":", creds.password);
}
template<typename Digest>
typename std::result_of<Digest()>::type generate_a1(
Digest digest, const http::http_client_auth::session& user)
{
return generate_a1(std::move(digest), user.credentials, user.server.realm);
}
template<typename T>
void init_client_value(std::string& str,
const boost::string_ref algorithm, const http::http_client_auth::session& user,
const boost::string_ref uri, const T& response)
{
str.append(u8"Digest ");
add_first_field(str, u8"algorithm", algorithm);
add_field(str, u8"nonce", quoted(user.server.nonce));
add_field(str, u8"realm", quoted(user.server.realm));
add_field(str, u8"response", quoted(response));
add_field(str, u8"uri", quoted(uri));
add_field(str, u8"username", quoted(user.credentials.username));
if (!user.server.opaque.empty())
add_field(str, u8"opaque", quoted(user.server.opaque));
}
//! Implements superseded algorithm specified in RFC 2069
template<typename Digest>
struct old_algorithm
{
explicit old_algorithm(Digest digest_) : digest(std::move(digest_)) {}
std::string operator()(const http::http_client_auth::session& user,
const boost::string_ref method, const boost::string_ref uri) const
{
const auto response = digest(
generate_a1(digest, user), u8":", user.server.nonce, u8":", digest(method, u8":", uri)
);
std::string out{};
out.reserve(client_reserve_size);
init_client_value(out, Digest::name, user, uri, response);
return out;
}
private:
Digest digest;
};
//! Implements the `qop=auth` algorithm specified in RFC 2617
template<typename Digest>
struct auth_algorithm
{
explicit auth_algorithm(Digest digest_) : digest(std::move(digest_)) {}
std::string operator()(const http::http_client_auth::session& user,
const boost::string_ref method, const boost::string_ref uri) const
{
namespace karma = boost::spirit::karma;
using counter_type = decltype(user.counter);
static_assert(
std::numeric_limits<counter_type>::radix == 2, "unexpected radix for counter"
);
static_assert(
std::numeric_limits<counter_type>::digits <= 32,
"number of digits will cause underflow on padding below"
);
std::string out{};
out.reserve(client_reserve_size);
karma::generate(std::back_inserter(out), karma::hex(user.counter));
out.insert(out.begin(), 8 - out.size(), zero); // zero left pad
if (out.size() != 8)
return {};
std::array<char, 8> nc{{}};
boost::copy(out, nc.data());
const auto response = digest(
generate_a1(digest, user), u8":", user.server.nonce, u8":", nc, u8"::auth:", digest(method, u8":", uri)
);
out.clear();
init_client_value(out, Digest::name, user, uri, response);
add_field(out, u8"qop", ceref(u8"auth"));
add_field(out, u8"nc", nc);
return out;
}
private:
Digest digest;
};
//! Processes client "Authorization" and server "WWW-authenticate" HTTP fields
struct auth_message
{
using iterator = const char*;
enum status{ kFail = 0, kStale, kPass };
//! \return Status of the `response` field from the client
static status verify(const boost::string_ref method, const boost::string_ref request,
const http::http_server_auth::session& user)
{
const auto parsed = parse(request);
if (parsed &&
boost::equals(parsed->username, user.credentials.username) &&
boost::fusion::any(digest_algorithms, has_valid_response{*parsed, user, method}))
{
if (boost::equals(parsed->nonce, user.nonce))
{
// RFC 2069 format does not verify nc value - allow just once
if (user.counter == 1 || (!parsed->qop.empty() && parsed->counter() == user.counter))
{
return kPass;
}
}
return kStale;
}
return kFail;
}
//! \return Information needed to generate client authentication `response`s.
static http::http_client_auth::session::keys extract(
const http::http_response_info& response, const bool is_first)
{
using field = std::pair<std::string, std::string>;
server_parameters best{};
const std::list<field>& fields = response.m_header_info.m_etc_fields;
auto current = fields.begin();
const auto end = fields.end();
while (true)
{
current = std::find_if(current, end, [] (const field& value) {
return boost::equals(server_auth_field, value.first, ascii_iequal);
});
if (current == end)
break;
const auto parsed = parse(current->second);
if (parsed)
{
server_parameters local_best = parsed->algorithm.empty() ?
server_parameters{*parsed, boost::fusion::find<md5_>(digest_algorithms)} :
boost::fusion::iter_fold(digest_algorithms, server_parameters{}, matches_algorithm{*parsed});
if (local_best.index < best.index)
best = std::move(local_best);
}
++current;
}
if (is_first || boost::equals(best.stale, ceref(u8"true"), ascii_iequal))
return best.take();
return {}; // authentication failed with bad user/pass
}
private:
explicit auth_message()
: algorithm()
, cnonce()
, nc()
, nonce()
, qop()
, realm()
, response()
, stale()
, uri()
, username() {
}
static boost::optional<auth_message> parse(const boost::string_ref request)
{
struct parser
{
using field_parser = std::function<bool(const parser&, iterator&, iterator, auth_message&)>;
explicit parser() : field_table(), skip_whitespace(), header(), quoted_string(), token(), fields() {
using namespace std::placeholders;
namespace qi = boost::spirit::qi;
struct parse_nc
{
bool operator()(const parser&, iterator& current, const iterator end, auth_message& result) const
{
return qi::parse(
current, end,
(qi::raw[qi::uint_parser<std::uint32_t, 16, 8, 8>{}]),
result.nc
);
}
};
struct parse_token
{
bool operator()(const parser& parse, iterator& current, const iterator end,
boost::iterator_range<iterator>& result) const
{
return qi::parse(current, end, parse.token, result);
}
};
struct parse_string
{
bool operator()(const parser& parse, iterator& current, const iterator end,
boost::iterator_range<iterator>& result) const
{
return qi::parse(current, end, parse.quoted_string, result);
}
bool operator()(const parser& parse, iterator& current, const iterator end) const
{
return qi::parse(current, end, parse.quoted_string);
}
};
struct parse_response
{
bool operator()(const parser&, iterator& current, const iterator end, auth_message& result) const
{
using byte = qi::uint_parser<std::uint8_t, 16, 2, 2>;
return qi::parse(
current, end,
(qi::lit(quote) >> qi::raw[+(byte{})] >> qi::lit(quote)),
result.response
);
}
};
field_table.add
(u8"algorithm", std::bind(parse_token{}, _1, _2, _3, std::bind(&auth_message::algorithm, _4)))
(u8"cnonce", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::cnonce, _4)))
(u8"domain", std::bind(parse_string{}, _1, _2, _3)) // ignore field
(u8"nc", parse_nc{})
(u8"nonce", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::nonce, _4)))
(u8"opaque", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::opaque, _4)))
(u8"qop", std::bind(parse_token{}, _1, _2, _3, std::bind(&auth_message::qop, _4)))
(u8"realm", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::realm, _4)))
(u8"response", parse_response{})
(u8"stale", std::bind(parse_token{}, _1, _2, _3, std::bind(&auth_message::stale, _4)))
(u8"uri", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::uri, _4)))
(u8"username", std::bind(parse_string{}, _1, _2, _3, std::bind(&auth_message::username, _4)));
skip_whitespace = *(&qi::ascii::char_ >> qi::ascii::space);
header = skip_whitespace >> qi::ascii::no_case[u8"digest"] >> skip_whitespace;
quoted_string = (qi::lit(quote) >> qi::raw[+(u8"\\\"" | (qi::ascii::char_ - quote))] >> qi::lit(quote));
token =
(!qi::lit(quote) >> qi::raw[+(&qi::ascii::char_ >> (qi::ascii::graph - qi::ascii::char_(u8"()<>@,;:\\\"/[]?={}")))]) |
quoted_string;
fields = field_table >> skip_whitespace >> equal_sign >> skip_whitespace;
}
boost::optional<auth_message> operator()(const boost::string_ref request) const
{
namespace qi = boost::spirit::qi;
iterator current = request.begin();
const iterator end = request.end();
if (!qi::parse(current, end, header))
{
return boost::none;
}
auth_message info{};
field_parser null_parser{};
std::reference_wrapper<const field_parser> field = null_parser;
do // require at least one field; require field after `,` character
{
if (!qi::parse(current, end, fields, field) || !field(*this, current, end, info))
{
return boost::none;
}
qi::parse(current, end, skip_whitespace);
} while (qi::parse(current, end, qi::char_(comma) >> skip_whitespace));
return boost::make_optional(current == end, info);
}
private:
boost::spirit::qi::symbols<
char, field_parser, boost::spirit::qi::tst<char, field_parser>, ascii_tolower_
> field_table;
boost::spirit::qi::rule<iterator> skip_whitespace;
boost::spirit::qi::rule<iterator> header;
boost::spirit::qi::rule<iterator, boost::iterator_range<iterator>()> quoted_string;
boost::spirit::qi::rule<iterator, boost::iterator_range<iterator>()> token;
boost::spirit::qi::rule<iterator, std::reference_wrapper<const field_parser>()> fields;
}; // parser
static const parser parse_;
return parse_(request);
}
struct has_valid_response
{
template<typename Digest, typename Result>
Result generate_old_response(Digest digest, const Result& key, const Result& auth) const
{
return digest(key, u8":", request.nonce, u8":", auth);
}
template<typename Digest, typename Result>
Result generate_new_response(Digest digest, const Result& key, const Result& auth) const
{
return digest(
key, u8":", request.nonce, u8":", request.nc, u8":", request.cnonce, u8":", request.qop, u8":", auth
);
}
template<typename Result>
bool check(const Result& result) const
{
return boost::equals(request.response, result, ascii_iequal);
}
template<typename Digest>
bool operator()(const Digest& digest) const
{
if (boost::starts_with(request.algorithm, Digest::name, ascii_iequal) ||
(request.algorithm.empty() && std::is_same<md5_, Digest>::value))
{
auto key = generate_a1(digest, user.credentials, auth_realm);
if (boost::ends_with(request.algorithm, sess_algo, ascii_iequal))
{
key = digest(key, u8":", request.nonce, u8":", request.cnonce);
}
auto auth = digest(method, u8":", request.uri);
if (request.qop.empty())
{
return check(generate_old_response(std::move(digest), std::move(key), std::move(auth)));
}
else if (boost::equals(ceref(u8"auth"), request.qop, ascii_iequal))
{
return check(generate_new_response(std::move(digest), std::move(key), std::move(auth)));
}
}
return false;
}
const auth_message& request;
const http::http_server_auth::session& user;
const boost::string_ref method;
};
boost::optional<std::uint32_t> counter() const
{
namespace qi = boost::spirit::qi;
using hex = qi::uint_parser<std::uint32_t, 16>;
std::uint32_t value = 0;
const bool converted = qi::parse(nc.begin(), nc.end(), hex{}, value);
return boost::make_optional(converted, value);
}
struct server_parameters
{
server_parameters()
: nonce(), opaque(), realm(), stale(), value_generator()
, index(boost::fusion::size(digest_algorithms))
{}
template<typename DigestIter>
explicit server_parameters(const auth_message& request, const DigestIter& digest)
: nonce(request.nonce)
, opaque(request.opaque)
, stale(request.stale)
, realm(request.realm)
, value_generator()
, index(boost::fusion::distance(boost::fusion::begin(digest_algorithms), digest))
{
using digest_type = typename boost::fusion::result_of::value_of<DigestIter>::type;
// debug check internal state of the auth_message class
assert(
(std::is_same<digest_type, md5_>::value) ||
boost::equals((*digest).name, request.algorithm, ascii_iequal)
);
if (request.qop.empty())
value_generator = old_algorithm<digest_type>{*digest};
else
{
for (auto elem = boost::make_split_iterator(request.qop, boost::token_finder(http_list_separator));
!elem.eof();
++elem)
{
if (boost::equals(ceref(u8"auth"), *elem, ascii_iequal))
{
value_generator = auth_algorithm<digest_type>{*digest};
break;
}
}
if (!value_generator) // no supported qop mode
index = boost::fusion::size(digest_algorithms);
}
}
http::http_client_auth::session::keys take()
{
return {to_string(nonce), to_string(opaque), to_string(realm), std::move(value_generator)};
}
boost::iterator_range<iterator> nonce;
boost::iterator_range<iterator> opaque;
boost::iterator_range<iterator> realm;
boost::iterator_range<iterator> stale;
http::http_client_auth::session::keys::algorithm value_generator;
unsigned index;
};
struct matches_algorithm
{
template<typename DigestIter>
server_parameters operator()(server_parameters current, const DigestIter& digest) const
{
if (!current.value_generator)
{
if (boost::equals(response.algorithm, (*digest).name, ascii_iequal))
{
current = server_parameters{response, digest};
}
}
return current;
}
const auth_message& response;
};
boost::iterator_range<iterator> algorithm;
boost::iterator_range<iterator> cnonce;
boost::iterator_range<iterator> nc;
boost::iterator_range<iterator> nonce;
boost::iterator_range<iterator> opaque;
boost::iterator_range<iterator> qop;
boost::iterator_range<iterator> realm;
boost::iterator_range<iterator> response;
boost::iterator_range<iterator> stale;
boost::iterator_range<iterator> uri;
boost::iterator_range<iterator> username;
}; // auth_message
struct add_challenge
{
template<typename Digest>
void operator()(const Digest& digest) const
{
static constexpr const auto fvalue = ceref(u8"Digest qop=\"auth\"");
for (unsigned i = 0; i < 2; ++i)
{
std::string out(fvalue);
const auto algorithm = boost::range::join(
Digest::name, (i == 0 ? boost::string_ref{} : sess_algo)
);
add_field(out, u8"algorithm", algorithm);
add_field(out, u8"realm", quoted(auth_realm));
add_field(out, u8"nonce", quoted(nonce));
add_field(out, u8"stale", is_stale ? ceref("true") : ceref("false"));
fields.push_back(std::make_pair(std::string(server_auth_field), std::move(out)));
}
}
const boost::string_ref nonce;
std::list<std::pair<std::string, std::string>>& fields;
const bool is_stale;
};
http::http_response_info create_digest_response(const boost::string_ref nonce, const bool is_stale)
{
epee::net_utils::http::http_response_info rc{};
rc.m_response_code = 401;
rc.m_response_comment = u8"Unauthorized";
rc.m_mime_tipe = u8"text/html";
rc.m_body =
u8"<html><head><title>Unauthorized Access</title></head><body><h1>401 Unauthorized</h1></body></html>";
boost::fusion::for_each(
digest_algorithms, add_challenge{nonce, rc.m_additional_fields, is_stale}
);
return rc;
}
}
namespace epee
{
namespace net_utils
{
namespace http
{
http_server_auth::http_server_auth(login credentials)
: user(session{std::move(credentials)}) {
}
boost::optional<http_response_info> http_server_auth::do_get_response(const http_request_info& request)
{
assert(user);
using field = std::pair<std::string, std::string>;
const std::list<field>& fields = request.m_header_info.m_etc_fields;
const auto auth = boost::find_if(fields, [] (const field& value) {
return boost::equals(client_auth_field, value.first, ascii_iequal);
});
bool is_stale = false;
if (auth != fields.end())
{
++(user->counter);
switch (auth_message::verify(request.m_http_method_str, auth->second, *user))
{
case auth_message::kPass:
return boost::none;
case auth_message::kStale:
is_stale = true;
break;
default:
case auth_message::kFail:
break;
}
}
user->counter = 0;
{
std::array<std::uint8_t, 16> rand_128bit{{}};
crypto::rand(rand_128bit.size(), rand_128bit.data());
user->nonce = string_encoding::base64_encode(rand_128bit.data(), rand_128bit.size());
}
return create_digest_response(user->nonce, is_stale);
}
http_client_auth::http_client_auth(login credentials)
: user(session{std::move(credentials)}) {
}
http_client_auth::status http_client_auth::do_handle_401(const http_response_info& response)
{
assert(user);
const bool first_auth = (user->counter == 0);
user->server = auth_message::extract(response, first_auth);
if (user->server.generator)
{
user->counter = 0;
return kSuccess;
}
return first_auth ? kParseFailure : kBadPassword;
}
boost::optional<std::pair<std::string, std::string>> http_client_auth::do_get_auth_field(
const boost::string_ref method, const boost::string_ref uri)
{
assert(user);
if (user->server.generator)
{
++(user->counter);
return std::make_pair(std::string(client_auth_field), user->server.generator(*user, method, uri));
}
return boost::none;
}
}
}
}

341
contrib/epee/src/mlog.cpp Normal file
View File

@@ -0,0 +1,341 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Andrey N. Sabelnikov nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#ifndef _MLOG_H_
#define _MLOG_H_
#include <atomic>
#include "misc_log_ex.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "logging"
#define MLOG_BASE_FORMAT "%datetime{%Y-%M-%d %H:%m:%s.%g}\t%thread\t%level\t%logger\t%loc\t%msg"
#define MLOG_LOG(x) CINFO(el::base::Writer,el::base::DispatchAction::FileOnlyLog,MONERO_DEFAULT_LOG_CATEGORY) << x
using namespace epee;
static std::string generate_log_filename(const char *base)
{
std::string filename(base);
char tmp[200];
struct tm tm;
time_t now = time(NULL);
if
#ifdef WIN32
(!gmtime_s(&tm, &now))
#else
(!gmtime_r(&now, &tm))
#endif
strcpy(tmp, "unknown");
else
strftime(tmp, sizeof(tmp), "%Y-%m-%d-%H-%M-%S", &tm);
filename += "-";
filename += tmp;
return filename;
}
std::string mlog_get_default_log_path(const char *default_filename)
{
std::string process_name = epee::string_tools::get_current_module_name();
std::string default_log_folder = epee::string_tools::get_current_module_folder();
std::string default_log_file = process_name;
std::string::size_type a = default_log_file.rfind('.');
if ( a != std::string::npos )
default_log_file.erase( a, default_log_file.size());
if ( ! default_log_file.empty() )
default_log_file += ".log";
else
default_log_file = default_filename;
return (boost::filesystem::path(default_log_folder) / boost::filesystem::path(default_log_file)).string();
}
static void mlog_set_common_prefix()
{
static const char * const expected_filename = "contrib/epee/src/mlog.cpp";
const char *path = __FILE__, *expected_ptr = strstr(path, expected_filename);
if (!expected_ptr)
return;
el::Loggers::setFilenameCommonPrefix(std::string(path, expected_ptr - path));
}
static const char *get_default_categories(int level)
{
const char *categories = "";
switch (level)
{
case 0:
categories = "*:WARNING,net:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,stacktrace:INFO,logging:INFO,msgwriter:INFO";
break;
case 1:
categories = "*:WARNING,global:INFO,stacktrace:INFO,logging:INFO,msgwriter:INFO";
break;
case 2:
categories = "*:DEBUG";
break;
case 3:
categories = "*:TRACE";
break;
case 4:
categories = "*:TRACE";
break;
default:
break;
}
return categories;
}
void mlog_configure(const std::string &filename_base, bool console)
{
el::Configurations c;
c.setGlobally(el::ConfigurationType::Filename, filename_base);
c.setGlobally(el::ConfigurationType::ToFile, "true");
const char *log_format = getenv("MONERO_LOG_FORMAT");
if (!log_format)
log_format = MLOG_BASE_FORMAT;
c.setGlobally(el::ConfigurationType::Format, log_format);
c.setGlobally(el::ConfigurationType::ToStandardOutput, console ? "true" : "false");
c.setGlobally(el::ConfigurationType::MaxLogFileSize, "104850000"); // 100 MB - 7600 bytes
el::Loggers::setDefaultConfigurations(c, true);
el::Loggers::addFlag(el::LoggingFlag::HierarchicalLogging);
el::Loggers::addFlag(el::LoggingFlag::CreateLoggerAutomatically);
el::Loggers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
el::Loggers::addFlag(el::LoggingFlag::StrictLogFileSizeCheck);
el::Helpers::installPreRollOutCallback([filename_base](const char *name, size_t){
std::string rname = generate_log_filename(filename_base.c_str());
rename(name, rname.c_str());
});
mlog_set_common_prefix();
const char *monero_log = getenv("MONERO_LOGS");
if (!monero_log)
{
monero_log = get_default_categories(0);
}
mlog_set_log(monero_log);
}
void mlog_set_categories(const char *categories)
{
el::Loggers::setCategories(categories);
MLOG_LOG("New log categories: " << categories);
}
// maps epee style log level to new logging system
void mlog_set_log_level(int level)
{
const char *categories = get_default_categories(level);
el::Loggers::setCategories(categories);
MLOG_LOG("New log categories: " << categories);
}
void mlog_set_log(const char *log)
{
long level;
char *ptr = NULL;
level = strtoll(log, &ptr, 10);
if (ptr && *ptr)
{
// we can have a default level, eg, 2,foo:ERROR
if (*ptr == ',') {
std::string new_categories = std::string(get_default_categories(level)) + ptr;
mlog_set_categories(new_categories.c_str());
}
else {
mlog_set_categories(log);
}
}
else if (level >= 0 && level <= 4)
{
mlog_set_log_level(level);
}
else
{
MERROR("Invalid numerical log level: " << log);
}
}
namespace epee
{
bool is_stdout_a_tty()
{
static std::atomic<bool> initialized(false);
static std::atomic<bool> is_a_tty(false);
if (!initialized.load(std::memory_order_acquire))
{
#if defined(WIN32)
is_a_tty.store(0 != _isatty(_fileno(stdout)), std::memory_order_relaxed);
#else
is_a_tty.store(0 != isatty(fileno(stdout)), std::memory_order_relaxed);
#endif
initialized.store(true, std::memory_order_release);
}
return is_a_tty.load(std::memory_order_relaxed);
}
void set_console_color(int color, bool bright)
{
if (!is_stdout_a_tty())
return;
switch(color)
{
case console_color_default:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE| (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;37m";
else
std::cout << "\033[0m";
#endif
}
break;
case console_color_white:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;37m";
else
std::cout << "\033[0;37m";
#endif
}
break;
case console_color_red:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;31m";
else
std::cout << "\033[0;31m";
#endif
}
break;
case console_color_green:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_GREEN | (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;32m";
else
std::cout << "\033[0;32m";
#endif
}
break;
case console_color_blue:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_BLUE | FOREGROUND_INTENSITY);//(bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;34m";
else
std::cout << "\033[0;34m";
#endif
}
break;
case console_color_cyan:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_GREEN | FOREGROUND_BLUE | (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;36m";
else
std::cout << "\033[0;36m";
#endif
}
break;
case console_color_magenta:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_BLUE | FOREGROUND_RED | (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;35m";
else
std::cout << "\033[0;35m";
#endif
}
break;
case console_color_yellow:
{
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | FOREGROUND_GREEN | (bright ? FOREGROUND_INTENSITY:0));
#else
if(bright)
std::cout << "\033[1;33m";
else
std::cout << "\033[0;33m";
#endif
}
break;
}
}
void reset_console_color() {
if (!is_stdout_a_tty())
return;
#ifdef WIN32
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
#else
std::cout << "\033[0m";
std::cout.flush();
#endif
}
}
#endif //_MLOG_H_

View File

@@ -0,0 +1,223 @@
#include "readline_buffer.h"
#include <readline/readline.h>
#include <readline/history.h>
#include <sys/select.h>
#include <unistd.h>
#include <boost/thread.hpp>
#include <boost/algorithm/string.hpp>
static void install_line_handler();
static void remove_line_handler();
static boost::mutex sync_mutex;
static rdln::linestatus line_stat;
static char *the_line;
namespace
{
rdln::readline_buffer* current = NULL;
}
rdln::suspend_readline::suspend_readline()
: m_buffer(NULL), m_restart(false)
{
m_buffer = current;
if(!m_buffer)
return;
m_restart = m_buffer->is_running();
if(m_restart)
m_buffer->stop();
}
rdln::suspend_readline::~suspend_readline()
{
if(!m_buffer)
return;
if(m_restart)
m_buffer->start();
}
std::vector<std::string>& rdln::readline_buffer::completion_commands()
{
static std::vector<std::string> commands = {"exit"};
return commands;
}
rdln::readline_buffer::readline_buffer()
: std::stringbuf(), m_cout_buf(NULL)
{
current = this;
}
void rdln::readline_buffer::start()
{
if(m_cout_buf != NULL)
return;
m_cout_buf = std::cout.rdbuf();
std::cout.rdbuf(this);
install_line_handler();
}
void rdln::readline_buffer::stop()
{
if(m_cout_buf == NULL)
return;
std::cout.rdbuf(m_cout_buf);
m_cout_buf = NULL;
remove_line_handler();
}
rdln::linestatus rdln::readline_buffer::get_line(std::string& line) const
{
boost::lock_guard<boost::mutex> lock(sync_mutex);
line_stat = rdln::partial;
rl_callback_read_char();
if (line_stat == rdln::full)
{
line = the_line;
free(the_line);
the_line = NULL;
}
return line_stat;
}
void rdln::readline_buffer::set_prompt(const std::string& prompt)
{
if(m_cout_buf == NULL)
return;
boost::lock_guard<boost::mutex> lock(sync_mutex);
rl_set_prompt(prompt.c_str());
rl_redisplay();
}
void rdln::readline_buffer::add_completion(const std::string& command)
{
if(std::find(completion_commands().begin(), completion_commands().end(), command) != completion_commands().end())
return;
completion_commands().push_back(command);
}
const std::vector<std::string>& rdln::readline_buffer::get_completions()
{
return completion_commands();
}
int rdln::readline_buffer::sync()
{
boost::lock_guard<boost::mutex> lock(sync_mutex);
#if RL_READLINE_VERSION < 0x0700
char lbuf[2] = {0,0};
char *line = NULL;
int end = 0, point = 0;
#endif
if (rl_end || *rl_prompt)
{
#if RL_READLINE_VERSION >= 0x0700
rl_clear_visible_line();
#else
line = rl_line_buffer;
end = rl_end;
point = rl_point;
rl_line_buffer = lbuf;
rl_end = 0;
rl_point = 0;
rl_save_prompt();
rl_redisplay();
#endif
}
do
{
m_cout_buf->sputc( this->sgetc() );
}
while ( this->snextc() != EOF );
#if RL_READLINE_VERSION < 0x0700
if (end || *rl_prompt)
{
rl_restore_prompt();
rl_line_buffer = line;
rl_end = end;
rl_point = point;
}
#endif
rl_on_new_line();
rl_redisplay();
return 0;
}
static void handle_line(char* line)
{
bool exit = false;
if (line)
{
line_stat = rdln::full;
the_line = line;
std::string test_line = line;
boost::trim_right(test_line);
if(!test_line.empty())
{
add_history(test_line.c_str());
history_set_pos(history_length);
if (test_line == "exit" || test_line == "q")
exit = true;
}
} else
/* EOF */
{
line_stat = rdln::empty;
exit = true;
}
rl_done = 1;
if (exit)
rl_set_prompt("");
return;
}
static char* completion_matches(const char* text, int state)
{
static size_t list_index;
static size_t len;
if(state == 0)
{
list_index = 0;
len = strlen(text);
}
const std::vector<std::string>& completions = rdln::readline_buffer::get_completions();
for(; list_index<completions.size(); )
{
const std::string& cmd = completions[list_index++];
if(cmd.compare(0, len, text) == 0)
{
return strdup(cmd.c_str());
}
}
return NULL;
}
static char** attempted_completion(const char* text, int start, int end)
{
rl_attempted_completion_over = 1;
return rl_completion_matches(text, completion_matches);
}
static void install_line_handler()
{
rl_attempted_completion_function = attempted_completion;
rl_callback_handler_install("", handle_line);
stifle_history(500);
}
static void remove_line_handler()
{
rl_replace_line("", 0);
rl_set_prompt("");
rl_redisplay();
rl_callback_handler_remove();
}

View File

@@ -0,0 +1,61 @@
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Andrey N. Sabelnikov nor the
// names of its contributors may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#include "string_tools.h"
#ifdef _WIN32
# include <winsock2.h>
#else
# include <arpa/inet.h>
# include <netinet/in.h>
#endif
namespace epee
{
namespace string_tools
{
std::string get_ip_string_from_int32(uint32_t ip)
{
in_addr adr;
adr.s_addr = ip;
const char* pbuf = inet_ntoa(adr);
if(pbuf)
return pbuf;
else
return "[failed]";
}
//----------------------------------------------------------------------------
bool get_ip_int32_from_string(uint32_t& ip, const std::string& ip_str)
{
ip = inet_addr(ip_str.c_str());
if(INADDR_NONE == ip)
return false;
return true;
}
}
}

21
contrib/fuzz_testing/fuzz.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
AFLFUZZ=$(which afl-fuzz)
if ! test -x "$AFLFUZZ"
then
echo "afl-fuzz not found - install american-fuzzy-lop"
exit 1
fi
type="$1"
if test -z "$type"
then
echo "usage: $0 block|transaction|signature|cold-outputs|cold-transaction"
exit 1
fi
case "$type" in
block|transaction|signature|cold-outputs|cold-transaction) ;;
*) echo "usage: $0 block|transaction|signature|cold-outputs|cold-transaction"; exit 1 ;;
esac
afl-fuzz -i tests/data/fuzz/$type -m 150 -t 250 -o fuzz-out/$type build/fuzz/tests/fuzz/${type}_fuzz_tests

View File

@@ -1,14 +0,0 @@
cmake_minimum_required (VERSION 2.6)
project (otshell CXX)
# Add executable
file(GLOB otshell_utils_sources # All files in directory:
"*.h"
"*.hpp"
"*.cpp"
)
add_library (otshell_utils STATIC ${otshell_utils_sources})
set_target_properties (otshell_utils PROPERTIES OUTPUT_NAME "otshell_utils")
#target_link_libraries (upnpc-static ${LDLIBS}) # to add used libs

View File

@@ -1,21 +0,0 @@
This are some files also from OpenTransactions / otshell project,
developed thanks to the awesome OpenTransaction project, organization and developers :)
Parts of code here was also developed thanks to the excellent Monero project,
thanks to Monero project, organization and developers :)
[Some] files/code here (in external/otshell_utils) are under licence defined in
src/doc/LICENCE-otshell.txt ;
Others are from monero, with licence in src/doc/LICENCE-monero.txt ;
For me (rfree) the licence seem compatbile so no problem, personally (as author of many parts of the code,
possibly not all) I do not worry who uses it how; I'am not a lawyer.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please share :-) This licence can be used e.g. for parts of code that are usable in both open-source FOSS project
Monero and Open Transactions, to share and develop both faster.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -1,116 +0,0 @@
#include "ccolor.hpp"
#include <cstdarg>
// from http://stackoverflow.com/questions/2616906/how-do-i-output-coloured-text-to-a-linux-terminal
// from http://wiznet.gr/src/ccolor.zip
// edited by rfree - as part of https://github.com/rfree/Open-Transactions/
using namespace std;
#ifdef _MSC_VER
#define snprintf c99_snprintf
inline int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap) {
int count = -1;
if (size != 0)
count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
if (count == -1)
count = _vscprintf(format, ap);
return count;
}
inline int c99_snprintf(char* str, size_t size, const char* format, ...) {
int count;
va_list ap;
va_start(ap, format);
count = c99_vsnprintf(str, size, format, ap);
va_end(ap);
return count;
}
#endif // _MSC_VER
#define CC_CONSOLE_COLOR_DEFAULT "\033[0m"
#define CC_FORECOLOR(C) "\033[" #C "m"
#define CC_BACKCOLOR(C) "\033[" #C "m"
#define CC_ATTR(A) "\033[" #A "m"
namespace zkr
{
enum Color
{
Black,
Red,
Green,
Yellow,
Blue,
Magenta,
Cyan,
White,
Default = 9
};
enum Attributes
{
Reset,
Bright,
Dim,
Underline,
Blink,
Reverse,
Hidden
};
char * cc::color(int attr, int fg, int bg)
{
static const int size = 20;
static char command[size];
/* Command is the control command to the terminal */
snprintf(command, size, "%c[%d;%d;%dm", 0x1B, attr, fg + 30, bg + 40);
return command;
}
const char *cc::console = CC_CONSOLE_COLOR_DEFAULT;
const char *cc::underline = CC_ATTR(4);
const char *cc::bold = CC_ATTR(1);
const char *cc::fore::black = CC_FORECOLOR(30);
const char *cc::fore::blue = CC_FORECOLOR(34);
const char *cc::fore::red = CC_FORECOLOR(31);
const char *cc::fore::magenta = CC_FORECOLOR(35);
const char *cc::fore::green = CC_FORECOLOR(92);
const char *cc::fore::cyan = CC_FORECOLOR(36);
const char *cc::fore::yellow = CC_FORECOLOR(33);
const char *cc::fore::white = CC_FORECOLOR(37);
const char *cc::fore::console = CC_FORECOLOR(39);
const char *cc::fore::lightblack = CC_FORECOLOR(90);
const char *cc::fore::lightblue = CC_FORECOLOR(94);
const char *cc::fore::lightred = CC_FORECOLOR(91);
const char *cc::fore::lightmagenta = CC_FORECOLOR(95);
const char *cc::fore::lightgreen = CC_FORECOLOR(92);
const char *cc::fore::lightcyan = CC_FORECOLOR(96);
const char *cc::fore::lightyellow = CC_FORECOLOR(93);
const char *cc::fore::lightwhite = CC_FORECOLOR(97);
const char *cc::back::black = CC_BACKCOLOR(40);
const char *cc::back::blue = CC_BACKCOLOR(44);
const char *cc::back::red = CC_BACKCOLOR(41);
const char *cc::back::magenta = CC_BACKCOLOR(45);
const char *cc::back::green = CC_BACKCOLOR(42);
const char *cc::back::cyan = CC_BACKCOLOR(46);
const char *cc::back::yellow = CC_BACKCOLOR(43);
const char *cc::back::white = CC_BACKCOLOR(47);
const char *cc::back::console = CC_BACKCOLOR(49);
const char *cc::back::lightblack = CC_BACKCOLOR(100);
const char *cc::back::lightblue = CC_BACKCOLOR(104);
const char *cc::back::lightred = CC_BACKCOLOR(101);
const char *cc::back::lightmagenta = CC_BACKCOLOR(105);
const char *cc::back::lightgreen = CC_BACKCOLOR(102);
const char *cc::back::lightcyan = CC_BACKCOLOR(106);
const char *cc::back::lightyellow = CC_BACKCOLOR(103);
const char *cc::back::lightwhite = CC_BACKCOLOR(107);
}

View File

@@ -1,73 +0,0 @@
// ccolor.hpp
// from http://stackoverflow.com/questions/2616906/how-do-i-output-coloured-text-to-a-linux-terminal
// from http://wiznet.gr/src/ccolor.zip
// edited by rfree - as part of https://github.com/rfree/Open-Transactions/
#ifndef INCLUDE_OT_ccolor
#define INCLUDE_OT_ccolor
#include <iostream>
#include <stdio.h>
namespace zkr
{
class cc
{
public:
class fore
{
public:
static const char *black;
static const char *blue;
static const char *red;
static const char *magenta;
static const char *green;
static const char *cyan;
static const char *yellow;
static const char *white;
static const char *console;
static const char *lightblack;
static const char *lightblue;
static const char *lightred;
static const char *lightmagenta;
static const char *lightgreen;
static const char *lightcyan;
static const char *lightyellow;
static const char *lightwhite;
};
class back
{
public:
static const char *black;
static const char *blue;
static const char *red;
static const char *magenta;
static const char *green;
static const char *cyan;
static const char *yellow;
static const char *white;
static const char *console;
static const char *lightblack;
static const char *lightblue;
static const char *lightred;
static const char *lightmagenta;
static const char *lightgreen;
static const char *lightcyan;
static const char *lightyellow;
static const char *lightwhite;
};
static char *color(int attr, int fg, int bg);
static const char *console;
static const char *underline;
static const char *bold;
};
}
#endif

View File

@@ -1,53 +0,0 @@
/* See other files here for the LICENCE that applies here. */
#ifndef INCLUDE_OT_NEWCLI_COMMON1
#define INCLUDE_OT_NEWCLI_COMMON1
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <list>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <iterator>
#include <stdexcept>
#include <functional>
#include <memory>
#include <atomic>
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include <boost/thread/lock_guard.hpp>
// list of thigs from libraries that we pull into namespace nOT::nNewcli
// we might still need to copy/paste it in few places to make IDEs pick it up correctly
#define INJECT_OT_COMMON_USING_NAMESPACE_COMMON_1 \
using std::string; \
using std::vector; \
using std::vector; \
using std::list; \
using std::set; \
using std::map; \
using std::ostream; \
using std::istream; \
using std::cin; \
using std::cerr; \
using std::cout; \
using std::cerr; \
using std::endl; \
using std::function; \
using std::unique_ptr; \
using std::shared_ptr; \
using std::weak_ptr; \
using std::enable_shared_from_this; \
using boost::lock_guard; \
#endif

View File

@@ -1,69 +0,0 @@
/* See other files here for the LICENCE that applies here. */
/* See header file .hpp for info */
#include "runoptions.hpp"
#include "lib_common1.hpp"
namespace nOT {
INJECT_OT_COMMON_USING_NAMESPACE_COMMON_1 // <=== namespaces
// (no debug - this is the default)
// +nodebug (no debug)
// +debug ...... --asdf
// +debug +debugcerr .... --asfs
// +debug +debugfile .... --asfs
cRunOptions::cRunOptions()
: mRunMode(eRunModeCurrent), mDebug(false), mDebugSendToFile(false), mDebugSendToCerr(false)
,mDoRunDebugshow(false)
{ }
vector<string> cRunOptions::ExecuteRunoptionsAndRemoveThem(const vector<string> & args) {
vector<string> arg_clear; // will store only the arguments that are not removed
for (auto arg : args) {
bool thisIsRunoption=false;
if (arg.size()>0) {
if (arg.at(0) == '+') thisIsRunoption=true;
}
if (thisIsRunoption) Exec(arg); // ***
if (! thisIsRunoption) arg_clear.push_back(arg);
}
Normalize();
return arg_clear;
}
void cRunOptions::Exec(const string & runoption) { // eg: Exec("+debug");
if (runoption == "+nodebug") { mDebug=false; }
else if (runoption == "+debug") { mDebug=true; }
else if (runoption == "+debugcerr") { mDebug=true; mDebugSendToCerr=true; }
else if (runoption == "+debugfile") { mDebug=true; mDebugSendToFile=true; }
else if (runoption == "+demo") { mRunMode=eRunModeDemo; }
else if (runoption == "+normal") { mRunMode=eRunModeNormal; }
else if (runoption == "+current") { mRunMode=eRunModeCurrent; }
else if (runoption == "+debugshow") { mDebug=true; mDebugSendToCerr=true; mDoRunDebugshow=true; }
else {
cerr << "Unknown runoption in Exec: '" << runoption << "'" << endl;
throw std::runtime_error("Unknown runoption");
}
// cerr<<"debug="<<mDebug<<endl;
}
void cRunOptions::Normalize() {
if (mDebug) {
if (!( mDebugSendToFile || mDebugSendToCerr )) mDebugSendToCerr=true; // if debug is on then send to something, e.g. to cerr
}
}
cRunOptions gRunOptions; // (extern)
} // namespace OT

View File

@@ -1,58 +0,0 @@
/* See other files here for the LICENCE that applies here. */
/*
Template for new files, replace word "template" and later delete this line here.
*/
#ifndef INCLUDE_OT_NEWCLI_runoptions_hpp
#define INCLUDE_OT_NEWCLI_runoptions_hpp
#include "lib_common1.hpp"
namespace nOT {
INJECT_OT_COMMON_USING_NAMESPACE_COMMON_1 // <=== namespaces
/** Global options to run this program main() Eg used for developer's special options like +setdemo +setdebug.
This is NOT for all the other options that are parsed and executed by program. */
class cRunOptions {
public:
enum tRunMode { ///< Type of run mode - is this normal, or demonstration etc.
eRunModeCurrent=1, ///< currently developed version
eRunModeDemo, ///< best currently available Demo of something nice
eRunModeNormal, ///< do the normal things that the program should do
};
private:
tRunMode mRunMode; ///< selected run mode
bool mDebug; // turn debug on, Eg: +debug without it probably nothing will be written to debug (maybe just error etc)
bool mDebugSendToFile; // send to file, Eg: for +debugfile ; also turns on debug
bool mDebugSendToCerr; // send to cerr, Eg: for +debugcerr ; also turns on debug
// if debug is set but not any other DebugSend* then we will default to sending to debugcerr
bool mDoRunDebugshow;
public:
tRunMode getTRunMode() const { return mRunMode; }
bool getDebug() const { return mDebug; }
bool getDebugSendToFile() const { return mDebugSendToFile; }
bool getDebugSendToCerr() const { return mDebugSendToCerr; }
bool getDoRunDebugshow() const { return mDoRunDebugshow; }
cRunOptions();
vector<string> ExecuteRunoptionsAndRemoveThem(const vector<string> & args);
void Exec(const string & runoption); // eg: Exec("+debug");
void Normalize();
};
extern cRunOptions gRunOptions;
} // namespace nOT
#endif

View File

@@ -1,806 +0,0 @@
/// @file
/// @author rfree (current maintainer in monero.cc project)
/// @brief various general utils taken from (and relate to) otshell project, including loggiang/debug
/* See other files here for the LICENCE that applies here. */
/* See header file .hpp for info */
#include <algorithm>
#include <functional>
#include <cctype>
#include <locale>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <chrono>
#include "utils.hpp"
#include "ccolor.hpp"
#include "lib_common1.hpp"
#include "runoptions.hpp"
#if defined(_WIN32) || defined(WIN32) || defined(_WIN64) || defined (WIN64)
#define OS_TYPE_WINDOWS
#elif defined(__unix__) || defined(__posix) || defined(__linux) || defined(__darwin) || defined(__APPLE__) || defined(__clang__)
#define OS_TYPE_POSIX
#else
#warning "Compiler/OS platform is not recognized. Just assuming it will work as POSIX then"
#define OS_TYPE_POSIX
#endif
#if defined(OS_TYPE_WINDOWS)
#include <windows.h>
#include <process.h>
#elif defined(OS_TYPE_POSIX)
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#else
#error "Compiler/OS platform detection failed - not supported"
#endif
namespace nOT {
namespace nUtils {
INJECT_OT_COMMON_USING_NAMESPACE_COMMON_1 // <=== namespaces
// ====================================================================
// Numerical values of the debug levels - see hpp
const int _debug_level_nr_dbg3=20;
const int _debug_level_nr_dbg2=30;
const int _debug_level_nr_dbg1=40;
const int _debug_level_nr_info=50;
const int _debug_level_nr_note=60;
const int _debug_level_nr_fact=75;
const int _debug_level_nr_mark=80;
const int _debug_level_nr_warn=90;
const int _debug_level_nr_erro=100;
// ====================================================================
myexception::myexception(const char * what)
: std::runtime_error(what)
{ }
myexception::myexception(const std::string &what)
: std::runtime_error(what)
{ }
void myexception::Report() const {
_erro("Error: " << what());
}
//myexception::~myexception() { }
// ====================================================================
// text trimming
// http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
std::string & ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun<int, int>(std::isspace))));
return s;
}
std::string & rtrim(std::string &s) {
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
return s;
}
std::string & trim(std::string &s) {
return ltrim(rtrim(s));
}
std::string get_current_time() {
std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
time_t time_now = std::chrono::system_clock::to_time_t(now);
std::chrono::high_resolution_clock::duration duration = now.time_since_epoch();
int64_t micro = std::chrono::duration_cast<std::chrono::microseconds>(duration).count();
// std::localtime() - This function may not be thread-safe.
#ifdef OS_TYPE_WINDOWS
struct tm * tm_pointer = std::localtime( &time_now ); // thread-safe on mingw-w64 (thread local variable) and on MSVC btw
// http://stackoverflow.com/questions/18551409/localtime-r-support-on-mingw
// tm_pointer points to thread-local data, memory is owned/managed by the system/library
#else
// linux, freebsd, have this
struct tm tm_object; // automatic storage duration http://en.cppreference.com/w/cpp/language/storage_duration
struct tm * tm_pointer = & tm_object; // just point to our data
auto x = localtime_r( &time_now , tm_pointer ); // modifies our own (this thread) data in tm_object, this is safe http://linux.die.net/man/3/localtime_r
if (x != tm_pointer) return "(internal error in get_current_time)"; // redundant check in case of broken implementation of localtime_r
#endif
// tm_pointer now points to proper time data, and that memory is automatically managed
if (!tm_pointer) return "(internal error in get_current_time - NULL)"; // redundant check in case of broken implementation of used library methods
std::stringstream stream;
stream << std::setfill('0')
<< std::setw(2) << tm_pointer->tm_year+1900
<< '-' << std::setw(2) << tm_pointer->tm_mon+1
<< '-' << std::setw(2) << tm_pointer->tm_mday
<< ' ' << std::setw(2) << tm_pointer->tm_hour
<< ':' << std::setw(2) << tm_pointer->tm_min
<< ':' << std::setw(2) << tm_pointer->tm_sec
<< '.' << std::setw(6) << (micro%1000000); // 6 because microseconds
return stream.str();
}
cNullstream g_nullstream; // extern a stream that does nothing (eats/discards data)
boost::recursive_mutex gLoggerGuard; // extern
std::atomic<int> gLoggerGuardDepth; // extern
std::atomic<int> & gLoggerGuardDepth_Get() {
// TODO std::once would be nicer here
static bool once=0;
if (!once) { // initialize it once
once=1;
gLoggerGuardDepth=0;
}
return gLoggerGuardDepth; // global, atomic counter
}
// ====================================================================
namespace nDetail {
const char* DbgShortenCodeFileName(const char *s) {
const char *p = s;
const char *a = s;
bool inc=1;
while (*p) {
++p;
if (inc && ('\0' != * p)) { a=p; inc=false; } // point to the current character (if valid) becasue previous one was slash
if ((*p)=='/') { a=p; inc=true; } // point at current slash (but set inc to try to point to next character)
}
return a;
}
}
// a workaround for MSVC compiler; e.g. see https://bugs.webkit.org/show_bug.cgi?format=multiple&id=125795
#ifndef _MSC_VER
template<typename T, typename ...Args>
std::unique_ptr<T> make_unique( Args&& ...args )
{
return std::unique_ptr<T>( new T( std::forward<Args>(args)... ) );
}
#else
using std::make_unique;
#endif
// ====================================================================
char cFilesystemUtils::GetDirSeparatorSys() {
// TODO nicer os detection?
#if defined(OS_TYPE_POSIX)
return '/';
#elif defined(OS_TYPE_WINDOWS)
return '\\';
#else
#error "Do not know how to compile this for your platform."
#endif
}
char cFilesystemUtils::GetDirSeparatorInter() {
return '/';
}
string cFilesystemUtils::FileInternalToSystem(const std::string &name) {
string ret;
ret.resize(name.size());
std::replace_copy(name.begin(), name.end(), ret.begin(),
GetDirSeparatorInter() , GetDirSeparatorSys());
return ret;
}
string cFilesystemUtils::FileSystemToInternal(const std::string &name) {
string ret;
ret.reserve(name.size());
std::replace_copy(name.begin(), name.end(), ret.begin(),
GetDirSeparatorSys() , GetDirSeparatorInter());
return ret;
}
bool cFilesystemUtils::CreateDirTree(const std::string & dir, bool only_below) {
const bool dbg=false;
//struct stat st;
const char dirchS = cFilesystemUtils::GetDirSeparatorSys();
const char dirchI = cFilesystemUtils::GetDirSeparatorInter();
std::istringstream iss(dir);
string partI; // current par is in internal format (though it should not matter since it doesn't contain any slashes). eg "bar"
string sofarS=""; // sofarS - the so far created dir part is in SYSTEM format. eg "foo/bar"
if (dir.size()<1) return false; // illegal name
// dir[0] is valid from here
if ( only_below && ((dir[0]==dirchS) || (dir[0]==dirchI))) return false; // no jumping to top (on any os)
while (getline(iss,partI,dirchI)) { // get new component eg "bar" into part
if (dbg) cout << '['<<partI<<']' << endl;
sofarS += partI;
if (partI.size()<1) return false; // bad format?
if ((only_below) && (partI=="..")) return false; // trying to go up
if (dbg) cout << "test ["<<sofarS<<"]"<<endl;
// TODO nicer os detection?
#if defined(OS_TYPE_POSIX)
struct stat st;
bool exists = stat(sofarS.c_str() ,&st) == 0; // *
if (exists) {
if (! S_ISDIR(st.st_mode)) {
// std::cerr << "This exists, but as a file: [" << sofar << "]" << (size_t)st.st_ino << endl;
return false; // exists but is a file nor dir
}
}
#elif defined(OS_TYPE_WINDOWS)
DWORD dwAttrib = GetFileAttributesA(sofarS.c_str());
bool exists = (dwAttrib != INVALID_FILE_ATTRIBUTES && (dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
#else
#error "Do not know how to compile this for your platform."
#endif
if (!exists) {
if (dbg) cout << "mkdir ["<<sofarS<<"]"<<endl;
#if defined(OS_TYPE_POSIX)
bool ok = 0== mkdir(sofarS.c_str(), 0700); // ***
#elif defined(OS_TYPE_WINDOWS)
bool ok = (bool) CreateDirectoryA(sofarS.c_str(), NULL); // TODO use -W() after conversion to unicode UTF16
#else
#error "Do not know how to compile this for your platform."
#endif
if (!ok) return false;
}
sofarS += dirchS;
}
return true;
}
// ====================================================================
namespace nDetail {
struct channel_use_info { ///< feedback information about using (e.g. opening) given debug channel - used internally by logging system
/// TODO not yet used in code
/// e.g. used to write into channel net/in/all that given message was a first logged message from never-before-logged thread or PID etc
bool m_was_interesting; ///< anything interesting happened when using the channel?
std::vector<std::string> m_extra_msg; ///< any additional messages about this channel use
};
cDebugScopeGuard::cDebugScopeGuard() : mLevel(-1) {
}
cDebugScopeGuard::~cDebugScopeGuard() {
if (mLevel != -1) {
gCurrentLogger.write_stream(mLevel,mChan) << mMsg << " ... end" << gCurrentLogger.endline() << std::flush;
}
}
void cDebugScopeGuard::Assign(const string &chan, const int level, const string &msg) {
mChan=chan;
mLevel=level;
mMsg=msg;
}
} // namespace nDetail
// ====================================================================
cLogger::cLogger() :
mStream(NULL),
mStreamBrokenDebug(NULL),
mIsBroken(true), // before constructor finishes
mLevel(_debug_level_nr_warn),
mThread2Number_Biggest(0), // the CURRENT biggest value (no thread yet in map)
mPid2Number_Biggest(0)
{
mStream = & std::cout;
mStreamBrokenDebug = & std::cerr; // the backup stream
*mStreamBrokenDebug << "Creating the logger system" << endl;
mIsBroken=false; // ok, constr. succeeded, so string is not broken now
// this is here, because it could be using logging itself to log creation of first thread/PID etc
Thread2Number( boost::this_thread::get_id() ); // convert current id to short number, useful to reserve a number so that main thread is usually called 1
Pid2Number( getpid() ); // add this proces ID as first one
}
cLogger::~cLogger() {
for (auto pair : mChannels) {
std::ofstream *ptr = pair.second;
delete ptr;
pair.second=NULL;
}
}
void cLogger::SetStreamBroken() {
SetStreamBroken("(no additional details about this problem)");
}
void cLogger::SetStreamBroken(const std::string &msg) {
_dbg_dbg("Stream is broken (msg: " << msg << ")");
if (!mIsBroken) { // if not already marked as broken
_dbg_dbg("(It was not broken before)");
std::cerr << OT_CODE_STAMP << "WARNING: due to a problem in the debug/logging system itself ("<<msg<<") - we are switching back to fallback stream (e.g. cerr)" << std::endl;
if (mStreamBrokenDebug == nullptr) {
std::cerr << OT_CODE_STAMP << " ERROR: in addition, while reporting this problem, mStreamBrokenDebug stream is NULL: " << mStreamBrokenDebug << std::endl;
} else {
(*mStreamBrokenDebug) << OT_CODE_STAMP << "WARNING: due to debug stream problem ("<<msg<<") - switching back to fallback stream (e.g. cerr)" << std::endl;
}
mIsBroken = true;
}
}
std::ostream & cLogger::write_stream(int level) {
return write_stream(level,"");
}
std::ostream & cLogger::write_stream(int level, const std::string & channel ) {
_dbg_dbg("level="<<level<<" channel="<<channel);
if (level >= mLevel) {
if (mStream) { // TODO now disabling mStream also disables writting to any channel
_dbg_dbg("Selecting output...");
ostream & output = SelectOutput(level,channel);
_dbg_dbg("Selecting output... done, output=" << (void*)(&output));
#if defined(OS_TYPE_WINDOWS)
output << windows_stream(level);
#endif
output << icon(level) << ' ';
boost::thread::id this_id = boost::this_thread::get_id();
output << "{" << Thread2Number(this_id) << "}";
auto nicePid = Pid2Number(getpid());
if (nicePid>0) output << " {p" << nicePid << "}";
output << ' ';
return output; // <--- return
} else _dbg_dbg("Not writting: No mStream");
} else _dbg_dbg("Not writting: Too low level level="<<level<<" not >= mLevel="<<mLevel);
return g_nullstream;
}
std::string cLogger::GetLogBaseDir() const {
return "log";
}
void cLogger::OpenNewChannel(const std::string & channel) noexcept {
try {
_dbg_dbg("Openning channel for channel="<<channel);
OpenNewChannel_(channel);
}
catch (const std::exception &except) {
SetStreamBroken(OT_CODE_STAMP + " Got exception when opening debug channel: " + ToStr(except.what()));
}
catch (...) {
SetStreamBroken(OT_CODE_STAMP + " Got not-standard exception when opening debug channel.");
}
}
void cLogger::OpenNewChannel_(const std::string & channel) { // channel=="net/sleep"
_dbg_dbg("Openning channel for channel="<<channel);
size_t last_split = channel.find_last_of(cFilesystemUtils::GetDirSeparatorInter());
string fname_system; // the full file name in system format
if (last_split==string::npos) { // The channel name has no directory, eg channel=="test"
string dir = GetLogBaseDir();
string basefile = channel + ".log";
string fname = dir + cFilesystemUtils::GetDirSeparatorInter() + basefile;
fname_system = cFilesystemUtils::FileInternalToSystem(fname); // <-
}
else { // there is a directory eg channel=="net/sleep"
// net/sleep
// ^----- last_split
string dir = GetLogBaseDir() + cFilesystemUtils::GetDirSeparatorInter() + channel.substr(0, last_split);
string basefile = channel.substr(last_split+1) + ".log";
string fname = dir + cFilesystemUtils::GetDirSeparatorInter() + basefile;
fname_system = cFilesystemUtils::FileInternalToSystem(fname); // <-
bool dirok = cFilesystemUtils::CreateDirTree(dir);
if (!dirok) { string err = "In logger failed to open directory (" + dir +") for channel (" + channel +")"; throw std::runtime_error(err); }
}
_dbg_dbg("Openning fname_system="<<fname_system);
std::ofstream * thefile = new std::ofstream( fname_system.c_str() ); // file system
*thefile << "====== Log opened: " << fname_system << " (in " << ((void*)thefile) << ") ======" << endl;
// cerr << "====== Log opened: " << fname_system << " (in " << ((void*)thefile) << ") ======" << endl;
_dbg_dbg( "====== Log opened: " << fname_system << " (in " << ((void*)thefile) << ") ======" );
mChannels.insert( std::pair<string,std::ofstream*>(channel , thefile ) ); // <- created the channel mapping
}
std::ostream & cLogger::SelectOutput(int level, const std::string & channel) noexcept {
try {
if (mIsBroken) {
_dbg_dbg("The stream is broken mIsBroken="<<mIsBroken<<" so will return backup stream");
return *mStreamBrokenDebug;
}
if (channel=="") {
_dbg_dbg("No channel given (channel="<<channel<<") so will return main stream");
return *mStream;
}
auto obj = mChannels.find(channel);
if (obj == mChannels.end()) { // not found - need to make new channel
_dbg_dbg("No stream openened for channel="<<channel<<" so will create it now");
OpenNewChannel(channel); // <- create channel
obj = mChannels.find(channel); // find again
if (obj == mChannels.end()) { // still not found! something is wrong
SetStreamBroken( OT_CODE_STAMP + " WARNING: can not get stream for channel="+ToStr(channel)+" level="+ToStr(channel) );
return *mStreamBrokenDebug;
}
}
auto the_stream_ptr = obj->second;
_dbg_dbg("Found the stream file for channel="<<channel<<" as the_stream_ptr="<<the_stream_ptr);
ASRT(the_stream_ptr);
return *the_stream_ptr; // <--- RETURN
}
catch (std::exception &except) {
SetStreamBroken( OT_CODE_STAMP + " Got exception: " + ToStr(except.what()) );
_dbg_dbg("Exception! Returning broken stream");
return *mStreamBrokenDebug;
}
catch (...) {
SetStreamBroken( OT_CODE_STAMP + " Got not-standard exception.");
_dbg_dbg("Exception! Returning broken stream");
return *mStreamBrokenDebug;
}
// dead code
}
void cLogger::setOutStreamFile(const string &fname) { // switch to using this file
_mark("WILL SWITCH DEBUG NOW to file: " << fname);
mOutfile = make_unique<std::ofstream>(fname);
mStream = & (*mOutfile);
_mark("Started new debug, to file: " << fname);
}
void cLogger::setOutStreamFromGlobalOptions() {
if ( gRunOptions.getDebug() ) {
if ( gRunOptions.getDebugSendToFile() ) {
mOutfile = make_unique<std::ofstream> ("debuglog.txt");
mStream = & (*mOutfile);
}
else if ( gRunOptions.getDebugSendToCerr() ) {
mStream = & std::cerr;
}
else {
mStream = & g_nullstream;
}
}
else {
mStream = & g_nullstream;
}
}
void cLogger::setDebugLevel(int level) {
bool note_before = (mLevel > level); // report the level change before or after the change? (on higher level)
if (note_before) _note("Setting debug level to "<<level);
mLevel = level;
if (!note_before) _note("Setting debug level to "<<level);
}
std::string cLogger::icon(int level) const {
// TODO replan to avoid needles converting back and forth char*, string etc
using namespace zkr;
#if defined(OS_TYPE_POSIX)
if (level >= 100) return cc::back::lightred + ToStr(cc::fore::lightyellow) + ToStr("ERROR ") + ToStr(cc::fore::lightyellow) + " " ;
if (level >= 90) return cc::back::lightyellow + ToStr(cc::fore::black) + ToStr("Warn ") + ToStr(cc::fore::red)+ " " ;
if (level >= 80) return cc::back::lightmagenta + ToStr(cc::fore::black) + ToStr("MARK "); //+ zkr::cc::console + ToStr(cc::fore::lightmagenta)+ " ";
if (level >= 75) return cc::back::lightyellow + ToStr(cc::fore::black) + ToStr("FACT ") + zkr::cc::console + ToStr(cc::fore::lightyellow)+ " ";
if (level >= 70) return cc::fore::green + ToStr("Note ");
if (level >= 50) return cc::fore::cyan + ToStr("info ");
if (level >= 40) return cc::fore::lightwhite + ToStr("dbg ");
if (level >= 30) return cc::fore::lightblue + ToStr("dbg ");
if (level >= 20) return cc::fore::blue + ToStr("dbg ");
#elif defined(OS_TYPE_WINDOWS)
if (level >= 100) return ToStr("ERROR ");
if (level >= 90) return ToStr("Warn ");
if (level >= 80) return ToStr("MARK ");
if (level >= 75) return ToStr("FACT ");
if (level >= 70) return ToStr("Note ");
if (level >= 50) return ToStr("info ");
if (level >= 40) return ToStr("dbg ");
if (level >= 30) return ToStr("dbg ");
if (level >= 20) return ToStr("dbg ");
#endif
return " ";
}
std::string cLogger::endline() const {
#if defined(OS_TYPE_POSIX)
return ToStr("") + zkr::cc::console + ToStr("\n"); // TODO replan to avoid needles converting back and forth char*, string etc
#elif defined(OS_TYPE_WINDOWS)
return ToStr("\n");
#endif
}
int cLogger::Thread2Number(const boost::thread::id id) {
auto found = mThread2Number.find( id );
if (found == mThread2Number.end()) { // new one
mThread2Number_Biggest++;
mThread2Number[id] = mThread2Number_Biggest;
_info_c("dbg/main", "This is a new thread (used in debug), thread id="<<id); // can cause some recursion
return mThread2Number_Biggest;
} else {
return mThread2Number[id];
}
}
int cLogger::Pid2Number(const t_anypid id) {
auto found = mPid2Number.find( id );
if (found == mPid2Number.end()) { // new one
mPid2Number_Biggest++;
mPid2Number[id] = mPid2Number_Biggest;
_info_c("dbg/main", "This is a new process (used in debug), process pid="<<id); // can cause some recursion
return mPid2Number_Biggest;
} else {
return mPid2Number[id];
}
}
// ====================================================================
// object gCurrentLogger is defined later - in global namespace below
// ====================================================================
// vector debug
void DisplayStringEndl(std::ostream & out, const std::string text) {
out << text;
out << std::endl;
}
std::string SpaceFromEscape(const std::string &s) {
std::ostringstream newStr;
for(size_t i = 0; i < s.length();i++) {
if(s[i] == '\\' && s[i+1] ==32)
newStr<<"";
else
newStr<<s[i];
}
return newStr.str();
}
std::string EscapeFromSpace(const std::string &s) {
std::ostringstream newStr;
for(size_t i = 0; i < s.length();i++) {
if(s[i] == 32)
newStr << "\\" << " ";
else
newStr << s[i];
}
return newStr.str();
}
std::string EscapeString(const std::string &s) {
std::ostringstream newStr;
for(size_t i = 0; i < s.length();i++) {
if(s[i] >=32 && s[i] <= 126)
newStr<<s[i];
else
newStr<<"\\"<< (int) s[i];
}
return newStr.str();
}
bool CheckIfBegins(const std::string & beggining, const std::string & all) {
if (all.compare(0, beggining.length(), beggining) == 0) {
return 1;
}
else {
return 0;
}
}
bool CheckIfEnds (std::string const & ending, std::string const & all){
if (all.length() >= ending.length()) {
return (0 == all.compare (all.length() - ending.length(), ending.length(), ending));
} else {
return false;
}
}
vector<string> WordsThatMatch(const std::string & sofar, const vector<string> & possib) {
vector<string> ret;
for ( auto rec : possib) { // check of possibilities
if (CheckIfBegins(sofar,rec)) {
rec = EscapeFromSpace(rec);
ret.push_back(rec); // this record matches
}
}
return ret;
}
char GetLastChar(const std::string & str) { // TODO unicode?
auto s = str.length();
if (s==0) throw std::runtime_error("Getting last character of empty string (" + ToStr(s) + ")" + OT_CODE_STAMP);
return str.at( s - 1);
}
std::string GetLastCharIf(const std::string & str) { // TODO unicode?
auto s = str.length();
if (s==0) return ""; // empty string signalizes ther is nothing to be returned
return std::string( 1 , str.at( s - 1) );
}
// ====================================================================
// ASRT - assert. Name like ASSERT() was too long, and ASS() was just... no.
// Use it like this: ASRT( x>y ); with the semicolon at end, a clever trick forces this syntax :)
void Assert(bool result, const std::string &stamp, const std::string &condition) {
if (!result) {
_erro("Assert failed at "+stamp+": ASSERT( " << condition << ")");
throw std::runtime_error("Assert failed at "+stamp+": ASSERT( " + condition + ")");
}
}
// ====================================================================
// advanced string
const std::string GetMultiline(string endLine) {
std::string result(""); // Taken from OT_CLI_ReadUntilEOF
while (true) {
std::string input_line("");
if (std::getline(std::cin, input_line, '\n'))
{
input_line += "\n";
if (input_line[0] == '~')
break;
result += input_line;
}
if (std::cin.eof() )
{
std::cin.clear();
break;
}
if (std::cin.fail() )
{
std::cin.clear();
break;
}
if (std::cin.bad())
{
std::cin.clear();
break;
}
}
return result;
}
vector<string> SplitString(const string & str){
std::istringstream iss(str);
vector<string> vec { std::istream_iterator<string>{iss}, std::istream_iterator<string>{} };
return vec;
}
bool checkPrefix(const string & str, char prefix) {
if (str.at(0) == prefix)
return true;
return false;
}
// ====================================================================
// operation on files
#ifdef __unix
void cEnvUtils::GetTmpTextFile() {
// TODO make this name configurable (depending on project)
char filename[] = "/tmp/otshellutils_text.XXXXXX";
fd = mkstemp(filename);
if (fd == -1) {
_erro("Can't create the file: " << filename);
return;
}
mFilename = filename;
}
void cEnvUtils::CloseFile() {
close(fd);
unlink( mFilename.c_str() );
}
void cEnvUtils::OpenEditor() {
char* editor = std::getenv("OT_EDITOR"); //TODO Read editor from configuration file
if (editor == NULL)
editor = std::getenv("VISUAL");
if (editor == NULL)
editor = std::getenv("EDITOR");
string command;
if (editor != NULL)
command = ToStr(editor) + " " + mFilename;
else
command = "/usr/bin/editor " + mFilename;
_dbg3("Opening editor with command: " << command);
if ( system( command.c_str() ) == -1 )
_erro("Cannot execute system command: " << command);
}
const string cEnvUtils::ReadFromTmpFile() {
std::ifstream ifs(mFilename);
string msg((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
return msg;
}
const string cEnvUtils::Compose() {
GetTmpTextFile();
OpenEditor();
string input = ReadFromTmpFile();
CloseFile();
return input;
}
#endif
const string cEnvUtils::ReadFromFile(const string path) {
std::ifstream ifs(path);
string msg((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
return msg;
}
void hintingToTxt(std::fstream & file, string command, vector<string> &commands) {
if(file.good()) {
file<<command<<"~"<<endl;
for (auto a: commands) {
file <<a<< " ";
file.flush();
}
file<<endl;
}
}
string stringToColor(const string &hash) {
// Generete vector with all possible light colors
vector <string> lightColors;
using namespace zkr;
lightColors.push_back(cc::fore::lightblue);
lightColors.push_back(cc::fore::lightred);
lightColors.push_back(cc::fore::lightmagenta);
lightColors.push_back(cc::fore::lightgreen);
lightColors.push_back(cc::fore::lightcyan);
lightColors.push_back(cc::fore::lightyellow);
lightColors.push_back(cc::fore::lightwhite);
int sum=0;
for (auto ch : hash) sum+=ch;
auto color = sum%(lightColors.size()-1);
return lightColors.at( color );
}
// ====================================================================
// algorthms
} // namespace nUtil
} // namespace OT
// global namespace
const extern int _dbg_ignore = 0; // see description in .hpp
std::string GetObjectName() {
//static std::string * name=nullptr;
//if (!name) name = new std::string("(global)");
return "";
}
// ====================================================================
nOT::nUtils::cLogger gCurrentLogger;

View File

@@ -1,532 +0,0 @@
/// @file
/// @author rfree (current maintainer in monero.cc project)
/// @brief various general utils taken from (and relate to) otshell project, including loggiang/debug
/* See other files here for the LICENCE that applies here. */
#include "ccolor.hpp"
#ifndef INCLUDE_OT_NEWCLI_UTILS
#define INCLUDE_OT_NEWCLI_UTILS
#include "lib_common1.hpp"
#ifdef __unix
#include <unistd.h>
#endif
#if defined(_WIN32)
#include"windows_stream.h"
#endif
#ifndef CFG_WITH_TERMCOLORS
//#error "You requested to turn off terminal colors (CFG_WITH_TERMCOLORS), however currently they are hardcoded (this option to turn them off is not yet implemented)."
#endif
///Macros related to automatic deduction of class name etc;
#define MAKE_CLASS_NAME(NAME) private: static std::string GetObjectName() { return #NAME; }
#define MAKE_STRUCT_NAME(NAME) private: static std::string GetObjectName() { return #NAME; } public:
// define this to debug the debug system itself:
// #define opt_debug_debug
#ifdef opt_debug_debug
#define _dbg_dbg(X) do { std::cerr<<"_dbg_dbg: " << OT_CODE_STAMP << " {thread=" << boost::this_thread::get_id()<<"} " \
<< " {pid="<<getpid()<<"} " << ": " << X << std::endl; } while(0)
#else
#define _dbg_dbg(X) do { } while(0)
#endif
namespace nOT {
namespace nUtils {
/// @brief general based for my runtime errors
class myexception : public std::runtime_error {
public:
myexception(const char * what);
myexception(const std::string &what);
//virtual ~myexception();
virtual void Report() const;
};
/// @macro Use this macro INJECT_OT_COMMON_USING_NAMESPACE_COMMON_1 as a shortcut for various using std::string etc.
INJECT_OT_COMMON_USING_NAMESPACE_COMMON_1 // <=== namespaces
// ======================================================================================
/// text trimming functions (they do mutate the passes string); they trim based on std::isspace. also return it's reference again
/// http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
std::string & trim(std::string &s); ///< trim text http://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
std::string & ltrim(std::string &s); ///< left trim
std::string & rtrim(std::string &s); ///< right trim
// ======================================================================================
std::string get_current_time();
// string conversions
template <class T>
std::string ToStr(const T & obj) {
std::ostringstream oss;
oss << obj;
return oss.str();
}
struct cNullstream : std::ostream {
cNullstream() : std::ios(0), std::ostream(0) {}
};
extern cNullstream g_nullstream; // a stream that does nothing (eats/discards data)
// ========== debug ==========
// _dbg_ignore is moved to global namespace (on purpose)
// TODO make _dbg_ignore thread-safe everywhere
extern boost::recursive_mutex gLoggerGuard; // the mutex guarding logging/debugging code e.g. protecting streams, files, etc
std::atomic<int> & gLoggerGuardDepth_Get(); // getter for the global singleton of counter (it guarantees initializing it to 0). This counter shows the current recursion (re-entrant) level of debug macros.
// TODO more debug of the debug system:
// detect lock() error e.g. recursive limit
// detect stream e.g. operator<< error
#define _debug_level(LEVEL,VAR) do { if (_dbg_ignore< LEVEL) { \
_dbg_dbg("WRITE DEBUG: LEVEL="<<LEVEL<<" VAR: " << VAR ); \
auto level=LEVEL; short int part=0; \
try { \
boost::lock_guard<boost::recursive_mutex> mutex_guard( nOT::nUtils::gLoggerGuard ); \
part=1; \
try { \
++nOT::nUtils::gLoggerGuardDepth_Get(); \
/* int counter = nOT::nUtils::gLoggerGuardDepth_Get(); if (counter!=1) gCurrentLogger.write_stream(100,"")<<"DEBUG-ERROR: recursion, counter="<<counter<<gCurrentLogger.endline(); */ \
gCurrentLogger.write_stream(LEVEL,"") << nOT::nUtils::get_current_time() << ' ' << OT_CODE_STAMP << ' ' << VAR << gCurrentLogger.endline() << std::flush; \
part=9; \
} catch(...) { \
gCurrentLogger.write_stream(std::max(level,90),"") << nOT::nUtils::get_current_time() << ' ' << OT_CODE_STAMP << ' ' << "(ERROR IN DEBUG)" << gCurrentLogger.endline(); \
--nOT::nUtils::gLoggerGuardDepth_Get(); throw ; \
} \
--nOT::nUtils::gLoggerGuardDepth_Get(); \
} catch(...) { if (part<8) gCurrentLogger.write_stream(100,"")<<"DEBUG-ERROR: problem in debug mechanism e.g. in locking." <<gCurrentLogger.endline(); throw ; } \
} } while(0)
// info for code below: oss object is normal stack variable, using it does not need lock protection
#define _debug_level_c(CHANNEL,LEVEL,VAR) do { if (_dbg_ignore< LEVEL) { \
_dbg_dbg("WRITE DEBUG: LEVEL="<<LEVEL<<" CHANNEL="<<CHANNEL<<" VAR: " << VAR ); \
auto level=LEVEL; short int part=0; \
try { \
boost::lock_guard<boost::recursive_mutex> mutex_guard( nOT::nUtils::gLoggerGuard ); \
part=1; \
try { \
++nOT::nUtils::gLoggerGuardDepth_Get(); \
std::ostringstream oss; \
oss << nOT::nUtils::get_current_time() << ' ' << OT_CODE_STAMP << ' ' << VAR << gCurrentLogger.endline() << std::flush; \
std::string as_string = oss.str(); \
_dbg_dbg("START will write to log LEVEL="<<LEVEL<<" to CHANNEL="<<CHANNEL<<" as_string="<<as_string); \
/* int counter = nOT::nUtils::gLoggerGuardDepth_Get(); if (counter!=1) gCurrentLogger.write_stream(100,"")<<"DEBUG-ERROR: recursion, counter="<<counter<<gCurrentLogger.endline(); */ \
gCurrentLogger.write_stream(LEVEL,"" ) << as_string << gCurrentLogger.endline() << std::flush; \
gCurrentLogger.write_stream(LEVEL,CHANNEL) << as_string << gCurrentLogger.endline() << std::flush; \
_dbg_dbg("DONE will write to log LEVEL="<<LEVEL<<" to CHANNEL="<<CHANNEL<<" as_string="<<as_string); \
part=9; \
} catch(...) { \
gCurrentLogger.write_stream(std::max(level,90),CHANNEL) << nOT::nUtils::get_current_time() << ' ' << OT_CODE_STAMP << ' ' << "(ERROR IN DEBUG)" << gCurrentLogger.endline(); \
--nOT::nUtils::gLoggerGuardDepth_Get(); throw ; \
} \
--nOT::nUtils::gLoggerGuardDepth_Get(); \
} catch(...) { if (part<8) gCurrentLogger.write_stream(100,CHANNEL)<<"DEBUG-ERROR: problem in debug mechanism e.g. in locking." <<gCurrentLogger.endline(); throw ; } \
} } while(0)
// Numerical values of the debug levels - are defined here as const ints. Full name (with namespace) given for clarity.
extern const int _debug_level_nr_dbg3;
extern const int _debug_level_nr_dbg2;
extern const int _debug_level_nr_dbg1;
extern const int _debug_level_nr_info;
extern const int _debug_level_nr_note;
extern const int _debug_level_nr_fact;
extern const int _debug_level_nr_mark;
extern const int _debug_level_nr_warn;
extern const int _debug_level_nr_erro;
#define _dbg3(VAR) _debug_level( nOT::nUtils::_debug_level_nr_dbg3,VAR) // details - most detailed
#define _dbg2(VAR) _debug_level( nOT::nUtils::_debug_level_nr_dbg2,VAR) // details - a bit more important
#define _dbg1(VAR) _debug_level( nOT::nUtils::_debug_level_nr_dbg1,VAR) // details - more important
#define _info(VAR) _debug_level( nOT::nUtils::_debug_level_nr_info,VAR) // information
#define _note(VAR) _debug_level( nOT::nUtils::_debug_level_nr_note,VAR) // more interesting information
#define _fact(VAR) _debug_level( nOT::nUtils::_debug_level_nr_fact,VAR) // interesting events that could be interesting even for user, for logical/business things
#define _mark(VAR) _debug_level( nOT::nUtils::_debug_level_nr_mark,VAR) // marked actions
#define _warn(VAR) _debug_level( nOT::nUtils::_debug_level_nr_warn,VAR) // some problems
#define _erro(VAR) _debug_level( nOT::nUtils::_debug_level_nr_erro,VAR) // errors
#define _dbg3_c(C,VAR) _debug_level_c(C, nOT::nUtils::_debug_level_nr_dbg3, VAR) // details - most detailed
#define _dbg2_c(C,VAR) _debug_level_c(C, nOT::nUtils::_debug_level_nr_dbg2, VAR) // details - a bit more important
#define _dbg1_c(C,VAR) _debug_level_c(C, nOT::nUtils::_debug_level_nr_dbg1, VAR) // details - more important
#define _info_c(C,VAR) _debug_level_c(C, nOT::nUtils::_debug_level_nr_info, VAR) // information
#define _note_c(C,VAR) _debug_level_c(C, nOT::nUtils::_debug_level_nr_note, VAR) // more interesting information
#define _fact_c(C,VAR) _debug_level_c(C, nOT::nUtils::_debug_level_nr_fact, VAR) // interesting events that could be interesting even for user, for logical/business things
#define _mark_c(C,VAR) _debug_level_c(C, nOT::nUtils::_debug_level_nr_mark, VAR) // marked actions
#define _warn_c(C,VAR) _debug_level_c(C, nOT::nUtils::_debug_level_nr_warn, VAR) // some problems
#define _erro_c(C,VAR) _debug_level_c(C, nOT::nUtils::_debug_level_nr_erro, VAR) // errors
// lock // because of VAR
#define _scope_debug_level_c(CHANNEL,LEVEL,VAR) \
std::ostringstream debug_detail_oss; \
nOT::nUtils::gLoggerGuard.lock(); \
debug_detail_oss << OT_CODE_STAMP << ' ' << VAR ; \
nOT::nUtils::nDetail::cDebugScopeGuard debugScopeGuard; \
if (_dbg_ignore<LEVEL) debugScopeGuard.Assign(CHANNEL,LEVEL, debug_detail_oss.str()); \
if (_dbg_ignore<LEVEL) _debug_level_c(CHANNEL,LEVEL,debug_detail_oss.str() + " ... begin"); \
nOT::nUtils::gLoggerGuard.unlock();
#define _scope_debug_level(LEVEL,VAR) _scope_debug_level_c("",LEVEL,VAR)
#define _scope_dbg1(VAR) _scope_debug_level( _debug_level_nr_dbg3, VAR)
#define _scope_dbg2(VAR) _scope_debug_level( _debug_level_nr_dbg2, VAR)
#define _scope_dbg3(VAR) _scope_debug_level( _debug_level_nr_dbg1, VAR)
#define _scope_info(VAR) _scope_debug_level( _debug_level_nr_info, VAR)
#define _scope_note(VAR) _scope_debug_level( _debug_level_nr_note, VAR)
#define _scope_fact(VAR) _scope_debug_level( _debug_level_nr_fact, VAR)
#define _scope_mark(VAR) _scope_debug_level( _debug_level_nr_mark, VAR)
#define _scope_warn(VAR) _scope_debug_level( _debug_level_nr_warn, VAR)
#define _scope_erro(VAR) _scope_debug_level( _debug_level_nr_erro, VAR)
/***
@brief do not use this namespace directly, it is implementation detail.
*/
namespace nDetail {
/***
@brief a Debug scope-guard, to log a debug message when current scope is left. Do NOT use this directly,
only use it via the macros like _scope_dbg1 etc.
*/
class cDebugScopeGuard {
protected:
string mMsg;
int mLevel;
string mChan;
public:
cDebugScopeGuard();
~cDebugScopeGuard();
void Assign(const string &chan, const int level, const string &msg);
};
const char* DbgShortenCodeFileName(const char *s); ///< Returns a pointer to some part of the string that was given, skipping directory names, for log/debug
} // namespace nDetail
// ========== logger ==========
namespace nDetail {
struct channel_use_info;
} // namespace nDetail
/***
@brief Class to write debug into. Used it by calling the debug macros _dbg1(...) _info(...) _erro(...) etc, NOT directly!
@author rfree (maintainer)
@thread this class is NOT thread safe and must used only by one thread at once (use it via ot_debug_macros like _info macro they do proper locking)
*/
class cLogger {
public:
cLogger();
~cLogger();
std::ostream & write_stream(int level); ///< starts a new message on given level (e.g. writes out the icon/tag) and returns stream to output to
std::ostream & write_stream(int level, const std::string & channel); ///< the same but with name of the debug channel
void setOutStreamFromGlobalOptions(); // set debug level, file etc - according to global Options
void setOutStreamFile(const std::string &fname); // switch to using this file
void setDebugLevel(int level); // change the debug level e.g. to mute debug from now
std::string icon(int level) const; ///< returns "icon" for given debug level. It is text, might include color controll characters
std::string endline() const; ///< returns string to be written at end of message
protected:
typedef long int t_anypid; // a portable representation of PID. long int should cover all platforms
void SetStreamBroken(); ///< call in case of internal error in logger (e.g. can not open a file)
void SetStreamBroken(const std::string &msg); ///< same but with error message
unique_ptr<std::ofstream> mOutfile;
std::ostream * mStream; ///< pointing only! can point to our own mOutfile, or maye to global null stream
std::ostream * mStreamBrokenDebug; ///< pointing only! this is a pointer to some stream that should be used when normal debugging is broken eg std::cerr
bool mIsBroken; ///< is the debugging system broken (this should be set when internal problems occur and should cause fallback to std::cerr)
std::map< std::string , std::ofstream * > mChannels; // the ofstream objects are owned by this class
int mLevel; ///< current debug level
std::ostream & SelectOutput(int level, const std::string & channel) noexcept; ///< returns a proper stream for this level and channel (always usable string)
void OpenNewChannel(const std::string & channel) noexcept; ///< tries to prepare this channel. does NOT guarantee to created mChannels[] entry!
void OpenNewChannel_(const std::string & channel); ///< internal function, will throw in case of problems
std::string GetLogBaseDir() const;
std::map< boost::thread::id , int > mThread2Number; ///< change long thread IDs into a short nice number to show
int mThread2Number_Biggest; ///< current biggest value held there (biggest key) - works as growing-only counter basically
int Thread2Number(const boost::thread::id id); ///< convert the system's thread id into a nice short our id; make one if new thread
std::map< t_anypid , int > mPid2Number; ///< change long proces PID into a short nice number to show
int mPid2Number_Biggest; ///< current biggest value held there (biggest key) - works as growing-only counter basically
int Pid2Number(const t_anypid id); ///< convert the system's PID id into a nice short our id; make one if new thread
};
// ====================================================================
// vector debug
template <class T>
std::string vectorToStr(const T & v) {
std::ostringstream oss;
for(auto rec: v) {
oss << rec <<",";
}
return oss.str();
}
template <class T>
void DisplayVector(std::ostream & out, const std::vector<T> &v, const std::string &delim=" ") {
std::copy( v.begin(), v.end(), std::ostream_iterator<T>(out, delim.c_str()) );
}
template <class T>
void EndlDisplayVector(std::ostream & out, const std::vector<T> &v, const std::string &delim=" ") {
out << std::endl;
DisplayVector(out,v,delim);
}
template <class T>
void DisplayVectorEndl(std::ostream & out, const std::vector<T> &v, const std::string &delim=" ") {
DisplayVector(out,v,delim);
out << std::endl;
}
template <class T>
void DbgDisplayVector(const std::vector<T> &v, const std::string &delim=" ") {
std::cerr << "[";
std::copy( v.begin(), v.end(), std::ostream_iterator<T>(std::cerr, delim.c_str()) );
std::cerr << "]";
}
string stringToColor(const string &hash);
template <class T, class T2>
void DisplayMap(std::ostream & out, const std::map<T, T2> &m, const std::string &delim=" ") {
auto *no_color = zkr::cc::fore::console;
for(auto var : m) {
out << stringToColor(var.first) << var.first << delim << var.second << no_color << endl;
}
}
template <class T, class T2>
void EndlDisplayMap(std::ostream & out, const std::map<T, T2> &m, const std::string &delim=" ") {
out << endl;
for(auto var : m) {
out << var.first << delim << var.second << endl;
}
}
template <class T, class T2>
void DbgDisplayMap(const std::map<T, T2> &m, const std::string &delim=" ") {
for(auto var : m) {
std::cerr << var.first << delim << var.second << endl;
}
}
template <class T>
void DbgDisplayVectorEndl(const std::vector<T> &v, const std::string &delim=" ") {
DbgDisplayVector(v,delim);
std::cerr << std::endl;
}
void DisplayStringEndl(std::ostream & out, const std::string text);
bool CheckIfBegins(const std::string & beggining, const std::string & all);
bool CheckIfEnds (std::string const & ending, std::string const & all);
std::string SpaceFromEscape(const std::string &s);
std::string EscapeFromSpace(const std::string &s);
vector<string> WordsThatMatch(const std::string & sofar, const vector<string> & possib);
char GetLastChar(const std::string & str);
std::string GetLastCharIf(const std::string & str); // TODO unicode?
std::string EscapeString(const std::string &s);
template <class T>
std::string DbgVector(const std::vector<T> &v, const std::string &delim="|") {
std::ostringstream oss;
oss << "[";
bool first=true;
for(auto vElement : v) { if (!first) oss<<delim; first=false; oss <<vElement ; }
oss << "]";
//std::copy( v.begin(), v.end(), std::ostream_iterator<T>(oss, delim.c_str()) );
return oss.str();
}
template <class T>
std::ostream & operator<<(std::ostream & os, const map< T, vector<T> > & obj){
os << "[";
for(auto const & elem : obj) {
os << " [" << elem.first << "=" << DbgVector(elem.second) << "] ";
}
os << "]";
return os;
}
template <class T, class T2>
std::string DbgMap(const map<T, T2> & map) {
std::ostringstream oss;
oss << map;
return oss.str();
}
// ====================================================================
// assert
// ASRT - assert. Name like ASSERT() was too long, and ASS() was just... no.
// Use it like this: ASRT( x>y ); with the semicolon at end, a clever trick forces this syntax :)
#define ASRT(x) do { if (!(x)) nOT::nUtils::Assert(false, OT_CODE_STAMP, #x); } while(0)
void Assert(bool result, const std::string &stamp, const std::string &condition);
// ====================================================================
// advanced string
const std::string GetMultiline(string endLine = "~");
vector<string> SplitString(const string & str);
bool checkPrefix(const string & str, char prefix = '^');
// ====================================================================
// nUse utils
enum class eSubjectType {Account, Asset, User, Server, Unknown};
string SubjectType2String(const eSubjectType & type);
eSubjectType String2SubjectType(const string & type);
// ====================================================================
// operation on files
/// @brief tools related to filesystem
/// @author rfree (maintainer)
class cFilesystemUtils { // if we do not want to use boost in given project (or we could optionally write boost here later)
public:
static bool CreateDirTree(const std::string & dir, bool only_below=false);
static char GetDirSeparatorSys(); /// < eg '/' or '\'
static char GetDirSeparatorInter(); /// < internal is '/'
static string FileInternalToSystem(const std::string &name); ///< converts from internal file name string to system file name string
static string FileSystemToInternal(const std::string &name); ///< converts from system file name string to internal file name string
};
/// @brief utils to e.g. edit a file from console
/// @author rfree (maintainer)
class cEnvUtils {
int fd;
string mFilename;
void GetTmpTextFile();
void CloseFile();
void OpenEditor();
const string ReadFromTmpFile();
public:
const string Compose();
const string ReadFromFile(const string path);
};
void hintingToTxt(std::fstream & file, string command, vector<string> &commands);
void generateQuestions (std::fstream & file, string command);
void generateAnswers (std::fstream & file, string command, vector<string> &completions);
// ====================================================================
namespace nOper { // nOT::nUtils::nOper
// cool shortcut operators, like vector + vecotr operator working same as string (appending)
// isolated to namespace because it's unorthodox ide to implement this
using namespace std;
// TODO use && and move?
template <class T>
vector<T> operator+(const vector<T> &a, const vector<T> &b) {
vector<T> ret = a;
ret.insert( ret.end() , b.begin(), b.end() );
return ret;
}
template <class T>
vector<T> operator+(const T &a, const vector<T> &b) {
vector<T> ret(1,a);
ret.insert( ret.end() , b.begin(), b.end() );
return ret;
}
template <class T>
vector<T> operator+(const vector<T> &a, const T &b) {
vector<T> b_vector(1,a);
return a + b_vector;
}
template <class T>
vector<T>& operator+=(vector<T> &a, const vector<T> &b) {
a.insert( a.end() , b.begin(), b.end() );
return a;
}
// map
template <class TK,class TV>
map<TK,TV> operator+(const map<TK,TV> &a, const map<TK,TV> &b) {
map<TK,TV> ret = a;
for (const auto & elem : b) {
ret.insert(elem);
}
return ret;
}
} // nOT::nUtils::nOper
// ====================================================================
// ====================================================================
// Algorithms
// ====================================================================
// ====================================================================
/**
@brief Special type that on creation will be initialized to have value INIT given as template argument.
Might be usefull e.g. to express in the declaration of class what will be the default value of member variable
See also http://www.boost.org/doc/libs/1_56_0/libs/utility/value_init.htm
Probably not needed when using boost in your project.
*/
template <class T, T INIT>
class value_init {
private:
T data;
public:
value_init();
T& operator=(const T& v) { data=v; return *this; }
operator T const &() const { return data; }
operator T&() { return data; }
};
template <class T, T INIT>
value_init<T, INIT>::value_init() : data(INIT) { }
} // namespace nUtils
} // namespace nOT
// global namespace
extern nOT::nUtils::cLogger gCurrentLogger; ///< The current main logger. Usually do not use it directly, instead use macros like _dbg1 etc
std::string GetObjectName(); ///< Method to return name of current object; To use in debug; Can be shadowed in your classes. (Might be not used currently)
const extern int _dbg_ignore; ///< the global _dbg_ignore, but local code (blocks, classes etc) you could shadow it in your code blocks,
// to override debug compile-time setting for given block/class, e.g. to disable debug in one of your methods or increase it there.
// Or to make it runtime by providing a class normal member and editing it in runtime
#define OT_CODE_STAMP ( nOT::nUtils::ToStr("[") + nOT::nUtils::nDetail::DbgShortenCodeFileName(__FILE__) + nOT::nUtils::ToStr("+") + nOT::nUtils::ToStr(__LINE__) + nOT::nUtils::ToStr(" ") + (GetObjectName()) + nOT::nUtils::ToStr("::") + nOT::nUtils::ToStr(__FUNCTION__) + nOT::nUtils::ToStr("]"))
#endif

View File

@@ -1,64 +0,0 @@
#if defined(_WIN32)
#include "windows_stream.h"
#include <windows.h>
windows_stream::windows_stream(unsigned int pLevel)
:
mLevel(pLevel)
{
}
std::ostream& operator << (std::ostream &stream, windows_stream const& object)
{
HANDLE h_stdout = GetStdHandle(STD_OUTPUT_HANDLE);
if (object.mLevel >= 100)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_RED | BACKGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 90)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_RED | FOREGROUND_INTENSITY | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 80)
{
SetConsoleTextAttribute(h_stdout, BACKGROUND_BLUE | BACKGROUND_RED | BACKGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 75)
{
SetConsoleTextAttribute(h_stdout, BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 70)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 50)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 40)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 30)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
return stream;
}
if (object.mLevel >= 20)
{
SetConsoleTextAttribute(h_stdout, FOREGROUND_BLUE);
return stream;
}
return stream;
}
#endif

View File

@@ -1,20 +0,0 @@
#ifndef WINDOWS_STREAM_H
#define WINDOWS_STREAM_H
#if defined(_WIN32)
#include <string>
#include <iostream>
class windows_stream
{
public:
windows_stream(unsigned int pLevel);
friend std::ostream& operator<<(std::ostream &stream, windows_stream const& object);
private:
unsigned int mLevel = 0;
};
#endif // _WIN32
#endif // WINDOWS_STREAM_H

View File

@@ -0,0 +1,36 @@
ban
bans
diff
exit
flush_txpool
hard_fork_info
help
hide_hr
is_key_image_spent
limit
limit_down
limit_up
out_peers
output_histogram
print_bc
print_block
print_cn
print_height
print_pl
print_pool
print_pool_sh
print_pool_stats
print_status
print_tx
q
save
set_log
show_hr
start_mining
start_save_graph
status
stop_daemon
stop_mining
stop_save_graph
sync_info
unban

View File

@@ -0,0 +1,33 @@
address
balance
bc_height
check_tx_key
export_key_images
get_tx_key
get_tx_note
help
import_key_images
incoming_transfers
integrated_address
payments
refresh
rescan_bc
rescan_spent
save
save_bc
save_watch_only
seed
set
set_tx_note
show_transfers
sign
spendkey
start_mining
status
stop_mining
sweep_all
sweep_unmixable
transfer
transfer_original
verify
viewkey

8
contrib/snap/monerod-wrapper Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
if [ ! -d "$SNAP_USER_DATA/etc" ]; then
mkdir $SNAP_USER_DATA/etc/
cp -R $SNAP/etc/monerod.conf $SNAP_USER_DATA/etc/monerod.conf
fi
exec "$SNAP/bin/monerod" "$@"

View File

@@ -0,0 +1,9 @@
# Configuration for monerod
# Syntax: any command line option may be specified as 'clioptionname=value'.
# See 'monerod --help' for all available options.
# Overrided by snap:
# data-dir=/var/lib/monero
# log-file=/var/log/monero/monero.log
log-level=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,75 @@
name: monero
version: 0.10.2-1
summary: "Monero: the secure, private, untraceable cryptocurrency https://getmonero.org"
description: |
Monero is a private, secure, untraceable, decentralised digital currency.
You are your bank, you control your funds, and nobody can trace your transfers
unless you allow them to do so.
grade: devel
confinement: strict
apps:
monerod:
daemon: forking
command: |
monerod-wrapper --detach --data-dir ${SNAP_COMMON} --config-file ${SNAP_USER_DATA}/etc/monerod.conf
plugs:
- network
- network-bind
monero-wallet-rpc:
command: |
monero-wallet-rpc --log-file ${SNAP_USER_DATA}
plugs:
- home
- network
- network-bind
monero-wallet-cli:
command: |
monero-wallet-cli --log-file ${SNAP_USER_DATA}
plugs:
- home
- network
parts:
cmake-build:
plugin: cmake
configflags:
- -DBDB_STATIC=1
- -DUPNP_STATIC=1
- -DBoost_USE_STATIC_LIBS=1
- -DBoost_USE_STATIC_RUNTIME=1
- -DARCH=default
source: .
build-packages:
- gcc
- pkg-config
- libunbound-dev
- libevent-dev
- libboost-all-dev
- libdb-dev
- libunwind-dev
- libminiupnpc-dev
- libldns-dev
- libexpat1-dev
- bison
- doxygen
- graphviz
stage-packages:
- libminiupnpc10
- libunbound2
- libunwind8
prime:
- bin
- usr/lib/
- -usr/lib/gcc
- -usr/share
dist-files:
plugin: dump
source: .
organize:
contrib/snap/monerod.conf: etc/monerod.conf
contrib/snap/monerod-wrapper: bin/monerod-wrapper
prime:
- etc
- bin

View File

@@ -0,0 +1,19 @@
{
libunwind causes spurious report
Memcheck:Param
msync(start)
...
obj:/usr/lib64/libunwind.so.*
...
fun:_ULx86_64_step
...
}
{
boost unlocks before signalling cond var
Helgrind:Misc
...
fun:pthread_cond_signal@*
fun:maybe_unlock_and_signal_one<boost::asio::detail::scoped_lock<boost::asio::detail::posix_mutex> >
...
}

View File

@@ -1,4 +1,4 @@
# Copyright (c) 2014-2016, The Monero Project
# Copyright (c) 2014-2017, The Monero Project
#
# All rights reserved.
#
@@ -34,11 +34,12 @@
# We always compile if we are building statically to reduce static dependency issues...
# ...except for FreeBSD, because FreeBSD is a special case that doesn't play well with
# others.
find_package(Miniupnpc QUIET)
if(NOT IOS)
find_package(Miniupnpc QUIET)
endif()
# If we have the correct shared version and we're not building static, use it
if(STATIC)
if(STATIC OR IOS)
set(USE_SHARED_MINIUPNPC false)
elseif(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER)
set(USE_SHARED_MINIUPNPC true)
@@ -59,15 +60,15 @@ else()
add_subdirectory(miniupnpc)
set_property(TARGET upnpc-static PROPERTY FOLDER "external")
set_property(TARGET libminiupnpc-static PROPERTY FOLDER "external")
if(MSVC)
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -wd4244 -wd4267")
elseif(NOT MSVC)
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
endif()
set(UPNP_STATIC true PARENT_SCOPE)
set(UPNP_LIBRARIES "upnpc-static" PARENT_SCOPE)
set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE)
endif()
find_package(Unbound)
@@ -98,3 +99,4 @@ else()
endif()
add_subdirectory(db_drivers)
add_subdirectory(easylogging++)

View File

@@ -0,0 +1,55 @@
#ifndef PORTABLE_BINARY_ARCHIVE_HPP
#define PORTABLE_BINARY_ARCHIVE_HPP
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <boost/static_assert.hpp>
#include <boost/archive/archive_exception.hpp>
#include <climits>
#if CHAR_BIT != 8
#error This code assumes an eight-bit byte.
#endif
#include <boost/archive/basic_archive.hpp>
#include <boost/detail/endian.hpp>
#include <boost/archive/impl/archive_serializer_map.ipp>
namespace boost { namespace archive {
enum portable_binary_archive_flags {
endian_big = 0x4000,
endian_little = 0x8000
};
//#if ( endian_big <= boost::archive::flags_last )
//#error archive flags conflict
//#endif
inline void
reverse_bytes(signed char size, char *address){
if (size <= 0)
throw archive_exception(archive_exception::other_exception);
char * first = address;
char * last = first + size - 1;
for(;first < last;++first, --last){
char x = *last;
*last = *first;
*first = x;
}
}
} }
#endif // PORTABLE_BINARY_ARCHIVE_HPP

Some files were not shown because too many files have changed in this diff Show More