Commit Graph

641 Commits

Author SHA1 Message Date
moneromooo-monero dc5a76095c
blockchain: avoid unneeded block copy 2019-03-05 11:58:10 +00:00
moneromooo-monero 79b4e9f377
save some database calls when getting top block hash and height 2019-03-05 11:58:05 +00:00
moneromooo-monero 9827880877
blockchain: avoid pointless transaction copy and temporary 2019-03-05 11:58:02 +00:00
moneromooo-monero 07d655e438
blockchain: avoid duplicate block hash computation 2019-03-05 11:58:00 +00:00
moneromooo-monero b044d03a51
Avoid repeated (de)serialization when syncing 2019-03-05 11:57:55 +00:00
Riccardo Spagni 082149c580
fix merge errors, update recommended version to 0.14.0.2 2019-03-05 13:46:35 +02:00
Riccardo Spagni f3b368c659
update checkpoints hash 2019-03-05 13:06:36 +02:00
moneromooo-monero ef93b0995c
various: remove unused variables 2019-03-04 22:24:49 +00:00
Riccardo Spagni e1a177f0da
Merge pull request #5092
eec79276 blockchain: fix default genesis block timestamp (moneromooo-monero)
2019-03-04 21:21:08 +02:00
moneromooo-monero 5f67e7f547
blockchain: forbid older BP rct versions from v11 2019-03-04 15:08:12 +00:00
Riccardo Spagni 815c8a48ab
Merge pull request #5174
0de14396 tests: add a CNv4 JIT test (moneromooo-monero)
24d281c3 crypto: plug CNv4 JIT into cn_slow_hash (moneromooo-monero)
78ab59ea crypto: clear cache after generating random program (moneromooo-monero)
b9a61884 performance_tests: add tests for new Cryptonight variants (moneromooo-monero)
fff23bf7 CNv4 JIT compiler for x86-64 and tests (SChernykh)
3dde67d8 blockchain: add v10 fork heights (moneromooo-monero)
2019-03-04 17:06:37 +02:00
moneromooo-monero 3dde67d82d
blockchain: add v10 fork heights 2019-03-04 11:56:22 +00:00
moneromooo-monero 356d813799
blockchain: include number of discarded blocks in --reorg-notify 2019-03-04 11:48:44 +00:00
Riccardo Spagni 55305559c1
Merge pull request #5124
b8787f43 ArticMine's new block weight algorithm (moneromooo-monero)
2019-03-04 12:09:13 +02:00
moneromooo-monero b8787f4302
ArticMine's new block weight algorithm
This curbs runaway growth while still allowing substantial
spikes in block weight

Original specification from ArticMine:

here is the scaling proposal
Define: LongTermBlockWeight
Before fork:
LongTermBlockWeight = BlockWeight
At or after fork:
LongTermBlockWeight = min(BlockWeight, 1.4*LongTermEffectiveMedianBlockWeight)
Note: To avoid possible consensus issues over rounding the LongTermBlockWeight for a given block should be calculated to the nearest byte, and stored as a integer in the block itself. The stored LongTermBlockWeight is then used for future calculations of the LongTermEffectiveMedianBlockWeight and not recalculated each time.
Define:   LongTermEffectiveMedianBlockWeight
LongTermEffectiveMedianBlockWeight = max(300000, MedianOverPrevious100000Blocks(LongTermBlockWeight))
Change Definition of EffectiveMedianBlockWeight
From (current definition)
EffectiveMedianBlockWeight  = max(300000, MedianOverPrevious100Blocks(BlockWeight))
To (proposed definition)
EffectiveMedianBlockWeight  = min(max(300000, MedianOverPrevious100Blocks(BlockWeight)), 50*LongTermEffectiveMedianBlockWeight)
Notes:
1) There are no other changes to the existing penalty formula, median calculation, fees etc.
2) There is the requirement to store the LongTermBlockWeight of a block unencrypted in the block itself. This  is to avoid possible consensus issues over rounding and also to prevent the calculations from becoming unwieldy as we move away from the fork.
3) When the  EffectiveMedianBlockWeight cap is reached it is still possible to mine blocks up to 2x the EffectiveMedianBlockWeight by paying the corresponding penalty.

