aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-04-04Merge pull request #6347luigi11111-2/+4
fcb06f7 cryptonote_core: skip block notify on blockchain switching rollback (xiphon)
2020-02-28Merge pull request #6211Alexander Blair1-0/+5
5985c5af rpc: add bad-blocks to flush_cache RPC (moneromooo-monero)
2020-02-19cryptonote_core: skip block notify on blockchain switching rollbackxiphon1-2/+4
2019-12-12Merge pull request #6055luigi11111-1/+1
886ed25 blockchain: fix comment wrongly refering to SHA-3 rather than Keccak (moneromooo-monero)
2019-12-02rpc: add bad-blocks to flush_cache RPCmoneromooo-monero1-0/+5
Flushes m_invalid_blocks in Blockchain.
2019-11-02Adding support for hidden (anonymity) txpoolLee Clagett1-4/+5
2019-10-29blockchain: fix comment wrongly refering to SHA-3 rather than Keccakmoneromooo-monero1-1/+1
2019-10-08Merge pull request #5915luigi11111-8/+24
8330e77 monerod can now sync from pruned blocks (moneromooo-monero)
2019-09-27monerod can now sync from pruned blocksmoneromooo-monero1-8/+24
If the peer (whether pruned or not itself) supports sending pruned blocks to syncing nodes, the pruned version will be sent along with the hash of the pruned data and the block weight. The original tx hashes can be reconstructed from the pruned txes and theur prunable data hash. Those hashes and the block weights are hashes and checked against the set of precompiled hashes, ensuring the data we received is the original data. It is currently not possible to use this system when not using the set of precompiled hashes, since block weights can not otherwise be checked for validity. This is off by default for now, and is enabled by --sync-pruned-blocks
2019-09-25RandomX integrationHoward Chu1-0/+17
Support RandomX PoW algorithm
2019-09-19core: move hardforks into its own libmoneromooo-monero1-7/+0
So it can be used by others without encumbrance
2019-09-14Merge pull request #5823luigi11111-1/+2
26072f1 blockchain: forbid v1 coinbase from v12 (moneromooo-monero) 555dc7c core: from v12, require consistent ring size for mixable txes (moneromooo-monero) d22dfb7 blockchain: reject rct signatures in coinbase txes from v12 (moneromooo-monero)
2019-08-19Merge pull request #5721luigi11111-7/+6
c164f90 Remove unnecessary m_check_txin_table, fix const correctness (omartijn)
2019-08-19blockchain: forbid v1 coinbase from v12moneromooo-monero1-1/+2
2019-08-14Merge pull request #5525luigi11111-2/+2
0605406 daemon: sort alt chains by height (moneromooo-monero) 4228ee0 daemon: add optional arguments to alt_chain_info (moneromooo-monero) 880ebfd daemon: add more chain specific info in alt_chain_info (moneromooo-monero)
2019-07-24Merge pull request #5524luigi11111-27/+4
06b8f29 blockchain: keep alternative blocks in LMDB (moneromooo-monero)
2019-07-03Remove unnecessary m_check_txin_table, fix const correctnessMartijn Otto1-7/+6
2019-05-25core: do not commit half constructed batch db txnmoneromooo-monero1-0/+3
2019-05-09daemon: sort alt chains by heightmoneromooo-monero1-2/+2
2019-05-08blockchain: keep alternative blocks in LMDBmoneromooo-monero1-27/+4
Alternative blocks are cleared on startup unless --keep-alt-blocks is passed on the command line
2019-05-02blockchain: keep a rolling long term block weight medianmoneromooo-monero1-6/+7
2019-04-15rpc: fix get_block_hashes.bin from wallet on pruned blockchainmoneromooo-monero1-1/+2
We want to get all blocks here, even pruned ones
2019-04-11functional_tests: add more blockchain related testsmoneromooo-monero1-3/+17
Related to emission, reorgs, getting tx data back, output distribution and histogram
2019-04-11Merge pull request #5373Riccardo Spagni1-1/+2
aff80e70 blockchain: fix returned height in create_block_template (moneromooo-monero)
2019-04-01Merge pull request #5352Riccardo Spagni1-0/+2
ae6885f6 blockchain: incremental long term block weight cache (moneromooo-monero) 9b687c78 blockchain: simple cache for the long term block weights (moneromooo-monero)
2019-03-30blockchain: fix returned height in create_block_templatemoneromooo-monero1-1/+2
It's now needed for CNv4, and was not retained when cached
2019-03-28blockchain: simple cache for the long term block weightsmoneromooo-monero1-0/+2
2019-03-24Make difficulty 128 bit instead of 64 bitmoneromooo-monero1-1/+1
Based on Boolberry work by: jahrsg <jahr@jahr.me> cr.zoidberg <crypto.zoidberg@gmail.com>
2019-03-21Merge pull request #5256Riccardo Spagni1-2/+13
4b21d38d blockchain: speed up getting N blocks weights/long term weights (moneromooo-monero)
2019-03-08blockchain: speed up getting N blocks weights/long term weightsmoneromooo-monero1-2/+13
2019-03-05Update 2019 copyrightbinaryFate1-1/+1
2019-03-05core: avoid double parsing blocks after hohmoneromooo-monero1-2/+3
2019-03-05Avoid repeated (de)serialization when syncingmoneromooo-monero1-1/+1
2019-03-04ArticMine's new block weight algorithmmoneromooo-monero1-2/+16
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-01-28blockchain: add --reorg-notifymoneromooo-monero1-1/+9
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-22Pruningmoneromooo-monero1-0/+6
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-16Merge pull request #5015Riccardo Spagni1-1/+1
6f2081f8 cryptonote_core: revert extra_tx_map (moneromooo-monero)
2019-01-16Merge pull request #4984Riccardo Spagni1-0/+2
008647d7 blockchain_db: speedup tx output gathering (moneromooo-monero)
2018-12-31Merge pull request #4940luigi11111-0/+5
9e64a71 blockchain: call deinit in dtor (moneromooo-monero)
2018-12-25cryptonote_core: revert extra_tx_mapmoneromooo-monero1-1/+1
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-18blockchain_db: speedup tx output gatheringmoneromooo-monero1-0/+2
We know all the data we'll want for getblocks.bin is contiguous
2018-12-12Merge pull request #4909Riccardo Spagni1-2/+2
756684bb blockchain: avoid unnecessary DB lookups when syncing (moneromooo-monero)
2018-12-05blockchain: call deinit in dtormoneromooo-monero1-0/+5
This ensures the io service that runs in another thread cannot access data after it's deleted
2018-11-28add command pop_blocksJason Wong1-0/+7
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-27blockchain: avoid unnecessary DB lookups when syncingmoneromooo-monero1-2/+2
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-04blockchain: remove unused output_scan_worker parametermoneromooo-monero1-3/+1
2018-11-01core: avoid unnecessary tx/blob conversionsmoneromooo-monero1-1/+1
2018-10-26Merge pull request #4536Riccardo Spagni1-2/+16
fd62b6e7 blocks: use auto-generated .c files instead of 'LD -r -b binary' (xiphon)
2018-10-26Merge pull request #4408Riccardo Spagni1-0/+5
341b3931 cryptonote_core: warn when the block rate deviates from expectations (moneromooo-monero)
2018-10-22blocks: use auto-generated .c files instead of 'LD -r -b binary'xiphon1-2/+16
2018-10-08Revert "Merge pull request #4472"Riccardo Spagni1-16/+2
This reverts commit 79d46c4d551a9b1261801960095bf4d24967211a, reversing changes made to c9fc61dbb56cca442c775faa2554a7460879b637.
2018-10-04blocks: use auto-generated .c files instead of 'LD -r -b binary'xiphon1-2/+16
2018-09-29Merge pull request #4333Riccardo Spagni1-0/+11
73403004 add --block-notify to monerod and --tx-notify to monero-wallet-{cli,rpc} (moneromooo-monero)
2018-09-20cryptonote_core: warn when the block rate deviates from expectationsmoneromooo-monero1-0/+5
The warning threshold is set to allow a false positive every ten days on average.
2018-09-14remove obsolete daemon selection of fake outs and old tx constructionmoneromooo-monero1-61/+0
2018-09-11v8: per byte fee, pad bulletproofs, fixed 11 ring sizemoneromooo-monero1-33/+44
2018-08-22Merge pull request #4204luigi11111-3/+6
b278b83 core: sync database based on bytes added, not blocks added (moneromooo-monero)
2018-08-16core: cache block template where possiblemoneromooo-monero1-0/+21
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-12core: sync database based on bytes added, not blocks addedmoneromooo-monero1-3/+6
Blocks have a very wide range, whereas actual size is the relevant quantity to consider when syncing
2018-07-19Merge pull request #3973luigi11111-1/+1
50af357 alt_chain_info can now give more info about a particular alt chain (moneromooo-monero)
2018-07-19Merge pull request #3854luigi11111-1/+10
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-06-29add --regtest and --fixed-difficulty for regression testingvictorsintnicolaas1-1/+10
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-26rpc: rework to avoid repeated calculations in get_blocks.binmoneromooo-monero1-1/+1
2018-06-26replace std::list with std::vector on some hot pathsmoneromooo-monero1-8/+8
also use reserve where appropriate
2018-06-26alt_chain_info can now give more info about a particular alt chainmoneromooo-monero1-1/+1
2018-06-08Merge pull request #3450luigi11111-0/+7
3b941be core: add get_earliest_ideal_height_for_version() (stoffu)
2018-05-30Merge pull request #3731luigi11111-2/+5
a66f152 Use median timestamp if current time renders a block invalid. (thaerkh)
2018-05-29Merge pull request #3251luigi11111-3/+6
b9389e5 db_lmdb: save pruned and prunable tx data separately (moneromooo-monero)
2018-05-29Merge pull request #3420luigi11111-0/+4
a6a54fa blockchain: cache difficulty for next block (moneromooo-monero)
2018-05-23db_lmdb: save pruned and prunable tx data separatelymoneromooo-monero1-3/+6
This bumps DB version to 2, migration code will run for v1 DBs
2018-05-21speed up get_output_distribution (and precalc common case)moneromooo-monero1-2/+3
2018-05-13Use median timestamp if current time renders a block invalid.Thaer Khawaja1-2/+5
2018-04-23speedup get_output_histogram for all amounts when min_count > 0moneromooo-monero1-1/+2
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-03-21core: add get_earliest_ideal_height_for_version()stoffu1-0/+7
2018-03-19blockchain: cache difficulty for next blockmoneromooo-monero1-0/+4
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-16add RPC to get a histogram of outputs of a given amountmoneromooo-monero1-1/+22
2018-03-14Remove the `Blockchain::get_all_known_block_ids` function.Jean Pierre Dudey1-9/+0
This function isn't used in the codebase. Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-03-05Stagenetstoffu1-5/+5
2018-01-27Merge pull request #3144Riccardo Spagni1-0/+8
42f86624 rpc: expose recent median block size in getinfo (moneromooo-monero)
2018-01-26Update 2018 copyrightxmr-eric1-1/+1
2018-01-17rpc: expose recent median block size in getinfomoneromooo-monero1-0/+8
2018-01-10Merge pull request #2971Riccardo Spagni1-1/+1
ae860230 Fix exceptions not finding txpool txes when relaying (moneromooo-monero)
2017-12-20Fix exceptions not finding txpool txes when relayingmoneromooo-monero1-1/+1
2017-12-18cryptonote_core: remove unused functions with off by one bugsmoneromooo-monero1-26/+0
2017-11-30core: make --offline also disable DNS lookupsmoneromooo-monero1-2/+5
2017-11-14rpc: remove obsolete busy core checksmoneromooo-monero1-10/+0
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-10-15Merge pull request #2552Riccardo Spagni1-0/+7
69ce33f2 core: fix failure to sync when a tx is already in the pool (moneromooo-monero)
2017-10-15Merge pull request #2469Riccardo Spagni1-0/+2
7adceee6 precomputed block hashes are now in blocks of N (currently 256) (moneromooo-monero)
2017-09-29core: fix failure to sync when a tx is already in the poolmoneromooo-monero1-0/+7
2017-09-25move checkpoints in a separate librarymoneromooo-monero1-1/+1
2017-09-18precomputed block hashes are now in blocks of N (currently 256)moneromooo-monero1-0/+2
This shaves a lot of space off binaries
2017-09-05Refactor some things into more composable (smaller) functionsThomas Winget1-0/+56
This commit refactors some of the rpc-related functions in the Blockchain class to be more composable. This change was made in order to make implementing the new zmq rpc easier without trampling on the old rpc. New functions: Blockchain::get_num_mature_outputs Blockchain::get_random_outputs Blockchain::get_output_key Blockchain::get_output_key_mask_unlocked Blockchain::find_blockchain_supplement (overload) functions which previously had this functionality inline now call these functions as necessary.
2017-08-31DRY refactoringThomas Winget1-0/+7
2017-08-20Toggle SAFE syncmode on and off automaticallyHoward Chu1-0/+7
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-15protocol: pass blockchain cumulative difficulty when syncingmoneromooo-monero1-0/+10
Not used yet.
2017-08-15Merge pull request #2246Riccardo Spagni1-3/+1
d732c73e blockchain: remove a few unused variables (moneromooo-monero)
2017-08-09protocol: add checks for top block hard fork versionmoneromooo-monero1-0/+9
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-07Merge pull request #2225Riccardo Spagni1-0/+3
5d91b26c blockchain: skip checking tx semantics in embedded block hash range (moneromooo-monero)
2017-08-03blockchain: remove a few unused variablesmoneromooo-monero1-3/+1
2017-07-30blockchain: skip checking tx semantics in embedded block hash rangemoneromooo-monero1-0/+3
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-27blockchain: ensure all blocks get their longhash precalculatedmoneromooo-monero1-1/+1
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-06-23Fix mismatch of parameter name between header file and implementation for ↵Julien Klepatch1-3/+2
set_user_options()
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-2/+4
Changed Blockchain::for_all_blocks() to for_blocks_range() Operate on blockchain in-place instead of building a copy first.
2017-05-30Merge pull request #1982Riccardo Spagni1-1/+12
b52abd13 Move txpool to the database (moneromooo-monero)
2017-05-25Move txpool to the databasemoneromooo-monero1-1/+12
Integration could go further (ie, return_tx_to_pool calls should not be needed anymore, possibly other things). poolstate.bin is now obsolete.
2017-04-19Add expected total reward to RPC "getblocktemplate".assylias1-1/+2
Only works from V5 fork onward - returns 0 before that block.
2017-03-18Removed boost/asio.hpp include from epee/string_tools.hLee Clagett1-0/+1
2017-03-15Add intervening v5 fork for increased min block sizemoneromooo-monero1-1/+2
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-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-13blockchain_db: add "raw" blobdata getters for block and transactionmoneromooo-monero1-4/+5
This speeds up operations such as serving blocks to syncing peers
2017-02-08extract some basic code from libcryptonote_core into libcryptonote_basickenshi841-6/+6
2017-01-22Remove boost/foreach.cpp includesMiguel Herranz1-1/+0
2017-01-22rpc: fix orphan_status when getting blocksmoneromooo-monero1-1/+2
It was always set to false, even for orphan blocks
2016-12-17rpc: new function and RPC to get alternative chain infomoneromooo-monero1-0/+7
2016-12-04Fix delayed exit when syncingmoneromooo-monero1-0/+5
2016-11-22Add a get_outs (fully text based) version of get_outs.binmoneromooo-monero1-1/+1
2016-10-31rpc: add a dynamic fee estimation RPC callmoneromooo-monero1-0/+14
2016-10-31core: dynamic fee algorithm from ArticMinemoneromooo-monero1-0/+27
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-15wallet: select part of the fake outs from recent outputsmoneromooo-monero1-1/+2
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-08-28rct: rework the verification preparation processmoneromooo-monero1-2/+13
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-28add rct to the protocolmoneromooo-monero1-4/+8
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-28core: new /getrandom_rctouts.bin binary RPC callmoneromooo-monero1-0/+25
to get random ringct outputs to mix with
2016-08-12daemon: print time to next forkmoneromooo-monero1-0/+7
2016-08-11Fake outs set is now decided by the walletmoneromooo-monero1-0/+15
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-01new unlocked parameter to output_histogrammoneromooo-monero1-1/+2
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-04-06blockchain: remove the tx validation result cachemoneromooo-monero1-1/+0
As pointed out by smooth, a transaction's validity may change over time as the blockchain changes.
2016-04-02Merge pull request #767Riccardo Spagni1-3/+6
24b3e90 Convey tx verification failure reasons to the RPC client (moneromooo-monero)
2016-03-27Merge pull request #765Riccardo Spagni1-0/+9
d5d46e6 tests: obligatory hardfork unit build fix after interface change (moneromooo-monero) 25672d3 wallet: pass std::function by const ref, not value (moneromooo-monero) 0be6e08 wallet: do not leak owned amounts to the daemon unless --trusted-daemon (moneromooo-monero) 12146da wallet: change sweep_dust to sweep_unmixable (moneromooo-monero) 600a3cf New RPC and daemon command to get output histogram (moneromooo-monero) f9a2fd2 wallet: handle rare case where fee adjustment can bump to the next kB (moneromooo-monero) f26651a wallet: factor fee calculation (moneromooo-monero)
2016-03-27Convey tx verification failure reasons to the RPC clientmoneromooo-monero1-3/+6
This allows appropriate action to be taken, like displaying the reason to the user. Do just that in simplewallet, which should help a lot in determining why users fail to send. Also make it so a tx which is accepted but not relayed is seen as a success rather than a failure.
2016-03-26New RPC and daemon command to get output histogrammoneromooo-monero1-0/+9
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-25blockchain: for v3, require miner tx to have well behaved outsmoneromooo-monero1-1/+2
This was meant to go in v2, but the miner tx slipped through the cracks as it doesn't go through the main tx verification since it doesn't get added to the pool.
2016-03-25Merge pull request #749Riccardo Spagni1-15/+875
bfd4a28 Update BlockchainDB documentation (Thomas Winget) 797357e Change Doxyfile, Blockchain not blockchain_storage (Thomas Winget) c835215 remove defunct code from cryptonote::core (Thomas Winget) 50dba6d cryptonote::core doxygen documentation (Thomas Winget) 8ac329d doxygen documentation for difficulty functions (Thomas Winget) 540a76c Move checkpoint functions into checkpoints class (Thomas Winget) 1b0c98e doxygen documentation for checkpoints.{h,cpp} (Thomas Winget) 89c24ac Remove unnecessary or defunct code (Thomas Winget) ab0ed14 doxygen include private and static members (Thomas Winget) 3a48449 Updated documentation for blockchain.* (Thomas Winget)
2016-03-25Revert "Merge pull request #749"Riccardo Spagni1-875/+15
This reverts commit 7fa63a82a1c3a0243f6757c1689855ed3ca61695, reversing changes made to cb6be986c36b78eddb4b7f16e9ad440af8567dc4.
2016-03-22Remove unnecessary or defunct codeThomas Winget1-21/+0
2016-03-22Updated documentation for blockchain.*Thomas Winget1-9/+890
All functions are now documented in doxygen format. Comments have been updated to reflect the current state of the code. Many areas for improvement in clarity and design have been noted, as well as cruft to be removed. These changes are not reflected in this commit both to allow time for comment and to keep commits organized by purpose.
2016-02-08core_tests: add tests for hard fork behaviors (MRL-0004)moneromooo-monero1-2/+3
We also replace the --fakechain option with an optional structure containing details about configuration for the core/blockchain, for test purposes. This seems more future friendly.
2016-02-08Blockchain: Optionally pass in HardFork objectwarptangent1-0/+1
2016-02-02minor bugfixes and refactoringThomas Winget1-0/+11
- Blockchain should store if it's running on testnet or not - moved loading compiled-in block hashes to its own function for clarity - on handle_get_objects, should now correctly return false if a block's transactions are missing - replace instances of BOOST_FOREACH with C++11 for loops in Blockchain.
2016-01-30new flush_txpool command, and associated RPC callmoneromooo-monero1-0/+2
It can flush a particular tx, or the whole pool (the RPC command can flush a list of transactions too)
2015-12-31updated copyright yearRiccardo Spagni1-1/+1
2015-12-26blockchain: remove obsolete containersmoneromooo-monero1-3/+0
2015-12-25blockchain: fix a few block addition bugsmoneromooo-monero1-0/+1
If the block reward was too high, the verification failed flag was set, but the function continued. The code which was supposed to trap this flag and return failure failed to trap it, and, while the block was not added to the chain, the function would return success. The reason for avoiding returning when the block reward problem was detected was to be able to return any transactions to the pool if needed. This is now mooted by moving the transaction return code to a separate function, which is now called at all appropriate points, making the logic much simpler, and hopefully correct now. We also move the hard fork version check after the prev_id check, as block which does not go on the top of the chain might not have the expected version there, without being invalid just for this reason. Last, we trap the case where a block fails to be added due to using already spent key images, to set the verification failed flag.
2015-12-25blockchain: fix bitflipping test with quantized block rewardsmoneromooo-monero1-1/+1
Block reward may now be less than the full amount allowed. This was breaking the bitflipping test. We now keep track of whether a block which was accepted by the core has a lower than allowed block reward, and allow this in the test.
2015-12-19Allow the wallet to access hard fork informationmoneromooo-monero1-1/+1
And make it change behavior slightly when close/after first hard fork
2015-12-15Replace tabs with two spaces for consistency with rest of codebasewarptangent1-32/+32
Remove trailing whitespace in same files.
2015-12-13add a --fakechain argument for testsmoneromooo-monero1-1/+1
The core tests use the blockchain, and reset it to be able to add test data to it. This does not play nice with the databases, since those will save that data without an explicit save call. We add a fakechain flag that the tests will set, which tells the core and blockchain code to use a separate database, as well as skip a few things like checkpoints and fixup, which only make sense for real data.
2015-11-13More changes for 2-min blocksJavier Smooth1-0/+2
Use the correct block time for realtime fuzz on locktime Use the correct block time to calculate next_difficulty on alt chains (will not work as-is with voting) Lock unit tests to original block time for now
2015-10-27Remove some old/obsolete/unused codemoneromooo-monero1-15/+0
git history's here if needed to get any of this back
2015-10-25Add functions to iterate through blocks, txes, outputs, key imagesmoneromooo-monero1-0/+5
2015-10-11from hard fork 2, all outputs must be decomposedmoneromooo-monero1-0/+1
The wallet decomposes fully as of now too.
2015-09-20hardfork: most state now saved to the DBmoneromooo-monero1-3/+3
There will be a delay on first load of an existing blockchain as it gets reparsed for this state data.
2015-09-19Add an RPC call and daemon command to get info on hard fork votingmoneromooo-monero1-0/+3
2015-09-19core: add consts where appropriatemoneromooo-monero1-3/+3
2015-09-13core: moan when we think an update is needed to get latest hard fork infomoneromooo-monero1-0/+2
2015-09-12blockchain: use the new hardfork classmoneromooo-monero1-2/+5
2015-09-12blockchain: add a couple missing includesmoneromooo-monero1-0/+2
2015-08-11blockchain: remove dead codemoneromooo-monero1-3/+0
2015-07-15Removed on_idle() calls to Blockchain::store_blockchain() for lmdb.NoodleDoodleNoodleDoodleNoodleDoodleNoo1-0/+1
Added option to cache tx-input verification results.
2015-07-15** CHANGES ARE EXPERIMENTAL (FOR TESTING ONLY)NoodleDoodleNoodleDoodleNoodleDoodleNoo1-8/+56
Bockchain: 1. Optim: Multi-thread long-hash computation when encountering groups of blocks. 2. Optim: Cache verified txs and return result from cache instead of re-checking whenever possible. 3. Optim: Preload output-keys when encoutering groups of blocks. Sort by amount and global-index before bulk querying database and multi-thread when possible. 4. Optim: Disable double spend check on block verification, double spend is already detected when trying to add blocks. 5. Optim: Multi-thread signature computation whenever possible. 6. Patch: Disable locking (recursive mutex) on called functions from check_tx_inputs which causes slowdowns (only seems to happen on ubuntu/VMs??? Reason: TBD) 7. Optim: Removed looped full-tx hash computation when retrieving transactions from pool (???). 8. Optim: Cache difficulty/timestamps (735 blocks) for next-difficulty calculations so that only 2 db reads per new block is needed when a new block arrives (instead of 1470 reads). Berkeley-DB: 1. Fix: 32-bit data errors causing wrong output global indices and failure to send blocks to peers (etc). 2. Fix: Unable to pop blocks on reorganize due to transaction errors. 3. Patch: Large number of transaction aborts when running multi-threaded bulk queries. 4. Patch: Insufficient locks error when running full sync. 5. Patch: Incorrect db stats when returning from an immediate exit from "pop block" operation. 6. Optim: Add bulk queries to get output global indices. 7. Optim: Modified output_keys table to store public_key+unlock_time+height for single transaction lookup (vs 3) 8. Optim: Used output_keys table retrieve public_keys instead of going through output_amounts->output_txs+output_indices->txs->output:public_key 9. Optim: Added thread-safe buffers used when multi-threading bulk queries. 10. Optim: Added support for nosync/write_nosync options for improved performance (*see --db-sync-mode option for details) 11. Mod: Added checkpoint thread and auto-remove-logs option. 12. *Now usable on 32-bit systems like RPI2. LMDB: 1. Optim: Added custom comparison for 256-bit key tables (minor speed-up, TBD: get actual effect) 2. Optim: Modified output_keys table to store public_key+unlock_time+height for single transaction lookup (vs 3) 3. Optim: Used output_keys table retrieve public_keys instead of going through output_amounts->output_txs+output_indices->txs->output:public_key 4. Optim: Added support for sync/writemap options for improved performance (*see --db-sync-mode option for details) 5. Mod: Auto resize to +1GB instead of multiplier x1.5 ETC: 1. Minor optimizations for slow-hash for ARM (RPI2). Incomplete. 2. Fix: 32-bit saturation bug when computing next difficulty on large blocks. [PENDING ISSUES] 1. Berkely db has a very slow "pop-block" operation. This is very noticeable on the RPI2 as it sometimes takes > 10 MINUTES to pop a block during reorganization. This does not happen very often however, most reorgs seem to take a few seconds but it possibly depends on the number of outputs present. TBD. 2. Berkeley db, possible bug "unable to allocate memory". TBD. [NEW OPTIONS] (*Currently all enabled for testing purposes) 1. --fast-block-sync arg=[0:1] (default: 1) a. 0 = Compute long hash per block (may take a while depending on CPU) b. 1 = Skip long-hash and verify blocks based on embedded known good block hashes (faster, minimal CPU dependence) 2. --db-sync-mode arg=[[safe|fast|fastest]:[sync|async]:[nblocks_per_sync]] (default: fastest:async:1000) a. safe = fdatasync/fsync (or equivalent) per stored block. Very slow, but safest option to protect against power-out/crash conditions. b. fast/fastest = Enables asynchronous fdatasync/fsync (or equivalent). Useful for battery operated devices or STABLE systems with UPS and/or systems with battery backed write cache/solid state cache. Fast - Write meta-data but defer data flush. Fastest - Defer meta-data and data flush. Sync - Flush data after nblocks_per_sync and wait. Async - Flush data after nblocks_per_sync but do not wait for the operation to finish. 3. --prep-blocks-threads arg=[n] (default: 4 or system max threads, whichever is lower) Max number of threads to use when computing long-hash in groups. 4. --show-time-stats arg=[0:1] (default: 1) Show benchmark related time stats. 5. --db-auto-remove-logs arg=[0:1] (default: 1) For berkeley-db only. Auto remove logs if enabled. **Note: lmdb and berkeley-db have changes to the tables and are not compatible with official git head version. At the moment, you need a full resync to use this optimized version. [PERFORMANCE COMPARISON] **Some figures are approximations only. Using a baseline machine of an i7-2600K+SSD+(with full pow computation): 1. The optimized lmdb/blockhain core can process blocks up to 585K for ~1.25 hours + download time, so it usually takes 2.5 hours to sync the full chain. 2. The current head with memory can process blocks up to 585K for ~4.2 hours + download time, so it usually takes 5.5 hours to sync the full chain. 3. The current head with lmdb can process blocks up to 585K for ~32 hours + download time and usually takes 36 hours to sync the full chain. Averate procesing times (with full pow computation): lmdb-optimized: 1. tx_ave = 2.5 ms / tx 2. block_ave = 5.87 ms / block memory-official-repo: 1. tx_ave = 8.85 ms / tx 2. block_ave = 19.68 ms / block lmdb-official-repo (0f4a036437fd41a5498ee5e74e2422ea6177aa3e) 1. tx_ave = 47.8 ms / tx 2. block_ave = 64.2 ms / block **Note: The following data denotes processing times only (does not include p2p download time) lmdb-optimized processing times (with full pow computation): 1. Desktop, Quad-core / 8-threads 2600k (8Mb) - 1.25 hours processing time (--db-sync-mode=fastest:async:1000). 2. Laptop, Dual-core / 4-threads U4200 (3Mb) - 4.90 hours processing time (--db-sync-mode=fastest:async:1000). 3. Embedded, Quad-core / 4-threads Z3735F (2x1Mb) - 12.0 hours processing time (--db-sync-mode=fastest:async:1000). lmdb-optimized processing times (with per-block-checkpoint) 1. Desktop, Quad-core / 8-threads 2600k (8Mb) - 10 minutes processing time (--db-sync-mode=fastest:async:1000). berkeley-db optimized processing times (with full pow computation) 1. Desktop, Quad-core / 8-threads 2600k (8Mb) - 1.8 hours processing time (--db-sync-mode=fastest:async:1000). 2. RPI2. Improved from estimated 3 months(???) into 2.5 days (*Need 2AMP supply + Clock:1Ghz + [usb+ssd] to achieve this speed) (--db-sync-mode=fastest:async:1000). berkeley-db optimized processing times (with per-block-checkpoint) 1. RPI2. 12-15 hours (*Need 2AMP supply + Clock:1Ghz + [usb+ssd] to achieve this speed) (--db-sync-mode=fastest:async:1000).
2015-05-31cleaning up, removing redundant files, renaming, fixing incorrect licensesRiccardo Spagni1-1/+1
2015-03-25Steps toward multiple dbs available -- workingThomas Winget1-3/+1
There will need to be some more refactoring for these changes to be considered complete/correct, but for now it's working. new daemon cli argument "--db-type", works for LMDB and BerkeleyDB. A good deal of refactoring is also present in this commit, namely Blockchain no longer instantiates BlockchainDB, but rather is passed a pointer to an already-instantiated BlockchainDB on init().
2015-03-22Update Blockchain::get_db() to return reference instead of pointerwarptangent1-2/+2
Where this method is used, a BlockchainDB object is always expected, so a pointer is unnecessary and less safe.
2015-03-16Add support for database open with flagswarptangent1-1/+1
Add support to: - BlockchainDB, BlockchainLMDB - blockchain_import utility to open LMDB database with one or more LMDB flags. Sample use: $ blockchain_import --database lmdb#nosync $ blockchain_import --database lmdb#nosync,nometasync
2015-03-15Blockchain: add get_db() accessor, needed for blockchain_importwarptangent1-0/+5
This handling may be changed in the future.
2015-03-06Moved BlockchainDB into its own src/ subfolderThomas Winget1-1/+1
Ostensibly janitorial work, but should be more relevant later down the line. Things that depend on core cryptonote things (i.e. cryptonote_core) don't necessarily depend on BlockchainDB and thus have no need to have BlockchainDB baked in with them.
2015-02-23Blockchain: match original function declaration from blockchain_storagewarptangent1-1/+1
2015-01-04blockchain: add consts where appropriatemoneromooo-monero1-41/+41
2015-01-04add new checkpointing behavior to Blockchain classThomas Winget1-2/+4
2015-01-04Integrate BlockchainDB into cryptonote_coreThomas Winget1-3/+7
Probably needs more looking at -- lot of things were done...in a rushed sort of way. That said, it all builds and *should* be at least testable. update for rebase (warptangent 2015-01-04) fix conflicts with upstream CMakeLists.txt files src/CMakeLists.txt (remove edits from original commit) tests/CMakeLists.txt (remove edits from original commit) src/cryptonote_core/CMakeLists.txt (edit) - use blockchain db .cpp and .h files - add LMDB_LIBRARIES
2015-01-04update new blockchain to build with new changesThomas Winget1-4/+3
Still need to add in the new checkpointing functionality, as well as touch up a few things, but is okay for now.
2015-01-04import of BlockchainDB filesThomas Winget1-0/+221
tried rebasing, tree-filter, and many other things. at this point, the history of these files previous to this can live on in my bc2 branch, as I'm importing them as-is to here.