Commit Graph

1058 Commits

Author SHA1 Message Date
moneromooo-monero
8c0523771f
blockchain: cache next block difficulty after adding a block
It's not 100% certain it'll be needed, but it avoids getinfo
needing the blockchain lock and potentially blocking
2018-07-07 19:34:21 +01:00
moneromooo-monero
d95bc44c6b
blockchain: fix getting invalid block data on failure 2018-06-29 15:50:34 +01:00
victorsintnicolaas
34cb6b4b70 add --regtest and --fixed-difficulty for regression testing
on_generateblocks RPC call combines functionality from the on_getblocktemplate and on_submitblock RPC calls to allow rapid block creation. Difficulty is set permanently to 1 for regtest.
Makes use of FAKECHAIN network type, but takes hard fork heights from mainchain
Default reserve_size in generate_blocks RPC call is now 1. If it is 0, the following error occurs 'Failed to calculate offset for'.
Queries hard fork heights info of other network types
2018-06-29 10:06:11 +02:00
moneromooo-monero
aa0ea0aafc
blockchain: set the m_verifivation_failed flag in a couple more places
when a block being added to the main chain is invalid.

This ensures the peer is banned after a number of these.
2018-06-28 16:57:22 +01:00
moneromooo-monero
84d9e7faec
blockchain: fix build after waiter::wait prototype change 2018-06-28 00:24:39 +01:00
luigi1111
87d7612311
Merge pull request #3986
b628503 Remove old logic saved in comments. (jeandudey)
2018-06-27 16:22:03 -05:00
luigi1111
3ad4ecd4ff
Merge pull request #3982
08b85a8 cryptonote_config: add get_config to refactor x = testnet ? config::testnet::X : stagenet ? config::stagenet::X : config::X (stoffu)
0cf80ba net_node: resolve host for node addresses given via command line flags (stoffu)
2018-06-27 15:38:23 -05:00
luigi1111
a844844cda
Merge pull request #3716
a2b557f 6795bd0 209ec96 ed2c81e a830db2 57ea902 31a895e ba8331c f7f1917 41be339 f025ae9 ef2cb63 dcfd299 5d3e702 2704624 2771a18 0e4c7d0 (moneromooo-monero)
2018-06-27 15:33:01 -05:00
moneromooo-monero
2771a18e85
threadpool: allow leaf functions to run concurrently
Decrease the number of worker threads by one to account
for the fact the calling thread acts as a worker thread now
2018-06-26 22:15:22 +01:00
moneromooo-monero
ef2cb63287
blockchain: simplify/speedup handle_get_objects 2018-06-26 22:15:14 +01:00
moneromooo-monero
a830db2577
rpc: rework to avoid repeated calculations in get_blocks.bin 2018-06-26 22:14:23 +01:00
moneromooo-monero
ed2c81ed95
replace std::list with std::vector on some hot paths
also use reserve where appropriate
2018-06-26 22:14:21 +01:00
moneromooo-monero
50af3579ee
alt_chain_info can now give more info about a particular alt chain 2018-06-26 08:19:51 +01:00
luigi1111
14372ca95a
Merge pull request #3975
2d5921e blockchain: avoid duplicate db query for height (moneromooo-monero)
2018-06-25 15:24:45 -05:00
luigi1111
c3ec5373b3
Merge pull request #3936
d81e042 tx_pool: initialize bitflags padding since it gets written to storage (moneromooo-monero)
2018-06-25 14:53:27 -05:00
moneromooo-monero
41b4bf9d6d
tx_pool: cache check_tx_inputs results
This is called a lot when creating a block template, and
does not change until the blockchain changes.
This also avoids tx parsing when cached.
2018-06-24 11:22:26 +01:00
luigi1111
9eb51887b0
Merge pull request #3919
ace2eda blockchain: pop forked blocks only when DB is not read-only (stoffu)
2018-06-20 14:39:09 -05:00
luigi1111
5a221c0e48
Merge pull request #3904
4f3a4fb blockchain: return error when requesting non existent output (moneromooo-monero)
2018-06-20 14:33:08 -05:00
luigi1111
81a2ff768b
Merge pull request #3903
2b0c632 tx_pool: hold off parsing a tx blob till we actually need it (moneromooo-monero)
2018-06-20 14:31:33 -05:00
luigi1111
50bc95519e
Merge pull request #3828
16e209e core: lock incoming tx lock when checking the txpool and chain (moneromooo-monero)
2018-06-19 12:41:07 -05:00
luigi1111
cfd66dae4b
Merge pull request #3691
db55263 threadpool: allow constructing an object, and misc tweaks (moneromooo-monero)
ce173cb core: remove threadpool dependency from header (moneromooo-monero)
3147468 unit_tests: add threadpool unit test (moneromooo-monero)
2018-06-17 22:04:39 -05:00
luigi1111
fb2b16f10a
Merge pull request #3732
fa0839f Ensure m_timestamps has the correct number for computing difficulty. (thaerkh)
2018-06-16 14:05:53 -05:00
luigi1111
b3363e8e0a
Merge pull request #3726
b5cb1bc blockchain: avoid exception if asked for a block we do not have (moneromooo-monero)
2018-06-16 14:02:56 -05:00
luigi1111
6be2516140
Merge pull request #3687
6b13976 blockchain: log in DEBUG when a block is found, and where (moneromooo-monero)
2018-06-12 12:22:12 -05:00
Jean Pierre Dudey
b628503bad Remove old logic saved in comments.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-06-11 09:36:05 -04:00
stoffu
08b85a8e00
cryptonote_config: add get_config to refactor x = testnet ? config::testnet::X : stagenet ? config::stagenet::X : config::X 2018-06-11 20:17:02 +09:00
moneromooo-monero
2d5921eefa
blockchain: avoid duplicate db query for height 2018-06-09 19:51:27 +01:00
luigi1111
2619d966c6
Merge pull request #3908
827ca3f bump version for 0.12.2 point release (fluffypony)
95ccf50 update checkpoints.dat for point release (fluffypony)
2018-06-08 14:53:54 -05:00
luigi1111
22c8730261
Merge pull request #3450
3b941be core: add get_earliest_ideal_height_for_version() (stoffu)
2018-06-08 14:31:49 -05:00
luigi1111
8a1f0d7d13
Merge pull request #3940
f24cbc5 blockchain: fix deadlock with the difficulty cache (moneromooo-monero)
2018-06-07 12:19:43 -05:00
moneromooo-monero
f24cbc5245
blockchain: fix deadlock with the difficulty cache 2018-06-06 10:37:51 +01:00
moneromooo-monero
d81e042306
tx_pool: initialize bitflags padding since it gets written to storage
Avoids valgrind reporting uninitialized data usage
2018-06-05 20:26:44 +01:00
stoffu
ace2edacb6
blockchain: pop forked blocks only when DB is not read-only 2018-06-04 20:59:50 +09:00
moneromooo-monero
f0322a083a
blockchain: demote a hash-of-hashes validation warning to debug
This data comes from untrusted peers, and validation failures
are therefore normal.
2018-06-02 23:48:12 +01:00
Riccardo Spagni
95ccf508cd update checkpoints.dat for point release 2018-06-02 14:31:37 +02:00
moneromooo-monero
2b0c632f32
tx_pool: hold off parsing a tx blob till we actually need it 2018-06-02 09:17:41 +01:00
moneromooo-monero
4f3a4fb701
blockchain: return error when requesting non existent output
avoids RPC thread dying, causing the wallet to timeout
2018-06-01 21:52:04 +01:00
luigi1111
9bc8f76924
Merge pull request #3525
66a659b blockchain: add scope guard to waiter for threaded txv1 verification (stoffu)
2018-05-30 16:08:50 -05:00
luigi1111
a7ea14dc6a
Merge pull request #3876
740da1b core: fix automatic safe db sync mode switching (moneromooo-monero)
e942d34 protocol: do not switch to unsafe sync mode for just a few blocks (moneromooo-monero)
2018-05-30 15:46:13 -05:00
luigi1111
4267a0bb51
Merge pull request #3731
a66f152 Use median timestamp if current time renders a block invalid. (thaerkh)
2018-05-30 15:44:25 -05:00
luigi1111
c534fe8d19
Merge pull request #3251
b9389e5 db_lmdb: save pruned and prunable tx data separately (moneromooo-monero)
2018-05-29 17:56:26 -05:00
luigi1111
ed72f35e9a
Merge pull request #3446
a6b8d3f tx_pool: remove old comment from fill_block_template() (stoffu)
2018-05-29 12:57:43 -05:00
luigi1111
764340d112
Merge pull request #3420
a6a54fa blockchain: cache difficulty for next block (moneromooo-monero)
2018-05-29 12:55:19 -05:00
moneromooo-monero
740da1ba95
core: fix automatic safe db sync mode switching 2018-05-28 12:14:04 +01:00
stoffu
a6b8d3fee1
tx_pool: remove old comment from fill_block_template() 2018-05-28 13:41:39 +09:00
moneromooo-monero
b9389e582e
db_lmdb: save pruned and prunable tx data separately
This bumps DB version to 2, migration code will run for v1 DBs
2018-05-23 22:48:12 +01:00
Riccardo Spagni
45975fd8eb update checkpoints 2018-05-23 21:20:15 +02:00
Riccardo Spagni
f794d3b3df
Merge pull request #3787
ce63ab09 blockchain: invalidate misc caches when popping blocks (moneromooo-monero)
2018-05-21 21:36:38 +02:00
Riccardo Spagni
709658d166
Merge pull request #3832
cb9c7972 Fix output shuffling for multisig (stoffu)
2018-05-21 20:57:52 +02:00
moneromooo-monero
5f8ffca34d
speed up get_output_distribution (and precalc common case) 2018-05-21 19:51:58 +01:00
Riccardo Spagni
791da4343c
Merge pull request #3749
872cb4ef blockchain: pop top if block version disagrees with the ideal fork version (stoffu)
2018-05-21 20:45:35 +02:00
moneromooo-monero
ce173cbb5b
core: remove threadpool dependency from header 2018-05-20 12:06:07 +01:00
stoffu
cb9c7972b6
Fix output shuffling for multisig 2018-05-20 09:38:41 +09:00
moneromooo-monero
16e209e08d
core: lock incoming tx lock when checking the txpool and chain
This gets rid of an innocuous race trying to add the same tx
twice to the txpool
2018-05-18 09:39:56 +01:00
Thaer Khawaja
a66f152f75 Use median timestamp if current time renders a block invalid. 2018-05-13 11:58:05 -07:00
moneromooo-monero
b5cb1bc403
blockchain: avoid exception if asked for a block we do not have
This can happen if a peer tries to obtain the next span from other
peers if that span is needed for not downloaded yet. Also if the
peer maliciously requests a non existent block hash.
2018-05-09 14:03:07 +01:00
moneromooo-monero
ce63ab09db
blockchain: invalidate misc caches when popping blocks
Might be a bit heavy handed, but conservative.
2018-05-09 09:10:56 +01:00
moneromooo-monero
6f859e4328
cryptonote: make sure outPk setup always happens 2018-05-07 19:21:52 +01:00
stoffu
872cb4efd8
blockchain: pop top if block version disagrees with the ideal fork version 2018-05-06 20:50:46 +09:00
Thaer Khawaja
fa0839f2f5 Ensure m_timestamps has the correct number for computing difficulty. 2018-04-29 19:50:55 -07:00
Riccardo Spagni
2ab5b1a21f
Merge pull request #3683
dad10775 Only log an error if fork version is higher AND is not known. (Thaer Khawaja)
2018-04-28 16:57:36 +02:00
moneromooo-monero
6b13976330
blockchain: log in DEBUG when a block is found, and where
Eases up debugging
2018-04-23 11:43:12 +01:00
moneromooo-monero
ffeeefde60
speedup get_output_histogram for all amounts when min_count > 0
This skips the vast majority of "dust" output amounts with just
one instance on the chain. Clocks in at 0.15% of the original
time on testnet.
2018-04-23 10:54:28 +01:00
Thaer Khawaja
dad1077577 Only log an error if fork version is higher AND is not known. 2018-04-22 17:26:44 -07:00
Riccardo Spagni
a95461e76d
Merge pull request #3609
08343aba tx_pool: fix loading with colliding key images (moneromooo-monero)
2018-04-12 13:48:44 +02:00
Riccardo Spagni
226de8e928
Merge pull request #3530
eb59f7c5 cryptonote_tx_util: make destinations properly shuffled (stoffu)
2018-04-12 13:46:34 +02:00
Riccardo Spagni
5053f8f40b
Merge pull request #3502
11c933e1 fix lambda compile error on openbsd (moneromooo-monero)
2018-04-12 11:14:43 +02:00
moneromooo-monero
08343abaf4
tx_pool: fix loading with colliding key images
A key image may be present more than once if all but one of the
txes spending that key image are coming from blocks. When loading
a txpool from storage, we must load the one that's not from a
block first to avoid rejection
2018-04-11 15:27:56 +01:00
stoffu
eb59f7c563
cryptonote_tx_util: make destinations properly shuffled 2018-03-31 18:37:46 +09:00
stoffu
66a659bb03
blockchain: add scope guard to waiter for threaded txv1 verification 2018-03-30 19:22:32 +09:00
moneromooo-monero
11c933e137
fix lambda compile error on openbsd 2018-03-27 14:48:36 +01:00
Riccardo Spagni
dac3895ac1
update block hashes for checkpoints.dat 2018-03-24 08:36:10 +02:00
stoffu
3b941befae
core: add get_earliest_ideal_height_for_version() 2018-03-21 01:53:24 +09:00
moneromooo-monero
a6a54fa883
blockchain: cache difficulty for next block
Takes about 10 ms, which takes pretty much all of the get_info
RPC, which is called pretty often from wallets.