Note: the long term block weight is stored in the database, but not in the actual block itself,
since it requires recalculating anyway for verification.
2019-03-04 09:33:58 +00:00
Tom Smeding fec359a641 cryptonote: Fix enum check in expand_transaction_2
This was noticed because GCC warned about using an enum value in a
boolean context.
2019-02-01 16:44:58 +01:00
moneromooo-monero 23813c7160
blockchain: add --reorg-notify
This will trigger if a reorg is seen. This may be used to do things
like stop automated withdrawals on large reorgs.

%s is replaced by the height at the split point
%h is replaced by the height of the new chain
%n is replaced by the number of new blocks after the reorg
2019-01-28 19:32:31 +00:00
moneromooo-monero f6db59b011
notify: handle arbitrary tags 2019-01-28 19:32:28 +00:00
Riccardo Spagni 0daa00e035
Merge pull request #5052
b6534c40 ringct: remove unused senderPk from ecdhTuple (moneromooo-monero)
7d375981 ringct: the commitment mask is now deterministic (moneromooo-monero)
99d946e6 ringct: encode 8 byte amount, saving 24 bytes per output (moneromooo-monero)
cdc3ccec ringct: save 3 bytes on bulletproof size (moneromooo-monero)
f931e16c add a bulletproof version, new bulletproof type, and rct config (moneromooo-monero)
2019-01-28 21:24:55 +02:00
moneromooo-monero eec792764d
blockchain: fix default genesis block timestamp 2019-01-26 21:39:00 +00:00
moneromooo-monero f931e16c6e
add a bulletproof version, new bulletproof type, and rct config
This makes it easier to modify the bulletproof format
2019-01-22 23:17:24 +00:00
moneromooo-monero b750fb27b0
Pruning
The blockchain prunes seven eighths of prunable tx data.
This saves about two thirds of the blockchain size, while
keeping the node useful as a sync source for an eighth
of the blockchain.

No other data is currently pruned.

There are three ways to prune a blockchain:

- run monerod with --prune-blockchain
- run "prune_blockchain" in the monerod console
- run the monero-blockchain-prune utility

The first two will prune in place. Due to how LMDB works, this
will not reduce the blockchain size on disk. Instead, it will
mark parts of the file as free, so that future data will use
that free space, causing the file to not grow until free space
grows scarce.

The third way will create a second database, a pruned copy of
the original one. Since this is a new file, this one will be
smaller than the original one.

