summaryrefslogtreecommitdiff
path: root/src/blockchain_db/blockchain_db.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Avoid some temporary strings when reading off the databasemoneromooo-monero2020-08-171-3/+4
|
* Merge pull request #6354Alexander Blair2020-08-091-11/+32
|\ | | | | | | 67ade8005 Add randomized delay when forwarding txes from i2p/tor -> ipv4/6 (Lee Clagett)
| * Add randomized delay when forwarding txes from i2p/tor -> ipv4/6Lee Clagett2020-05-151-11/+32
| |
* | Update copyright year to 2020SomaticFanatic2020-05-061-1/+1
|/ | | | Update copyright year to 2020
* Adding Dandelion++ support to public networks:Lee Clagett2020-03-261-3/+23
| | | | | | - New flag in NOTIFY_NEW_TRANSACTION to indicate stem mode - Stem loops detected in tx_pool.cpp - Embargo timeout for a blackhole attack during stem phase
* Change to Tx diffusion (Dandelion++ fluff) instead of floodingLee Clagett2019-11-041-3/+3
|
* Adding support for hidden (anonymity) txpoolLee Clagett2019-11-021-0/+84
|
* Removed Berkeley DB and db switching logicJesus Ramirez2019-09-161-50/+2
|
* blockchain_db: fix db txn ending too earlymoneromooo-monero2019-04-141-4/+0
| | | | | | | | | | The db txn in add_block ending caused the entire overarching batch txn to stop. Also add a new guard class so a db txn can be stopped in the face of exceptions. Also use a read only db txn in init when the db itself is read only, and do not save the max tx size in that case.
* Update 2019 copyrightbinaryFate2019-03-051-1/+1
|
* Avoid repeated (de)serialization when syncingmoneromooo-monero2019-03-051-8/+12
|
* ArticMine's new block weight algorithmmoneromooo-monero2019-03-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Pruningmoneromooo-monero2019-01-221-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* blockchain_db: allocate known size vector only oncemoneromooo-monero2018-12-051-5/+5
|
* v8: per byte fee, pad bulletproofs, fixed 11 ring sizemoneromooo-monero2018-09-111-2/+2
|
* core: sync database based on bytes added, not blocks addedmoneromooo-monero2018-08-121-2/+2
| | | | | Blocks have a very wide range, whereas actual size is the relevant quantity to consider when syncing
* db: store cumulative rct output distribution in the db for speedmoneromooo-monero2018-07-131-1/+10
| | | | | | | | | 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.
* db_lmdb: save pruned and prunable tx data separatelymoneromooo-monero2018-05-231-3/+10
| | | | This bumps DB version to 2, migration code will run for v1 DBs
* Update 2018 copyrightxmr-eric2018-01-261-1/+1
|
* fix a few leaks by throwing objects, not newed pointers to objectsmoneromooo-monero2017-12-181-5/+5
|
* move includes around to lessen overall loadmoneromooo-monero2017-12-161-0/+1
|
* blockchain_db: sanity check on tx/hash vector sizesflozilla2017-11-151-0/+4
| | | | | It could trip on a corrupt/crafted file if the user has disabled input verification.
* remove "using namespace std" from headersmoneromooo-monero2017-11-141-1/+1
| | | | | | | It's nasty, and actually breaks on Solaris, where if.h fails to build due to: struct map *if_memmap;
* move db specific options to BlockchainDBmoneromooo-monero2017-08-291-0/+24
| | | | | Avoids common depending on blockchain_db, which can cause link errors.
* More DB support cleanupHoward Chu2017-08-201-0/+32
| | | | | | | | Hide DB types from db_types.h - no reason to recompile dependencies when DB types change. Also remove lingering in-memory DB references, they've been obsolete since 9e82b694da120708652871b55f639d1ef306a7ec
* DB cleanupHoward Chu2017-08-191-0/+16
| | | | | Hide LMDB-specific stuff behind blockchain_db.h. Nobody besides blockchain_db.cpp should ever be including DB-specific headers any more.
* some include cleanupmoneromooo-monero2017-07-311-0/+1
|
* update copyright year, fix occasional lack of newline at line endRiccardo Spagni2017-02-211-1/+1
|
* blockchain_db: add "raw" blobdata getters for block and transactionmoneromooo-monero2017-02-131-0/+39
| | | | This speeds up operations such as serving blocks to syncing peers
* db_lmdb: fix bad height saved in tx datamoneromooo-monero2017-02-111-6/+6
| | | | | | | | | | | | | The recent change to not keep separate track of the blockchain height caused the reported height to jump early in the lmdb transaction (when the block data is added to the blocks table), rather than at the end, after everything succeeded. Since the block data is added before the transaction data, this caused the transaction data to be saved with a height one more than its expected value. Fix this by saving the block data last. This should have no side effects.
* extract some basic code from libcryptonote_core into libcryptonote_basickenshi842017-02-081-1/+1
|
* Fix PR#1506, off by one in chain heightHoward Chu2017-01-161-3/+2
|
* Change logging to easylogging++moneromooo-monero2017-01-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the epee and data_loggers logging systems with a single one, and also adds filename:line and explicit severity levels. Categories may be defined, and logging severity set by category (or set of categories). epee style 0-4 log level maps to a sensible severity configuration. Log files now also rotate when reaching 100 MB. To select which logs to output, use the MONERO_LOGS environment variable, with a comma separated list of categories (globs are supported), with their requested severity level after a colon. If a log matches more than one such setting, the last one in the configuration string applies. A few examples: This one is (mostly) silent, only outputting fatal errors: MONERO_LOGS=*:FATAL This one is very verbose: MONERO_LOGS=*:TRACE This one is totally silent (logwise): MONERO_LOGS="" This one outputs all errors and warnings, except for the "verify" category, which prints just fatal errors (the verify category is used for logs about incoming transactions and blocks, and it is expected that some/many will fail to verify, hence we don't want the spam): MONERO_LOGS=*:WARNING,verify:FATAL Log levels are, in decreasing order of priority: FATAL, ERROR, WARNING, INFO, DEBUG, TRACE Subcategories may be added using prefixes and globs. This example will output net.p2p logs at the TRACE level, but all other net* logs only at INFO: MONERO_LOGS=*:ERROR,net*:INFO,net.p2p:TRACE Logs which are intended for the user (which Monero was using a lot through epee, but really isn't a nice way to go things) should use the "global" category. There are a few helper macros for using this category, eg: MGINFO("this shows up by default") or MGINFO_RED("this is red"), to try to keep a similar look and feel for now. Existing epee log macros still exist, and map to the new log levels, but since they're used as a "user facing" UI element as much as a logging system, they often don't map well to log severities (ie, a log level 0 log may be an error, or may be something we want the user to see, such as an important info). In those cases, I tried to use the new macros. In other cases, I left the existing macros in. When modifying logs, it is probably best to switch to the new macros with explicit levels. The --log-level options and set_log commands now also accept category settings, in addition to the epee style log levels.
* New "Halfway RingCT" outputs for coinbase transactionsmoneromooo-monero2016-08-281-2/+17
| | | | | | | | | | | | | | | When RingCT is enabled, outputs from coinbase transactions are created as a single output, and stored as RingCT output, with a fake mask. Their amount is not hidden on the blockchain itself, but they are then able to be used as fake inputs in a RingCT ring. Since the output amounts are hidden, their "dustiness" is not an obstacle anymore to mixing, and this makes the coinbase transactions a lot smaller, as well as helping the TXO set to grow more slowly. Also add a new "Null" type of rct signature, which decreases the size required when no signatures are to be stored, as in a coinbase tx.
* move the rct commitments to the output_amounts databasemoneromooo-monero2016-08-281-3/+2
| | | | | | | | | | | | | | | | | | | 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.
* add rct to the protocolmoneromooo-monero2016-08-281-0/+2
| | | | | It is not yet constrained to a fork, so don't use on the real network or you'll be orphaned or rejected.
* Cleanup and clarifyHoward Chu2016-04-051-7/+3
| | | | Try to rationalize the variable names, document usage.
* Schema update: tx_indices - yet less indirectionwarptangent2016-04-051-2/+2
|
* Update schema for "tx_outputs" to use array containing amount output indiceswarptangent2016-04-051-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | This speeds up wallet refresh by directly retrieving a tx's amount output indices. It removes the indirection and walking the amount output duplicate list for every amount in each requested tx. "tx_outputs" is used by: Amount output indices are needed for wallet refresh. Global output indices are needed for removing a tx. Both amount output indices and global output indices are now stored in an array of 64-bit unsigned ints: tx_outputs[<tx_hash>] -> [ <a1_oi, a1_gi, a2_oi, a2_gi, ...> ] Previously it was: tx_outputs[<tx_hash>] -> duplicate list of <a1_gi, a2_gi, a3_gi, ...> The amount output list had to be walked for every amount in order to find each amount's output index, by comparing the amount's global output index with each one in the duplicate list until a match was found. See also d045dfa7ce0bf131681193c97560da26f9f37900
* read txn/cursor stuffHoward Chu2016-02-231-6/+5
| | | | Could wrap more later.
* blockchain_db: pass hard fork object as a simple pointermoneromooo-monero2016-02-081-1/+1
|
* Move HardFork DB update to BlockchainDB::add_block()warptangent2016-02-081-0/+1
| | | | | | | Ensures the database is consistent. Also simplifes blockchain_import in that verify mode off has less to work around.
* Make HardFork object available to BlockchainDB and derived DB implementationswarptangent2016-02-081-0/+5
| | | | | | This will later allow the HardFork object's DB update functions to be called when the DB transaction that persists across block add/remove is open.
* BlockchainDB/LMDB: Refactor block-scope DB txn handling for add blockwarptangent2016-02-081-1/+9
| | | | Move block-scope txn start and stop from BlockchainLMDB to BlockchainDB.
* fixed copyrights with bad year referencesRiccardo Spagni2015-12-311-1/+1
|
* BlockchainDB: skip fixup check if read-only databasewarptangent2015-12-261-0/+5
|
* BlockchainDB: Remove txs in reverse orderwarptangent2015-12-241-3/+5
| | | | | | | | Data should be removed in the reverse order it was added. Not doing so breaks assumptions and can cause problems in other DB implementations. This matches the order of tx removal in blockchain_storage::purge_block_data_from_blockchain.
* blockchain_db: fixup missing key images in early DB versionmoneromooo-monero2015-12-061-0/+580
| | | | | | | | | | | Early DB versions did not store key images for inputs if the transaction spending them had no outputs (ie, all fee). This is not correct, as this would allow these outputs to be double spent. This was fixed in 533acc30eda7792c802ea8b6417917fa99b8bc2b a few months ago, but databases having synced blocks 2021612 and 685498 with a faulty version will be missing those key images in the spent keys database. This code checks for this, and adds those key images if they are missing.
* blockchain_db: match tx addition semantics to original codemoneromooo-monero2015-08-111-8/+24
| | | | | | | The original code removed key images from a tx from the blockchain when an non to-key nor gen input was found in that tx. Additionally, the remainder of the tx data was added to the blockchain only after the double spend check passed.
* blockchain_db: store key images for tx without outputs toomoneromooo-monero2015-08-091-10/+7
|