Also add a new lock so we don't need to lock the blockchain lock,
which will avoid blocking for a long time when calling the getinfo
RPC while syncing. Users of get_difficulty_for_next_block who need
the lock will have locked it already.
2018-03-19 09:05:40 +00:00
moneromooo-monero
b1398fff40
core: fix use of uninitialised data 2018-03-18 23:37:00 +00:00
moneromooo-monero
bb20f104ba
Move v7 fork to 1546000 to give more update time 2018-03-18 09:29:31 +00:00
Riccardo Spagni
83651630bc
Merge pull request #3418
20a00266 blockchain: forbid bulletproof types before v8 (moneromooo-monero)
2018-03-17 16:51:47 +02:00
moneromooo-monero
20a002667c
blockchain: forbid bulletproof types before v8
They were already forbidden implicitely, but let's make that
explicit for robustness
2018-03-16 18:18:34 +00:00
Riccardo Spagni
432480fa42
Merge pull request #3414
524cbdc1 blockchain: fix log message about per-kB fee (stoffu)
2018-03-16 18:09:34 +02:00
Riccardo Spagni
0f27fc57ac
Merge pull request #3336
57c0b1ed Fix typos in various files (Dimitris Apostolou)
2018-03-16 18:08:07 +02:00
moneromooo-monero
41f727ce42
add RPC to get a histogram of outputs of a given amount 2018-03-16 10:32:26 +00:00
stoffu
524cbdc1e2
blockchain: fix log message about per-kB fee 2018-03-16 10:43:19 +09:00
Dimitris Apostolou
57c0b1ed9f Fix typos in various files 2018-03-15 18:25:38 +02:00
Jean Pierre Dudey
e1b526b371 Remove the Blockchain::get_all_known_block_ids function.
This function isn't used in the codebase.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-03-14 21:56:19 -04:00
stoffu
8705beaf51
keypair::generate: always require hw::device to avoid possible mistake 2018-03-14 21:00:16 +09:00
stoffu
27a196b126
device: untangle cyclic depenency
When #3303 was merged, a cyclic dependency chain was generated:

    libdevice <- libcncrypto <- libringct <- libdevice