Once the database is pruned, it will stay pruned as it syncs.
That is, there is no need to use --prune-blockchain again, etc.
2019-01-22 20:30:51 +00:00
Riccardo Spagni 54eb3318e2
Merge pull request #5048
a67b77a9 blockchain: don't propagate exception past dtor (moneromooo-monero)
2019-01-18 19:00:47 +02:00
Riccardo Spagni dc726f4b3b
Merge pull request #5032
5ee6f037 blockchain: fix wrong hf version when popping multiple blocks (moneromooo-monero)
634d359a blockchain: use the version passed as parameter, not a new one (moneromooo-monero)
94a375d5 hardfork: remove batch transactions setup (moneromooo-monero)
2019-01-16 21:40:06 +02:00
Riccardo Spagni a80978e699
Merge pull request #5015
6f2081f8 cryptonote_core: revert extra_tx_map (moneromooo-monero)
2019-01-16 21:32:14 +02:00
Riccardo Spagni 1f71bfc8d0
Merge pull request #4993
b8342dd5 blockchain: fix block rate check for empty blockchains (moneromooo-monero)
2019-01-16 19:07:55 +02:00
Riccardo Spagni 9d57ee9ff6
Merge pull request #4984
008647d7 blockchain_db: speedup tx output gathering (moneromooo-monero)
2019-01-16 19:06:07 +02:00
moneromooo-monero a67b77a9eb
blockchain: don't propagate exception past dtor
Coverity 190660
2019-01-07 16:32:50 +00:00
moneromooo-monero 5ee6f03742
blockchain: fix wrong hf version when popping multiple blocks
Since we keep track of the hf version in the db, we pick it up
from there instead of doing the full reorg call, which is quite
expensive
2019-01-01 18:28:01 +00:00
moneromooo-monero 634d359a84
blockchain: use the version passed as parameter, not a new one 2019-01-01 18:28:01 +00:00
luigi1111 c7af379d29
Merge pull request #4940
9e64a71 blockchain: call deinit in dtor (moneromooo-monero)
2018-12-31 15:44:49 -06:00
luigi1111 6d3caaff70
Merge pull request #4928
affff94 blockchain: fix race between two external mining threads (moneromooo-monero)
2018-12-31 15:28:25 -06:00
moneromooo-monero 6f2081f867
cryptonote_core: revert extra_tx_map
While the lookups are faster, the zeroCommit calls have to be
done again when storing the new outputs in the db, which ends
up making the whole thing slower after all, and the ways this
can be cached aren't very nice code wise, so let's forget it
since the gains aren't very large anyway.
2018-12-25 15:19:41 +00:00
moneromooo-monero b8342dd52c
blockchain: fix block rate check for empty blockchains 2018-12-18 18:47:54 +00:00
moneromooo-monero 008647d7eb
blockchain_db: speedup tx output gathering
We know all the data we'll want for getblocks.bin is contiguous
2018-12-18 11:55:21 +00:00
Riccardo Spagni 83684ea515
Merge pull request #4909
756684bb blockchain: avoid unnecessary DB lookups when syncing (moneromooo-monero)
2018-12-12 11:59:25 +02:00
Riccardo Spagni 0fccc78e39
Merge pull request #4903
dc1c1252 add command pop_blocks (Jason Wong)
2018-12-12 11:58:37 +02:00
moneromooo-monero 9e64a71e7d
blockchain: call deinit in dtor
This ensures the io service that runs in another thread cannot
access data after it's deleted
2018-12-05 00:13:28 +00:00
Riccardo Spagni 81418cb281
Merge pull request #4894
aee7a4e3 wallet_rpc_server: do not use RPC data if the call failed (moneromooo-monero)
1a0733e5 windows_service: fix memory leak (moneromooo-monero)
0dac3c64 unit_tests: do not rethrow a copy of an exception (moneromooo-monero)
5d9915ab cryptonote: fix get_unit for non default settings (moneromooo-monero)
d4f50cb1 remove some unused code (moneromooo-monero)
61163971 a few minor (but easy) performance tweaks (moneromooo-monero)
30023074 tests: slow_memmem now returns size_t (moneromooo-monero)
2018-12-04 17:33:19 +02:00
moneromooo-monero ec1a62b50d
move int-util.h to epee 2018-12-04 15:14:29 +00:00
Riccardo Spagni e7d30780de
Merge pull request #4869
60f36386 Avoid unnecessary temp block and copy ctor (moneromooo-monero)
2018-12-04 17:12:47 +02:00
moneromooo-monero affff949f9
blockchain: fix race between two external mining threads 2018-12-02 13:08:41 +00:00
Jason Wong dc1c12528d add command pop_blocks
add new public method to Blockchain and update according to code review

