aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.cpp (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-03-24Fixed typo in v5 hard fork finalized dateDerek Zhang1-1/+1
2017-03-24blockchain: offset v5 addition date on testnetmoneromooo-monero1-1/+1
to silence the update warning, since v5 was done very early on testnet
2017-03-20blockchain: lower the relay fee by 2%moneromooo-monero1-1/+1
This ensures we accept txes with a fee that's slightly too small, to accomodate blockchain median jitter
2017-03-15Add intervening v5 fork for increased min block sizemoneromooo-monero1-14/+19
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-05blockchain: don't try to load an empty block hash setmoneromooo-monero1-1/+1
If the blocks aren't being linked against a binary (such as one of the blockchain utilities), the symbol will not be NULL, but the size will be 0. This avoids a apurious warning about the data hash.
2017-03-03core: quantize per kB fee to 8 decimalsmoneromooo-monero1-1/+19
2017-02-23core: protect precomputed block hashes with SHA256moneromooo-monero1-1/+28
2017-02-21update copyright year, fix occasional lack of newline at line endRiccardo Spagni1-1/+1
2017-02-21Merge pull request #1727Riccardo Spagni1-22/+69
0288310e blockchain_db: add "raw" blobdata getters for block and transaction (moneromooo-monero)
2017-02-21Merge pull request #1724Riccardo Spagni1-1/+1
cca95c1c blockchain_db: do not throw on expected partial results getting keys (moneromooo-monero)
2017-02-18Add a few read txns to streamlineHoward Chu1-0/+4
Slight perf gain, but mainly to reduce spam at loglevel 3
2017-02-13blockchain_db: add "raw" blobdata getters for block and transactionmoneromooo-monero1-22/+69
This speeds up operations such as serving blocks to syncing peers
2017-02-13blockchain_db: do not throw on expected partial results getting keysmoneromooo-monero1-1/+1
When scanning for outputs used in a set of incoming blocks, we expect that some of the inputs in their transactions will not be found in the blockchain, as they could be in previous blocks in that set. Those outputs will be scanned there at a later point. In this case, we add a flag to control wehther an output not being found is expected or not.
2017-02-08extract some basic code from libcryptonote_core into libcryptonote_basickenshi841-6/+5
2017-01-22Replace BOOST_REVERSE_FOREACH with ranged forMiguel Herranz1-1/+2
2017-01-22rpc: fix orphan_status when getting blocksmoneromooo-monero1-1/+5
It was always set to false, even for orphan blocks
2017-01-16Change logging to easylogging++moneromooo-monero1-128/+132
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.
2017-01-15Merge pull request #1577Riccardo Spagni1-0/+8
feb499aa core: check block version for alt chains too (moneromooo-monero)
2017-01-15Merge pull request #1576Riccardo Spagni1-6/+3
ba3968f6 rct: split rct checks between semantics and other (moneromooo-monero)
2017-01-15Merge pull request #1571Riccardo Spagni1-8/+8
81c384e4 fix do_not_relay not preventing relaying on a timer (moneromooo-monero)
2017-01-15Merge pull request #1565Riccardo Spagni1-0/+2
50b230d1 core: ensure block size limit is set from the start (moneromooo-monero)
2017-01-15Merge pull request #1506Riccardo Spagni1-2/+12
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-14Must wait for previous batch to finish before starting new oneHoward Chu1-1/+6
2017-01-14Use batch transactions when syncingHoward Chu1-2/+7
Faster throughput while avoiding corruption. I.e., makes running with --db-sync-mode safe more tolerable.
2017-01-14core: check block version for alt chains toomoneromooo-monero1-0/+8
This is incompatible with block version voting
2017-01-14rct: split rct checks between semantics and othermoneromooo-monero1-6/+3
Semantics can be checked early
2017-01-14fix do_not_relay not preventing relaying on a timermoneromooo-monero1-8/+8
Also print its value when printing pool
2017-01-13core: ensure block size limit is set from the startmoneromooo-monero1-0/+2
It can now be queried by RPC, so it needs to be set before it is otherwise needed for consensus, even if no blocks had to be added (ie, exit and restart quickly).
2017-01-13Merge pull request #1555Riccardo Spagni1-3/+6
758c0eb7 fix time stats mixin (luigi1111)
2017-01-10fix time stats mixinluigi11111-3/+6
also add blobsize
2017-01-09wallet cli: print originating block heights of mixin keys when making transferkenshi841-1/+1
2017-01-08Merge pull request #1534Riccardo Spagni1-1/+1
1607cb7e tx_pool: better block template filling algorithm (moneromooo-monero) 9731b4e5 rpc: add block size to GET_BLOCK_HEADER RPC (moneromooo-monero) 9188b346 rpc: add current block size to the getinfo call (moneromooo-monero)
2017-01-08Merge pull request #1502Riccardo Spagni1-0/+1
591d8368 core: invalidate difficulty cache when resetting blockchain (moneromooo-monero)
2017-01-08Merge pull request #1493Riccardo Spagni1-5/+5
0478ac68 blockchain: allow marking "tx not found" without an exception (moneromooo-monero)
2017-01-07blockchain: allow marking "tx not found" without an exceptionmoneromooo-monero1-5/+5
This is a normal occurence in many cases, and there is no need to spam the log with those when it is.
2017-01-07tx_pool: better block template filling algorithmmoneromooo-monero1-1/+1
Continue filling until we reach the block size limit, or the resulting coinbase decreases. Also remove old sanity check on block size, which is now not wanted anymore.
2016-12-25core: invalidate difficulty cache when resetting blockchainmoneromooo-monero1-0/+1
2016-12-21add tx hash to time statsluigi11111-2/+5
Also miner tx hash to log level 1 (have you ever tried to find a testnet miner tx hash?)
2016-12-20Merge pull request #1467Riccardo Spagni1-0/+32
55fa0479 rpc: new function and RPC to get alternative chain info (moneromooo-monero)
2016-12-20also use portable serializer for boost_serialization_helper.h and ↵kenshi841-2/+0
net_node.inl, completely adandon boost/archive/binary_oarchive.hpp
2016-12-17rpc: new function and RPC to get alternative chain infomoneromooo-monero1-0/+32
2016-12-13blockchain: fix reorganizations past a hard fork boundarymoneromooo-monero1-0/+3
After popping blocks from the old chain, the hard fork object's notion of the current version was not in line with the new height, causing the first blocks from the new chain to be rejected due to a false expection of a newer version.
2016-12-10Merge pull request #1418Riccardo Spagni1-4/+4
dfbb85b6 blockchain: fix setting non trovial alternate chain as invalid (moneromooo-monero)
2016-12-08blockchain: fix setting non trovial alternate chain as invalidmoneromooo-monero1-4/+4
The wrong iterator was being used. Also preincrement iterators to avoid possibly invalidating them, I'm not sure this is necessary, but let's be safe.
2016-12-06blockchain: bring the v4 fork height one block forwardluigi11111-3/+3
This will ensure the early 0.10 daemons will barf at the fork height, and not a bit later, which could be confusing.
2016-12-04Merge pull request #1398Riccardo Spagni1-3/+3
f4772bae Fix a few minor typos (Pierre Boyer)
2016-12-04Merge pull request #1397Riccardo Spagni1-1/+20
3f7d6fb5 Fix delayed exit when syncing (moneromooo-monero)
2016-12-04Merge pull request #1392Riccardo Spagni1-1/+7
204b1bff blockchain: use high bound block reward on error where appropriate (moneromooo-monero)
2016-12-04Fix a few minor typosPierre Boyer1-3/+3
2016-12-04Fix delayed exit when syncingmoneromooo-monero1-1/+20
2016-12-01blockchain: use high bound block reward on error where appropriatemoneromooo-monero1-1/+7
If the block reward to use for the fee calculation can't be calculated (should not happen in practice), use a high bound, so we use a fee overestimate that will be accepted by the network.
2016-11-28blockchain: reject invalid pubkeys from v4moneromooo-monero1-0/+13
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/+30
2016-10-31core: dynamic fee algorithm from ArticMinemoneromooo-monero1-0/+52
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-2/+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-10-10Add performance timers for ringct tx verificationmoneromooo-monero1-0/+3
2016-10-04Merge pull request #1177Riccardo Spagni1-1/+1
3644aa9 blockchain: avoid using a reference to a temporary (moneromooo-monero)
2016-10-04Merge pull request #1123Riccardo Spagni1-8/+0
0d036be blockchain: do not reject chain histories matching only genesis (moneromooo-monero)
2016-10-03blockchain: avoid using a reference to a temporarymoneromooo-monero1-1/+1
2016-10-03Moved logging to target functions rather than callerNanoAkron1-6/+8
2016-09-24blockchain: do not reject chain histories matching only genesismoneromooo-monero1-8/+0
This is fine if our local chain is so small that it is entirely contained within the last jump in the peer's short chain history.
2016-09-18fix v5 heightRiccardo Spagni1-1/+1
2016-09-18fix v5 fork date descriptionRiccardo Spagni1-1/+1
2016-09-18updated fork heights for v4 and v5Riccardo Spagni1-0/+7
2016-09-15compile errors fixed when PER_BLOCK_CHECKPOINT not definedrckngOpossum1-1/+3
2016-09-15compile errors fixed when DEBUG_CREATE_BLOCK_TEMPLATE definedrckngOpossum1-1/+1
2016-09-01Merge pull request #1022Riccardo Spagni1-1/+1
b8c03a5 Remove blocks_per_sync limits (Howard Chu)
2016-08-31core: faster find_blockchain_supplementmoneromooo-monero1-6/+2
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-31Remove blocks_per_sync limitsHoward Chu1-1/+1
The code used to cap at 5000 blocks per sync. It also treated 0 as 1. Remove these checks; if specified as 0 do no periodic syncs at all. Then the user is responsible for syncing in some external process.
2016-08-29core: allow empty global indices for txes with empty voutmoneromooo-monero1-1/+6
2016-08-28blockchain: testnet heights for v3, v4, and v5moneromooo-monero1-0/+4
2016-08-28wallet: transfer_selected_rct now also selects fake outsmoneromooo-monero1-2/+2
2016-08-28increase minimum mixin to 4 on hard fork 5moneromooo-monero1-2/+3
2016-08-28core: allow v1 txes after HF 5 when sweeping unmixable outputsmoneromooo-monero1-1/+19
2016-08-28New "Halfway RingCT" outputs for coinbase transactionsmoneromooo-monero1-14/+10
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.
2016-08-28rct: rework v2 txes into prunable and non prunable datamoneromooo-monero1-9/+15
Nothing is pruned, but this allows easier changes later.
2016-08-28rct: rework the verification preparation processmoneromooo-monero1-126/+96
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-28rct: change the simple flag to a typemoneromooo-monero1-3/+9
for future expansion
2016-08-28rct: avoid the need for the last II elementShen Noether1-8/+6
This element is used in the generation of the MLSAG, but isn't needed in verification. Also misc changes in the cryptonote code to match, by mooo.
2016-08-28core: add some locking around pool usemoneromooo-monero1-1/+3
2016-08-28change fork settings to allow pre-rct txes for one more fork cyclemoneromooo-monero1-1/+1
2016-08-28rct: do not serialize public keys in outPkmoneromooo-monero1-4/+31
They can be reconstructed from vout
2016-08-28integrate simple rct apimoneromooo-monero1-57/+155
2016-08-28mixable transactions must be rct for v3moneromooo-monero1-6/+28
2016-08-28move the rct commitments to the output_amounts databasemoneromooo-monero1-23/+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.
2016-08-28ringct: do not serialize what can be reconstructedmoneromooo-monero1-20/+67
The mixRing (output keys and commitments) and II fields (key images) can be reconstructed from vin data. This saves some modest amount of space in the tx.
2016-08-28Use the supplied hard fork version in validate_miner_transactionmoneromooo-monero1-1/+1
rather than using the current one. No functional changes, but may save some bugs in the future.
2016-08-28add rct to the protocolmoneromooo-monero1-67/+212
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/+98
to get random ringct outputs to mix with
2016-08-11Fake outs set is now decided by the walletmoneromooo-monero1-0/+19
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-2/+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-29Merge branch 'performance' of https://github.com/LMDB/bitmoneroRiccardo Spagni1-2/+3
2016-04-28add a --max-concurrency flagmoneromooo-monero1-3/+3
It sets the max number of threads to use for a parallel job. This is different that the number of total threads, since monero binaries typically start a lot of them.
2016-04-17blockchain: add missing overflow check for already generated coinsmoneromooo-monero1-1/+5
When reaching the tail emission phase, the amount of coins will eventually go over MONEY_SUPPLY, overflowing 64 bits. There was a check added to blockchain_storage, but this was not ported to the blockchain DB version. Reported by smooth.
2016-04-17blockchain: update cumulative block limit when popping a blockmoneromooo-monero1-0/+1
Avoids possible issues with accepting a tx too large to fit in an actual block. Reported by smooth.
2016-04-14Merge pull request #784Riccardo Spagni1-0/+1
087373e Fix potential race with parallel processing of txes/signatures/blocks (moneromooo-monero)
2016-04-06blockchain: remove the tx validation result cachemoneromooo-monero1-18/+0
As pointed out by smooth, a transaction's validity may change over time as the blockchain changes.
2016-04-05Merge branch 'performance' into masterHoward Chu1-2/+3
2016-04-05Schema update: tx_indices - improve further with less indirectionwarptangent1-2/+3
2016-04-02Fix potential race with parallel processing of txes/signatures/blocksmoneromooo-monero1-0/+1
2016-04-02Merge pull request #767Riccardo Spagni1-5/+10
24b3e90 Convey tx verification failure reasons to the RPC client (moneromooo-monero)
2016-03-27Merge pull request #765Riccardo Spagni1-0/+5
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-5/+10
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/+5
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-2/+11
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-10/+39
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-39/+10
This reverts commit 7fa63a82a1c3a0243f6757c1689855ed3ca61695, reversing changes made to cb6be986c36b78eddb4b7f16e9ad440af8567dc4.
2016-03-25Merge pull request #749Riccardo Spagni1-10/+39
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-24Move checkpoint functions into checkpoints classThomas Winget1-5/+5
The functions in src/cryptonote_core/checkpoints_create.{h,cpp} should be member functions of the checkpoints class, if nothing else for the sake of keeping their documentation together. This commit covers moving those functions to be member functions of the checkpoints class as well as documenting those functions.
2016-03-22Remove unnecessary or defunct codeThomas Winget1-1/+0
2016-03-22Updated documentation for blockchain.*Thomas Winget1-5/+35
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-03-22blockchain: fix partial block reward detectionmoneromooo-monero1-1/+1
2016-03-21also maybe do the block height this time, you know, just so that it actually ↵Riccardo Spagni1-1/+1
works.
2016-03-21also update the timestamp for the hard forkRiccardo Spagni1-1/+1
2016-03-21set fork date for September, add hyc's GPG key, remove aabramov'sRiccardo Spagni1-0/+3
2016-03-19Fix issue #706Howard Chu1-0/+1
2016-03-11Use boost::thread instead of std::threadHoward Chu1-3/+3
and all other associated IPC
2016-03-03Blockchain: Omit verbose time stats messages by defaultwarptangent1-1/+1
This is already the default for the daemon, but by checking a command line argument and calling a Blockchain member function setter. Initialize the variable to false so it's not dependent on an external command-line argument check. This allows utilities like blockchain_import to have a reasonable default without code changes.
2016-02-23Wrap some more actions in a larger read txnHoward Chu1-11/+25
2016-02-23read txn/cursor stuffHoward Chu1-0/+9
Could wrap more later.
2016-02-08blockchain: initialize m_hardfork to NULLmoneromooo-monero1-1/+1
It can now be set by some other code, and is thus tested
2016-02-08core_tests: add tests for hard fork behaviors (MRL-0004)moneromooo-monero1-5/+15
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: reset hardfork object when resetting blockchainmoneromooo-monero1-0/+1
Not doing so will prevent the new genesis block from being reset if a switch past v1 had occured already.
2016-02-08Blockchain: Update comments on removing blockwarptangent1-0/+5
2016-02-08Move HardFork DB update to BlockchainDB::add_block()warptangent1-3/+0
Ensures the database is consistent. Also simplifes blockchain_import in that verify mode off has less to work around.
2016-02-08Make HardFork object available to BlockchainDB and derived DB implementationswarptangent1-0/+2
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.
2016-02-08Blockchain: Optionally pass in HardFork objectwarptangent1-4/+20
2016-02-03blockchain: revert handle_get_objects adding block id on tx not foundmoneromooo-monero1-1/+0
This differs from the original CN code, and there seems to be no reason to include the block itself, if it was found
2016-02-02minor bugfixes and refactoringThomas Winget1-56/+77
- 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-31Merge pull request #634Riccardo Spagni1-0/+1
7fc6fa3 wallet: forbid dust altogether in output selection where appropriate (moneromooo-monero) 5e1a739 blockchain: log number of outputs available for a new tx (moneromooo-monero)
2016-01-31Merge pull request #631Riccardo Spagni1-2/+1
bcac101 daemon: fix a few issues reported by valgrind (moneromooo-monero) a7e8174 tx_pool: fix serialization of new relayed data (moneromooo-monero) 601ad76 hardfork: fix mixup in indexing variable in get_voting_info (moneromooo-monero) 444e22f blockchain: remove unused timer (moneromooo-monero) 7edfdd8 blockchain: fix m_sync_counter uninitialized variable use (moneromooo-monero) d97582c epee: use generate_random_bytes for new random uuids (moneromooo-monero) 17c7c9c epee: remove dodgy random code that nobody uses (moneromooo-monero)
2016-01-31blockchain: log number of outputs available for a new txmoneromooo-monero1-0/+1
2016-01-30blockchain: remove unused timermoneromooo-monero1-1/+0
2016-01-30blockchain: fix m_sync_counter uninitialized variable usemoneromooo-monero1-1/+1
It counts the number of blocks added since last zeroing
2016-01-30new flush_txpool command, and associated RPC callmoneromooo-monero1-0/+19
It can flush a particular tx, or the whole pool (the RPC command can flush a list of transactions too)
2016-01-29Fix V1/V2 use of hard fork related parametersmoneromooo-monero1-6/+13
Some of it uses hardcoded height, which will need some thinking for next (voted upon) fork.
2015-12-31updated copyright yearRiccardo Spagni1-1/+1
2015-12-30blockchain: kill ioservice on scope end, rather than manuallymoneromooo-monero1-6/+7
This ensures this will be done without fail, as the error prone matching of every return with a call to KILL_IOSERVICE leads to hard to debug corruption when one is missing.
2015-12-30Merge pull request #572Riccardo Spagni1-0/+2
b39aae7 Tweak 45800a25e9374e63caaabba05c89585c86acd668 (hyc) 4a5a5ff blockchain: always stop the ioservice before returning (moneromooo-monero) 78b65cf db_lmdb: safety close db at exit (moneromooo-monero) 45800a2 db_lmdb: fix a strdup/delete[] mistmatch (moneromooo-monero)
2015-12-28blockchain: always stop the ioservice before returningmoneromooo-monero1-0/+2
Fixes a use after free
2015-12-26blockchain: remove obsolete containersmoneromooo-monero1-5/+1
2015-12-26blockchain: Fix height in call to on_blockchain_decmoneromooo-monero1-1/+1
It was a noop anyway
2015-12-25blockchain: fix a few block addition bugsmoneromooo-monero1-34/+45
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 an off by one error in unlocked time checkmoneromooo-monero1-1/+1
2015-12-25blockchain: reinstate double spending checks in check_tx_inputsmoneromooo-monero1-3/+7
This fixes some double spending tests. This may or may not be unneeded in normal (non test) circumstances, to be determined later. Keeping these for now may be slower, but safer.
2015-12-25blockchain: make some flag twiddling code closer to the originalmoneromooo-monero1-2/+2
Probably paranoid and unnecessary
2015-12-25blockchain: fix bitflipping test with quantized block rewardsmoneromooo-monero1-1/+4
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-25blockchain: add missing m_tx_pool.on_blockchain_decmoneromooo-monero1-0/+1
It was missing in the port to DB. This is actually a noop, so should not have functional changes.
2015-12-25blockchain: fix switch to alternative blockchain for more than one blockmoneromooo-monero1-1/+1
When rolling over more than one block, the db height will decrease, but the split height should be constant, as per the original code.
2015-12-25blockchain: add a missing validity check to rollback_blockchain_switchingmoneromooo-monero1-0/+6
It was present in the original code
2015-12-25core: catch exceptions from get_output_keymoneromooo-monero1-2/+18
This can happen when trying to find an amount that does not exist, and fixes a core test.
2015-12-25db: throw when given a non txout_to_key output to addmoneromooo-monero1-0/+5
The check was explicit in the original version, so it seems safer to make it explicit here, especially as it is now done implicitely in a different place, away from the original check.
2015-12-19Allow the wallet to access hard fork informationmoneromooo-monero1-2/+2
And make it change behavior slightly when close/after first hard fork
2015-12-19Add missing semicolons after log statementsmoneromooo-monero1-3/+3
2015-12-17replace std::auto_ptr with std::unique_ptrmoneromooo-monero1-1/+1
The former is obsolete
2015-12-15Fix typowarptangent1-1/+1
2015-12-15blockchain.cpp: Change indentation from 4 to 2 spaceswarptangent1-2255/+2253
2015-12-15Replace tabs with two spaces for consistency with rest of codebasewarptangent1-75/+75
Remove trailing whitespace in same files.
2015-12-14Tone down a bit L0 logs during daemon syncmoneromooo-monero1-1/+1
2015-12-13add a --fakechain argument for testsmoneromooo-monero1-4/+7
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-12-13blockchain: log block (not chain) height in "BLOCK SUCCESFULLY ADDED"moneromooo-monero1-1/+1
This makes it log the same height as the original code, which is less confusing when comparing behaviors.
2015-12-13blockchain: fix off by one in get_blocksmoneromooo-monero1-1/+1
2015-12-06blockchain_db: fixup missing key images in early DB versionmoneromooo-monero1-0/+3
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.
2015-11-24hardfork: fix more major/minor issuesmoneromooo-monero1-2/+2
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-23blockchain: log versions as numbers, not charactersmoneromooo-monero1-1/+1
2015-11-22fixed testnet fork point, added comment data back inRiccardo Spagni1-3/+3
2015-11-21update v2 testnet fork heightRiccardo Spagni1-3/+6
2015-11-21Relay transactions when they linger too long in the poolmoneromooo-monero1-4/+16
The last relayed time of a transaction is maintained, and transactions will be relayed again if they are still in the pool after a certain amount of time, which increases with the transaction's age. All such transactions are resent, whether or not they originated on the local node.
2015-11-13More changes for 2-min blocksJavier Smooth1-4/+7
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-11-13Adjust difficulty target (2 min) and full reward zone (60 kbytes) for block ↵Javier Smooth1-5/+8
version 2
2015-11-08hardfork: allow per-fork voting thresholdsmoneromooo-monero1-6/+8
And setup the first fork to not vote
2015-10-27Remove some old/obsolete/unused codemoneromooo-monero1-49/+0
git history's here if needed to get any of this back
2015-10-26Merge pull request #444Riccardo Spagni1-0/+11
ecbb732 Fix leak on real output when using a very recent output (moneromooo-monero)
2015-10-26Merge pull request #442Riccardo Spagni1-0/+20
43bca0d blockchain_utilities: new blockchain_dump diagnostic tool (moneromooo-monero) 5f397e4 Add functions to iterate through blocks, txes, outputs, key images (moneromooo-monero) 0a5a5e8 db_bdb: record numbers for recno databases start at 1 (moneromooo-monero) 50dfdc0 db_bdb: DB_KEYEMPTY is also not found for non-top recon fields (moneromooo-monero) 572780e blockchain_db: use the DNE exceptions where appropriate (moneromooo-monero)
2015-10-25Fix leak on real output when using a very recent outputmoneromooo-monero1-0/+11
The wallet and the daemon applied different height considerations when selecting outputs to use. This can leak information on which input in a ring signature is the real one. Found and originally fixed by smooth on Aeon.
2015-10-25Add functions to iterate through blocks, txes, outputs, key imagesmoneromooo-monero1-0/+20
2015-10-21hardfork: switch voting to block minor versionmoneromooo-monero1-2/+2
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-17blockchain_export can now export to a blocks.dat formatmoneromooo-monero1-5/+6
Also make the number of blocks endian independant, and add support for testnet
2015-10-11from hard fork 2, all outputs must be decomposedmoneromooo-monero1-0/+17
The wallet decomposes fully as of now too.
2015-10-10from hard fork 2, claim a quantized reward in coinbasemoneromooo-monero1-2/+10
The small leftover is carried forward
2015-09-27blockchain: on hardfork 2, require mixin 2 at least if possiblemoneromooo-monero1-0/+37
2015-09-27hardfork: rescan speedupmoneromooo-monero1-1/+4
Add a block height before which version 1 is assumed Use DB transactions
2015-09-27blockchain: on hardfork 2, allow miners to claim less money than allowedmoneromooo-monero1-3/+7
So they can avoid dust if they so wish
2015-09-27blockchain: use different hard fork settings for testnet and mainnetmoneromooo-monero1-3/+19
2015-09-20hardfork: most state now saved to the DBmoneromooo-monero1-13/+28
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-1/+6
2015-09-19blockchain: force a hardfork recalculation at load timemoneromooo-monero1-0/+3
Since the state isn't actually saved anywhere, as the archive code isn't called in the new DB version.
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/+5
2015-09-12blockchain: use the new hardfork classmoneromooo-monero1-3/+23
2015-08-24blockchain: remove obsolete call to libc srandmoneromooo-monero1-1/+0
crypto::rand is now used for output selection
2015-08-23removed some gcc warnings. mainly unused variables.roman1-3/+0
2015-08-15blockchain: mark two places where the new code differs from the oldmoneromooo-monero1-0/+3
And I'd like a comment from tewinget or someone else
2015-08-15blockchain: update cumulative size after block additionmoneromooo-monero1-2/+2
Block addition can fail, and the old code would not update the cumulative size in that case.
2015-08-15blockchain: remove dead codemoneromooo-monero1-1/+0
2015-08-15blockchain: do not try to add a tx the pool when it was nor taken outmoneromooo-monero1-1/+4
This is an unintended difference from the old code. Though I don't think it can actually happen in practice with the current take_tx implementation.
2015-08-15blockchain: fix off by 1 in timestamp median calculationsmoneromooo-monero1-4/+2
The height function apparently used to return the index of the last block, rather than the height of the chain. This now seems to be incorrect, judging the the code, so we remove the now wrong comment, as well as a couple +/- 1 adjustments which now cause the median calculation to differ from the original blockchain_storage version.
2015-08-11blockchain: remove dead codemoneromooo-monero1-56/+6
2015-08-09blockchain: factor get_num_outpouts(amount) callsmoneromooo-monero1-3/+3
It has to stay constant as we get the blockchain lock for the entire function. Avoids some unnecessary DB accesses.