aboutsummaryrefslogtreecommitdiff
path: root/tests/unit_tests/hardfork.cpp (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-03-04Copyright: Update to 2022mj-xmr1-1/+1
2021-02-09Remove unused variables in monero codebaseKevin Barbour1-1/+0
There are quite a few variables in the code that are no longer (or perhaps never were) in use. These were discovered by enabling compiler warnings for unused variables and cleaning them up. In most cases where the unused variables were the result of a function call the call was left but the variable assignment removed, unless it was obvious that it was a simple getter with no side effects.
2020-05-06Update copyright year to 2020SomaticFanatic1-1/+1
Update copyright year to 2020
2019-04-17testdb: add override keyword where missingstoffu1-6/+6
and delete obsolete BlockchainBDB::get_tx_output_indices along the way
2019-03-05Update 2019 copyrightbinaryFate1-1/+1
2019-03-04ArticMine's new block weight algorithmmoneromooo-monero1-20/+21
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.
2018-11-16tests: add unit tests for get_output_distributionmoneromooo-monero1-87/+7
2018-11-01core: avoid unnecessary tx/blob conversionsmoneromooo-monero1-1/+1
2018-09-11v8: per byte fee, pad bulletproofs, fixed 11 ring sizemoneromooo-monero1-2/+2
2018-07-30blockchain_db: remove unused get_output_key variantmoneromooo-monero1-1/+0
It was actually incorrect, as it would not return commitment
2018-07-19Merge pull request #4013luigi11111-0/+1
e5592c4 rpc: add blockchain disk size to getinfo (moneromooo-monero)
2018-07-19Merge pull request #3981luigi11111-18/+20
45e419b db: store cumulative rct output distribution in the db for speed (moneromooo-monero)
2018-07-19Merge pull request #3854luigi11111-0/+1
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-13db: store cumulative rct output distribution in the db for speedmoneromooo-monero1-18/+20
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-06-29add --regtest and --fixed-difficulty for regression testingvictorsintnicolaas1-0/+1
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-20rpc: add blockchain disk size to getinfomoneromooo-monero1-0/+1
This should help new nodes predict how much disk space will be needed for a full sync
2018-05-30unit_tests/hardfork: add tests for get_voting_info()stoffu1-0/+49
2018-05-30hardfork: fix get_next_version()stoffu1-0/+29
2018-05-30unit_tests/hardfork: add tests for check_for_height()stoffu1-0/+24
2018-05-30hardfork: fix get_earliest_ideal_height_for_version() to support ↵stoffu1-0/+25
non-existent versions
2018-05-29Merge pull request #3251luigi11111-2/+4
b9389e5 db_lmdb: save pruned and prunable tx data separately (moneromooo-monero)
2018-05-23db_lmdb: save pruned and prunable tx data separatelymoneromooo-monero1-2/+4
This bumps DB version to 2, migration code will run for v1 DBs
2018-05-21unit_tests: fix build after get_output_didstribution signature changemoneromooo-monero1-1/+1
2018-05-21speed up get_output_distribution (and precalc common case)moneromooo-monero1-0/+1
2018-05-21Revert "Merge pull request #3775"Riccardo Spagni1-1/+1
This reverts commit 20ef37bbcac7715d5299dd77d401583420e07ced, reversing changes made to 40070a661fd2ff503e07f4ed48dfe9fe67cfa297.
2018-04-28unit_tests: fix build after get_output_didstribution signature changemoneromooo-monero1-1/+1
2018-03-16add RPC to get a histogram of outputs of a given amountmoneromooo-monero1-1/+2
2018-01-26Update 2018 copyrightxmr-eric1-1/+1
2017-12-20Fix exceptions not finding txpool txes when relayingmoneromooo-monero1-1/+1
2017-11-08Protect node privacy by proper filtering in restricted-mode RPC answersbinaryFate1-2/+2
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-09-17Use actual batch size for resize estimatesHoward Chu1-1/+1
And optimize import startup: Remember start_height position during initial count_blocks pass to avoid having to reread entire file again to arrive at start_height
2017-08-20Toggle SAFE syncmode on and off automaticallyHoward Chu1-0/+1
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-19DB cleanupHoward Chu1-1/+1
Hide LMDB-specific stuff behind blockchain_db.h. Nobody besides blockchain_db.cpp should ever be including DB-specific headers any more.
2017-06-11blockchain_db: add a txpool tx getter which returns existencemoneromooo-monero1-0/+1
Avoids exception spam for the "nope, not found" case
2017-06-01Don't copy blockchain for coinbase_tx_sumHoward Chu1-1/+1
Changed Blockchain::for_all_blocks() to for_blocks_range() Operate on blockchain in-place instead of building a copy first.
2017-05-25Move txpool to the databasemoneromooo-monero1-0/+9
Integration could go further (ie, return_tx_to_pool calls should not be needed anymore, possibly other things). poolstate.bin is now obsolete.
2017-03-10fix dependency: put HardFork back to cryptonote_basic, made some ↵kenshi841-1/+1
BlockchainDB functions virtual again to avoid missing symbols error
2017-02-25core: move hardfork back to cryptonote_coremoneromooo-monero1-1/+1
should fix a cross dependency betewen cryptonote_basic and blockchain_db
2017-02-21update copyright year, fix occasional lack of newline at line endRiccardo Spagni1-1/+1
2017-02-21Merge pull request #1758Riccardo Spagni1-1/+2
5664826a unit_tests: hardfork unit test now needs get_block_blob_from_height (moneromooo-monero)
2017-02-21unit_tests: hardfork unit test now needs get_block_blob_from_heightmoneromooo-monero1-1/+2
2017-02-21More for PR #1724Howard Chu1-1/+1
Fix unit_tests build (get_output_key API change)
2017-02-13blockchain_db: add "raw" blobdata getters for block and transactionmoneromooo-monero1-1/+3
This speeds up operations such as serving blocks to syncing peers
2017-02-08extract some basic code from libcryptonote_core into libcryptonote_basickenshi841-1/+1
2017-01-21unit_tests: fix missing return after batch_start prototype changemoneromooo-monero1-1/+1
2017-01-15Merge pull request #1506Riccardo Spagni1-1/+1
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-14Use batch transactions when syncingHoward Chu1-1/+1
Faster throughput while avoiding corruption. I.e., makes running with --db-sync-mode safe more tolerable.
2017-01-07blockchain: allow marking "tx not found" without an exceptionmoneromooo-monero1-0/+1
This is a normal occurence in many cases, and there is no need to spam the log with those when it is.
2016-11-23Fixed undefined behavior in TestDBLee Clagett1-2/+2
2016-10-19unit_tests: fix build after get_output_histogram signature changemoneromooo-monero1-1/+1
2016-08-31core: faster find_blockchain_supplementmoneromooo-monero1-1/+1
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-28move the rct commitments to the output_amounts databasemoneromooo-monero1-5/+1
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-28blockchain_db: add functions for adding/removing/getting rct commitmentsmoneromooo-monero1-0/+4
2016-08-11Fake outs set is now decided by the walletmoneromooo-monero1-3/+3
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-07-13remove hf_starting_height dbmoneromooo-monero1-31/+1
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-05-18fix: error: -Werror=misleading-indentationmoneroexample1-1/+3
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-04-05Merge branch 'performance' into masterHoward Chu1-4/+5
2016-04-05CleanupHoward Chu1-4/+5
drop obsolete remove_output() fix get_output_key(global), fix crash in blockchain_dump
2016-03-26tests: obligatory hardfork unit build fix after interface changemoneromooo-monero1-1/+1
2016-03-26New RPC and daemon command to get output histogrammoneromooo-monero1-0/+1
This is a list of existing output amounts along with the number of outputs of that amount in the blockchain. The daemon command takes: - no parameters: all outputs with at least 3 instances - one parameter: all outputs with at least that many instances - two parameters: all outputs within that many instances The default starts at 3 to avoid massive spamming of all dust outputs in the blockchain, and is the current minimum mixin requirement. An optional vector of amounts may be passed, to request histogram only for those outputs.
2016-03-05unit_tests: fix hard fork unit test compilationwarptangent1-1/+1
Match changed BlockchainDB function declaration.
2016-02-08unit_tests: fix hard fork unit test compilationmoneromooo-monero1-0/+4
2016-02-01unit_tests: fix hard fork unit tests and add a test for major toomoneromooo-monero1-30/+68
2016-01-16Fix 30f92f5630bbc7507708275a29a9ae7acf633a5bHoward Chu1-0/+1
Needed to add the corresponding (dummy) method to unit test hardfork
2016-01-02unit_tests: initialize db object in ctor, not openmoneromooo-monero1-1/+2
open isn't actually called in those tests
2015-12-31updated copyright yearRiccardo Spagni1-1/+1
2015-12-30unit_tests: remove an unused variablemoneromooo-monero1-1/+0
2015-12-30unit_tests: fix hardfork test buildmoneromooo-monero1-0/+1
The dummy blockchain class needed to have the newly added is_read_only virtual function.
2015-12-24unit_tests: fix hard fork testsmoneromooo-monero1-1/+2
A couple stopped passing when the hard fork code was made to reject incoming hard fork versions it did not know about.
2015-12-05blockchain_db: make the indexing base a BlockchainDB virtual functionmoneromooo-monero1-0/+1
2015-11-24hardfork: fix more major/minor issuesmoneromooo-monero1-44/+57
Also add some more tests, and rename some instances of "version" and "add" for clarity. NOTE: the starting height values are sometimes wrong. I suspect this is due to the hard fork reorg code being buggy, since they're good when syncing after the fact. However, they're not actually used by the consensus code, so I'm ignoring this for now, but this needs debugging.
2015-11-10hardfork: add a get_ideal_version(uint64_t) functionmoneromooo-monero1-0/+22
It returns the ideal version for a given height, which is based on the minimum height for a fork, disregarding votes
2015-11-08hardfork: allow per-fork voting thresholdsmoneromooo-monero1-0/+28
And setup the first fork to not vote
2015-10-27Remove some old/obsolete/unused codemoneromooo-monero1-1/+0
git history's here if needed to get any of this back
2015-10-26Build fixes for the old blockchain_storage versionmoneromooo-monero1-0/+5
2015-10-21hardfork: switch voting to block minor versionmoneromooo-monero1-4/+1
Using major version would cause older daemons to reject those blocks as they fail to deserialize blocks with a major version which is not 1. There is no such restriction on the minor version, so switching allows older daemons to coexist with newer ones till the actual fork date, when most will hopefully have updated already. Also, for the same reason, we consider a vote for 0 to be a vote for 1, since older daemons set minor version to 0.
2015-10-21unit_tests: remove leftover debug traces in hardfork testmoneromooo-monero1-2/+0
2015-09-27hardfork: rescan speedupmoneromooo-monero1-8/+8
Add a block height before which version 1 is assumed Use DB transactions
2015-09-27hardfork: change window semantics to not count the newly added blockmoneromooo-monero1-10/+13
This allows knowing the hard fork a block must obey in order to be added to the blockchain. The previous semantics would use that new block's version vote to determine this hard fork, which made it impossible to use the rules to validate transactions entering the tx pool (and made it impossible to validate a block before adding it to the blockchain).
2015-09-20hardfork: most state now saved to the DBmoneromooo-monero1-142/+200
There will be a delay on first load of an existing blockchain as it gets reparsed for this state data.
2015-09-12New hardfork classmoneromooo-monero1-0/+394
This keeps track of voting via block version, in order to decide when to enable a particular fork's code.