update after review: better lock/unlock, try catch and coding style
2018-11-28 12:20:28 +01:00
moneromooo-monero 756684bb28
blockchain: avoid unnecessary DB lookups when syncing
Some of the inputs for block in a span will be from other earlier
blocks in that span. Keep track of those outputs so we don't have
to look them up again after those early blocks are added to the
blockchain.
2018-11-27 14:03:06 +00:00
moneromooo-monero fc98f7a0a1
rpc: speedup get_outs.bin 2018-11-26 18:56:23 +00:00
moneromooo-monero 611639710d
a few minor (but easy) performance tweaks
Found by codacy.com
2018-11-23 15:36:48 +00:00
moneromooo-monero 60f36386e4
Avoid unnecessary temp block and copy ctor
block already has a default ctor, and the extra object
churn due to its innards (vectors, etc) is pointless.
2018-11-19 17:57:17 +00:00
moneromooo-monero 31d80027b5
tests: add unit tests for get_output_distribution 2018-11-16 19:21:45 +00:00
moneromooo-monero 0936dae8a4
blockchain: remove "0 is height" shortcut from get_output_distribution
This prevents asking for just 0, and the RPC layer already does this
2018-11-16 10:03:02 +00:00
moneromooo-monero 872c7eb26a
Revert "blockchain: simplify output distribution code"
This reverts commit b2bb9312a7.
2018-11-16 10:02:59 +00:00
Riccardo Spagni c37c70f459
Merge pull request #4806
ac23b10f blockchain: fix innocuous difficulty cache inconsistency (moneromooo-monero)
3b14d972 blockchain: use uint64_t for block height, not size_t (moneromooo-monero)
2018-11-16 11:16:49 +02:00
Riccardo Spagni 0cc3fc3756
Merge pull request #4769
5808530f blockchain: remove unused output_scan_worker parameter (moneromooo-monero)
1426209a blockchain: don't run threads if we have just one function to run (moneromooo-monero)
6f7a5fd4 db_lmdb: slight speedup getting array data from the blockchain (moneromooo-monero)
99fbe100 db_lmdb: save some string copies for readonly db keys/values (moneromooo-monero)
bf31447e tx_pool: speed up take_tx for transactions from blocks (moneromooo-monero)
4f005a77 tx_pool: remove unnecessary get_transaction_hash (moneromooo-monero)
593ef598 perf_timer: call reserve on new timer array (moneromooo-monero)
6ecc99ad core: avoid unnecessary tx/blob conversions (moneromooo-monero)
00cc1a16 unit_tests: notify test special case for the usual weirdo (moneromooo-monero)
2018-11-14 21:35:03 +02:00
moneromooo-monero ac23b10f15
blockchain: fix innocuous difficulty cache inconsistency
This inconsistent state would not actually be used in practice
2018-11-05 14:47:52 +00:00
moneromooo-monero 3b14d9727b
blockchain: use uint64_t for block height, not size_t
for consistency
2018-11-05 14:47:48 +00:00
moneromooo-monero 5808530f54
blockchain: remove unused output_scan_worker parameter 2018-11-04 13:23:05 +00:00
moneromooo-monero 1426209a10
blockchain: don't run threads if we have just one function to run 2018-11-04 13:23:02 +00:00
moneromooo-monero 6ecc99ad1f
core: avoid unnecessary tx/blob conversions 2018-11-01 15:51:19 +00:00
moneromooo-monero a5ca7f4fb5
core: fix unmixable special case allowing ring size below 11 2018-10-27 11:16:25 +00:00
Riccardo Spagni 056a58d13f
Merge pull request #4536
fd62b6e7 blocks: use auto-generated .c files instead of 'LD -r -b binary' (xiphon)
2018-10-26 22:20:39 +02:00
Riccardo Spagni 557c17e206
Merge pull request #4408
341b3931 cryptonote_core: warn when the block rate deviates from expectations (moneromooo-monero)
2018-10-26 22:18:41 +02:00
xiphon fd62b6e79f blocks: use auto-generated .c files instead of 'LD -r -b binary' 2018-10-22 01:12:00 +03:00
Riccardo Spagni 5c418c0522
Merge pull request #4522
a39c0358 blockchain: add check test options are given for fakechain mode (moneromooo-monero)
2018-10-20 20:40:16 +02:00
moneromooo-monero cf75ee722a
blockchain: move two new verification errors to the verify category
Lest we get people get scared again
2018-10-19 21:11:12 +00:00
Riccardo Spagni ac5674524a
Revert "Merge pull request #4472"
This reverts commit 79d46c4d55, reversing
changes made to c9fc61dbb5.
2018-10-08 21:39:54 +02:00
moneromooo-monero a39c035846
blockchain: add check test options are given for fakechain mode
Coverity 188616
2018-10-08 11:37:58 +00:00
xiphon 02d3ef7bda blocks: use auto-generated .c files instead of 'LD -r -b binary' 2018-10-04 00:01:09 +00:00
Riccardo Spagni e2da7c7817
Merge pull request #4467
fa942ef6 daemon: silence daemon update warnings on testnet (iDunk5400)
2018-10-02 22:36:57 +02:00
Riccardo Spagni 83d8f03c23
Merge pull request #4333
73403004 add --block-notify to monerod and --tx-notify to monero-wallet-{cli,rpc} (moneromooo-monero)
2018-09-29 22:20:44 +02:00
iDunk5400 fa942ef610
daemon: silence daemon update warnings on testnet 2018-09-29 14:42:10 +02:00
Riccardo Spagni 8bf5a00564
Merge pull request #4423
357441a2 add checkpoints for testnet and mainnet (Riccardo Spagni)
d9f666d7 update checkpoints.dat (Riccardo Spagni)
6b1b4e83 update version to 13.0 (Riccardo Spagni)
6f153533 update readme with v13.0 (Riccardo Spagni)
2018-09-25 13:33:52 +02:00
moneromooo-monero 50981c40ce
blockchain: add stagenet v8 and v9, two weeks before mainnet 2018-09-24 20:43:39 +00:00
Riccardo Spagni d9f666d78c
update checkpoints.dat 2018-09-23 09:51:15 +02:00
Riccardo Spagni d6893aedf6
Merge pull request #4369
b2bb9312 blockchain: simplify output distribution code (moneromooo-monero)
befdcbf4 db_lmdb: do not use base for cumulative distribution (moneromooo-monero)
2018-09-21 20:31:21 +02:00
moneromooo-monero 341b3931ed
cryptonote_core: warn when the block rate deviates from expectations
The warning threshold is set to allow a false positive every
ten days on average.
2018-09-20 14:01:52 +00:00
Riccardo Spagni 22a6591a70
Merge pull request #4325
4e1e9a60 blockchain: add mainnet v8 height targetting 18 october (moneromooo-monero)
2018-09-18 17:39:16 +02:00
moneromooo-monero be001326d1
remove obsolete daemon selection of fake outs and old tx construction 2018-09-14 10:51:45 +00:00
moneromooo-monero b2bb9312a7
blockchain: simplify output distribution code 2018-09-12 19:20:16 +00:00
moneromooo-monero 9137ad2c63
blockchain: add a testnet v9 a day after v8
So that bulletproofs become mandatory
2018-09-11 13:38:36 +00:00
moneromooo-monero 5ffb2ff9b7
v8: per byte fee, pad bulletproofs, fixed 11 ring size 2018-09-11 13:38:07 +00:00
moneromooo-monero 2a8fcb421b
Bulletproof aggregated verification and tests
Also constrains bulletproofs to simple rct, for simplicity
2018-09-11 13:37:37 +00:00
moneromooo-monero bacf0a1e2f
bulletproofs: add aggregated verification
Ported from sarang's java code
2018-09-11 13:37:32 +00:00
moneromooo-monero 9ce9f8caf6
bulletproofs: add multi output bulletproofs to rct 2018-09-11 13:37:28 +00:00
moneromooo-monero 4e1e9a607e
blockchain: add mainnet v8 height targetting 18 october
and v9 a day later
2018-09-02 16:02:17 +00:00
luigi1111 ec6982f8eb
Merge pull request #4240
83f5587 blockchain: use uint64_t for height, not size_t (moneromooo-monero)
2018-08-22 20:58:55 -05:00
luigi1111 4a4ea78ecd
Merge pull request #4204
b278b83 core: sync database based on bytes added, not blocks added (moneromooo-monero)
2018-08-22 20:43:51 -05:00
moneromooo-monero 82d1b74500
core: cache block template where possible
This avoids constant rechecking of the same things each time
a miner asks for the block template. The tx pool maintains
a cookie to allow users to detect when the pool state changed,
which means the block template needs rebuilding.
2018-08-16 12:44:33 +00:00
luigi1111 fd3b71129b
Merge pull request #4164
8e24533 blockchain: some batch tx scanning speedup (moneromooo-monero)
2018-08-15 17:31:24 -05:00
moneromooo-monero b278b83860
core: sync database based on bytes added, not blocks added
Blocks have a very wide range, whereas actual size is the relevant
quantity to consider when syncing
2018-08-12 16:13:46 +00:00
moneromooo-monero 83f5587167
blockchain: use uint64_t for height, not size_t 2018-08-09 17:09:26 +00:00
luigi1111 dda05f357a
Merge pull request #4108
8c05237 blockchain: cache next block difficulty after adding a block (moneromooo-monero)
2018-07-27 14:26:01 -05:00
moneromooo-monero 8e24533a7f
blockchain: some batch tx scanning speedup 2018-07-21 12:05:12 +01:00
luigi1111 61eea83978
Merge pull request #4081
d95bc44 blockchain: fix getting invalid block data on failure (moneromooo-monero)
2018-07-19 14:12:30 -05:00
luigi1111 9474567d76
Merge pull request #4076
aa0ea0a blockchain: set the m_verifivation_failed flag in a couple more places (moneromooo-monero)
2018-07-19 14:11:24 -05:00
luigi1111 21afa71ba6
Merge pull request #3981
45e419b db: store cumulative rct output distribution in the db for speed (moneromooo-monero)
2018-07-19 13:39:24 -05:00
luigi1111 d518dae4bf
Merge pull request #3973
50af357 alt_chain_info can now give more info about a particular alt chain (moneromooo-monero)
2018-07-19 13:37:10 -05:00
luigi1111 025187e6c9
Merge pull request #3854
149da42 db_lmdb: enable batch transactions by default (stoffu)
34cb6b4 add --regtest and --fixed-difficulty for regression testing (vicsn)
9e1403e update get_info RPC and bump RPC version (vicsn)
207b66e first new functional tests (vicsn)
2018-07-19 13:35:25 -05:00
moneromooo-monero 45e419bd5c
db: store cumulative rct output distribution in the db for speed
This gets rid of the temporary precalc cache.