This was because libdevice needs access to a set of basic crypto operations
implemented in libringct such as scalarmultBase(), while libringct also needs
access to abstracted crypto operations implemented in libdevice such as
ecdhEncode(). To untangle this cyclic dependency chain, this patch splits libringct
into libringct_basic and libringct, where the basic crypto ops previously in
libringct are moved into libringct_basic. The cyclic dependency is now resolved
thanks to this separation:

    libcncrypto <- libringct_basic <- libdevice <- libcryptonote_basic <- libringct

This eliminates the need for crypto_device.cpp and rctOps_device.cpp.

Also, many abstracted interfaces of hw::device such as encrypt_payment_id() and
get_subaddress_secret_key() were previously implemented in libcryptonote_basic
(cryptonote_format_utils.cpp) and were then called from hw::core::device_default,
which is odd because libdevice is supposed to be independent of libcryptonote_basic.
Therefore, those functions were moved to device_default.cpp.
2018-03-14 21:00:15 +09:00
Riccardo Spagni
9a63fbcf83
Merge pull request #3371
84decbea core: add v7 for 1539500 on mainnet (moneromooo-monero)
2018-03-14 13:37:25 +02:00
Riccardo Spagni
2e074e2ae7
Merge pull request #3358
978663d4 Stagenet: successive forks up to v7 (stoffu)
2018-03-14 13:36:47 +02:00
Cédric
73dd883d51 Ledger HW Bug fixes
Fix the way the REAL mode is handle:
  Let create_transactions_2 and create_transactions_from construct the vector of transactions.
  Then iterate on it and resign.
  We just need to add 'outs' list in the TX struct for that.