Also make the RPC able to send data back in binary or JSON,
since there can be a lot of data

This bumps the LMDB database format to v3, with migration.
2018-07-13 11:37:04 +01:00
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 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 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 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
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 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 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 764340d112
Merge pull request #3420
a6a54fa blockchain: cache difficulty for next block (moneromooo-monero)
2018-05-29 12:55:19 -05: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
moneromooo-monero 5f8ffca34d
speed up get_output_distribution (and precalc common case) 2018-05-21 19:51:58 +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
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
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
stoffu 66a659bb03
blockchain: add scope guard to waiter for threaded txv1 verification 2018-03-30 19:22:32 +09:00
Riccardo Spagni dac3895ac1
update block hashes for checkpoints.dat 2018-03-24 08:36:10 +02: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 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
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
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 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
moneromooo-monero 6f8779d282
blockchain: fix random sync failures
When a block is added as part of a chunk (when syncing historical
blocks), a block may end up already in the blockchain if it was
added to the queue before being added to the chain (though it's
not clear how that could happen, but it's an implementation detail)
and thus may not be added to the chain when add_block is called.
This would cause m_blocks_txs_check to not be cleared, causing it
to get out of sync at next call, and thus wrongfully reject the
next block.
2018-02-23 19:47:17 +00:00
Riccardo Spagni f4a6bc79d9
Merge pull request #3226
e4646379 keccak: fix mdlen bounds sanity checking (moneromooo-monero)
2e3e90ac pass large parameters by const ref, not value (moneromooo-monero)
61defd89 blockchain: sanity check number of precomputed hash of hash blocks (moneromooo-monero)
9af6b2d1 ringct: fix infinite loop in unused h2b function (moneromooo-monero)
8cea8d0c simplewallet: double check a new multisig wallet is multisig (moneromooo-monero)
9b98a6ac threadpool: catch exceptions in dtor, to avoid terminate (moneromooo-monero)
24803ed9 blockchain_export: fix buffer overflow in exporter (moneromooo-monero)
f3f7da62 perf_timer: rewrite to make it clear there is no division by zero (moneromooo-monero)
c6ea3df0 performance_tests: remove add_arg call stray extra param (moneromooo-monero)
fa6b4566 fuzz_tests: fix an uninitialized var in setup (moneromooo-monero)
03887f11 keccak: fix sanity check bounds test (moneromooo-monero)
ad11db91 blockchain_db: initialize m_open in base class ctor (moneromooo-monero)
bece67f9 miner: restore std::cout precision after modification (moneromooo-monero)
1aabd14c db_lmdb: check hard fork info drop succeeded (moneromooo-monero)
2018-02-16 14:26:58 +01:00
Riccardo Spagni 24d8f9237f
Merge pull request #3248
d6a0ae96 blockchain: don't try to use hash check array after it's freed (moneromooo-monero)
2018-02-16 14:24:22 +01:00
moneromooo-monero d6a0ae96c6
blockchain: don't try to use hash check array after it's freed
It's freed when we've synced past its end, but we might still
find an old chain somewhere
2018-02-10 11:26:06 +00:00
moneromooo-monero 61defd89e3
blockchain: sanity check number of precomputed hash of hash blocks
Coverity 142951
2018-02-02 17:10:13 +00:00
moneromooo-monero c70f03cacf
blockchain: move bulletproofs to v8
and set v7 height to 1057027 on testnet (one block earlier)
This is to easily dump current nodes since we're going to change
the v7 rules with this.
2018-01-31 15:52:39 +00:00
Riccardo Spagni f7dcb730cb
Merge pull request #3144
42f86624 rpc: expose recent median block size in getinfo (moneromooo-monero)
2018-01-27 17:25:40 -08:00
xmr-eric 18216f19dd Update 2018 copyright 2018-01-26 10:03:20 -05:00
Riccardo Spagni 9872620781
Merge pull request #3014
deeffaeb blockchain: remove minor floating point usage (moneromooo-monero)
2018-01-25 16:38:32 -08:00
moneromooo-monero 42f86624a3
rpc: expose recent median block size in getinfo 2018-01-17 11:12:26 +00:00
moneromooo-monero deeffaeb5c
blockchain: remove minor floating point usage 2018-01-10 11:05:30 +00:00
Riccardo Spagni 0a110aefbb
Merge pull request #2971
ae860230 Fix exceptions not finding txpool txes when relaying (moneromooo-monero)
2018-01-10 11:45:15 +01:00
moneromooo-monero ae8602303a
Fix exceptions not finding txpool txes when relaying 2017-12-20 13:02:53 +00:00
moneromooo-monero 24f584d90d
cryptonote_core: remove unused functions with off by one bugs 2017-12-18 15:16:06 +00:00
moneromooo-monero b1634aa3e8
blockchain: don't leave dangling pointers in this 2017-12-18 15:16:03 +00:00
moneromooo-monero 8e60b81c48
cryptonote_core: fix db leak on error 2017-12-18 15:16:00 +00:00
moneromooo-monero b49ddc766d
check accessing an element past the end of a container 2017-12-18 15:15:49 +00:00
moneromooo-monero d753d716a6
fix a few leaks by throwing objects, not newed pointers to objects 2017-12-18 15:15:13 +00:00
Riccardo Spagni 8da24c2a57
Merge pull request #2878
abebe392 rpc: add offline state in info rpc (moneromooo-monero)
7696e849 core: make --offline also disable DNS lookups (moneromooo-monero)
2017-12-16 23:27:00 +02:00
moneromooo-monero c83d0b3ee2
add bulletproofs from v7 on testnet 2017-12-08 13:50:45 +00:00
moneromooo-monero 7696e84952
core: make --offline also disable DNS lookups 2017-11-30 15:35:52 +00:00
moneromooo-monero 383ff4f689
remove "using namespace std" from headers
It's nasty, and actually breaks on Solaris, where if.h fails to
build due to:

  struct map *if_memmap;
2017-11-14 16:56:10 +00:00
Riccardo Spagni fd0740e5e7
Merge pull request #2615
10013e94 Protect node privacy by proper filtering in restricted-mode RPC answers (binaryFate)
2017-11-14 14:53:10 +02:00
binaryFate 10013e9434 Protect node privacy by proper filtering in restricted-mode RPC answers
This patch allows to filter out sensitive information for queries that rely on the pool state, when running in restricted mode.
This filtering is only applied to data sent back to RPC queries. Results of inline commands typed locally in the daemon are not affected.
In practice, when running with `--restricted-rpc`:
* get_transaction_pool will list relayed transactions with the fields "last relayed time" and "received time" set to zero.
* get_transaction_pool will not list transaction that have do_not_relay set to true, and will not list key images that are used only for such transactions
* get_transaction_pool_hashes.bin will not list such transaction
* get_transaction_pool_stats will not count such transactions in any of the aggregated values that are computed

The implementation does not make filtering the default, so developers should be mindful of this if they add new RPC functionality.
Fixes #2590.
2017-11-08 13:07:07 +01:00
moneromooo-monero ccf53a566c
track double spending in the txpool
Transactions in the txpool are marked when another transaction
is seen double spending one or more of its inputs.
This is then exposed wherever appropriate.

Note that being marked with this "double spend seen" flag does
NOT mean this transaction IS a double spend and will never be
mined: it just means that the network has seen at least another
transaction spending at least one of the same inputs, so care
should be taken to wait for a few confirmations before acting
upon that transaction (ie, mostly of use for merchants wanting
to accept unconfirmed transactions).
2017-11-06 00:05:44 +00:00
moneromooo-monero 935f746249
blockchain: do not lock the blockchain lock for simple DB getters
It is safe in those cases, though might return slightly out of date
information if another thread is busy modifying the blockchain,
but it avoids potentially lengthy delays just to get things like
the current blockchain height.
2017-10-30 08:23:40 +00:00
Riccardo Spagni 97c11caf07 Merge pull request #2656
3492de01 fix lightwallet and subaddresses conflict (Jaquee)
329f149e remove reference to cryptonote::null_hash (Jaquee)
2017-10-15 19:32:18 +02:00
Jaquee 329f149e95 remove reference to cryptonote::null_hash 2017-10-15 19:19:40 +02:00
Riccardo Spagni b293ad9a1a
Merge pull request #2640
22b51e06 db_lmdb: include chain height when failing to find an output key (moneromooo-monero)
5db433b3 blockchain: avoid exceptions in output verification (moneromooo-monero)
2017-10-15 18:59:45 +02:00
Riccardo Spagni d8bc28cc36
Merge pull request #2552
69ce33f2 core: fix failure to sync when a tx is already in the pool (moneromooo-monero)
2017-10-15 17:31:37 +02:00
Riccardo Spagni 5ea20d6944
Merge pull request #2469
7adceee6 precomputed block hashes are now in blocks of N (currently 256) (moneromooo-monero)
2017-10-15 17:23:50 +02:00
moneromooo-monero 5db433b3f7
blockchain: avoid exceptions in output verification
This can happen if we get a bad tx, so let's not spam the log.
2017-10-12 13:27:20 +01:00
Riccardo Spagni 4a20a5b5ea
Merge pull request #2537
269a2a01 blockchain: fix off by one getting blocks (moneromooo-monero)
2017-10-06 22:56:17 +04:00
moneromooo-monero 69ce33f217
core: fix failure to sync when a tx is already in the pool 2017-09-29 21:34:10 +01:00
moneromooo-monero 4e115a3a4c
core: remove out sorting from v7 rules
and restore random shuffle of outputs

This turned out to have a flaw (sort order depends on output
index), and this doesn't really bring much anyway
2017-09-27 12:42:08 +01:00
moneromooo-monero 269a2a01ef
blockchain: fix off by one getting blocks 2017-09-27 00:31:49 +01:00
moneromooo-monero 5d65a75b69
move checkpoints in a separate library 2017-09-25 21:16:26 +01:00
Riccardo Spagni e5a2cdbfad
Merge pull request #2457
d2d8a41c Use actual batch size for resize estimates (Howard Chu)
2017-09-25 16:57:07 +02:00
Riccardo Spagni 08ada1fa8b
Merge pull request #2440
6137a0b9 blockchain: reject unsorted ins and outs from v7 (moneromooo-monero)
16afab90 core: sort ins and outs key key image and public key, respectively (moneromooo-monero)
0c36b9f9 common: add apply_permutation file and function (moneromooo-monero)
2017-09-25 16:49:01 +02:00