Fix default secret keys value when DEBUG_HWDEVICE mode is off
  The magic value (00...00 for view key and FF..FF for spend key) was not correctly set
  when DEBUG_HWDEVICE was off. Both was set to 00...00.

Add sub-address info in ABP map in order to correctly display destination sub-address on device

Fix DEBUG_HWDEVICE mode:
   - Fix compilation errors.
   - Fix control device init in ledger device.
   - Add more log.

Fix sub addr control

Fix debug Info
2018-03-12 10:43:06 +01:00
stoffu
978663d461
Stagenet: successive forks up to v7 2018-03-09 13:59:11 +09:00
moneromooo-monero
84decbea48
core: add v7 for 1539500 on mainnet 2018-03-07 17:19:50 +00:00
moneromooo-monero
38657fd0e9
Bump min ring size from 5 to 7 from v7 2018-03-07 13:19:04 +00:00
Riccardo Spagni
9841a452e5
Merge pull request #3338
51219457 core: fix sending to the source address with a short payment id (moneromooo-monero)
2018-03-05 19:13:28 +02:00
Riccardo Spagni
abcdb7b5c4
Merge pull request #3308
6f8779d2 blockchain: fix random sync failures (moneromooo-monero)
2018-03-05 19:12:05 +02:00
Riccardo Spagni
4f93f74528
Merge pull request #3277
0e7ad2e2 Wallet API: generalize 'bool testnet' to 'NetworkType nettype' (stoffu)
af773211 Stagenet (stoffu)
cc9a0bee command_line: allow args to depend on more than one args (stoffu)
55f8d917 command_line::get_arg: remove 'required' for dependent args as they're always optional (stoffu)
450306a0 command line: allow has_arg to handle arg_descriptor<bool,false,true> #3318 (stoffu)
9f9e095a Use `genesis_tx` parameter in `generate_genesis_block`. #3261 (Jean Pierre Dudey)
2018-03-05 19:11:20 +02:00
Edward Betts
fbcc91c2a4 Correct spelling mistakes. 2018-03-05 17:00:40 +00:00
stoffu
af773211cb
Stagenet 2018-03-05 11:55:05 +09:00
Jean Pierre Dudey
9f9e095a8c
Use genesis_tx parameter in generate_genesis_block. #3261
* src/cryptnote_config.h: The constant `config::testnet::GENESIS_TX` was
changed to be the same as `config::GENESIS_TX` (the mainnet's transaction)
because the mainnet's transaction was being used for both networks.

* src/cryptonote_core/cryptonote_tx_utils.cpp: The `generate_genesis_block` function
was ignoring the  `genesis_tx` parameter, and instead it was using the `config::GENESIS_TX`
constant. That's why the testnet genesis transaction was changed. Also five lines of unused
code were removed.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-03-05 11:19:01 +09:00
cslashm
e745c1e38d Code modifications to integrate Ledger HW device into monero-wallet-cli.
The basic approach it to delegate all sensitive data (master key, secret
ephemeral key, key derivation, ....) and related operations to the device.
As device has low memory, it does not keep itself the values
(except for view/spend keys) but once computed there are encrypted (with AES
are equivalent) and return back to monero-wallet-cli. When they need to be
manipulated by the device, they are decrypted on receive.

Moreover, using the client for storing the value in encrypted form limits
the modification in the client code. Those values are transfered from one
C-structure to another one as previously.

The code modification has been done with the wishes to be open to any
other hardware wallet. To achieve that a C++ class hw::Device has been
introduced. Two initial implementations are provided: the "default", which
remaps all calls to initial Monero code, and  the "Ledger", which delegates
all calls to Ledger device.
2018-03-04 12:54:53 +01:00
moneromooo-monero
51219457b1
core: fix sending to the source address with a short payment id
It would fail to send, thinking it needs a destination address,
since the destination matches the change address in this case.
2018-03-02 23:27:57 +00:00