aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core (follow)
AgeCommit message (Collapse)AuthorFilesLines
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-14Merge pull request #782Riccardo Spagni1-1/+13
113cdc1 core: keep the acc loop for the genesis block (moneromooo-monero)
2016-04-14Merge pull request #800Riccardo Spagni2-19/+0
4cfb4df blockchain: remove the tx validation result cache (moneromooo-monero)
2016-04-14Merge pull request #796Riccardo Spagni1-1/+1
d817aec tx_pool: ensure no txes that fail check_inputs get in the block template (moneromooo-monero)
2016-04-06blockchain: remove the tx validation result cachemoneromooo-monero2-19/+0
As pointed out by smooth, a transaction's validity may change over time as the blockchain changes.
2016-04-06tx_pool: fix (hopefully) save/load of kept_by_blockmoneromooo-monero1-0/+2
2016-04-05tx_pool: ensure no txes that fail check_inputs get in the block templatemoneromooo-monero1-1/+1
2016-04-02Fix potential race with parallel processing of txes/signatures/blocksmoneromooo-monero1-0/+1
2016-04-02core: keep the acc loop for the genesis blockmoneromooo-monero1-1/+13
For unknown reasons, it was generated with a block reward consisting of a single large dusty output.
2016-04-02Merge pull request #779Riccardo Spagni1-5/+1
daac1cc core: remove the block reward accumulation loop (moneromooo-monero)
2016-04-02Merge pull request #767Riccardo Spagni5-11/+39
24b3e90 Convey tx verification failure reasons to the RPC client (moneromooo-monero)
2016-04-02Merge pull request #764Riccardo Spagni2-74/+374
f746c9d minor corrections/clarifications (Thomas Winget) c6bb201 Transaction pool documentation (and some cleanup) (Thomas Winget)
2016-04-01core: remove the block reward accumulation loopmoneromooo-monero1-5/+1
This can generate non decomposed outputs for very large block rewards (or not so large ones if a miner decides to not quantize the block rewards). Out of an abundance of caution, we refuse to generate those. They are still accepted by the consensus code, however.
2016-03-30minor corrections/clarificationsThomas Winget2-4/+6
2016-03-27Merge pull request #765Riccardo Spagni2-0/+14
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-monero5-11/+39
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-monero2-0/+14
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-monero2-3/+13
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-25core: fix miner tx block reward with feesmoneromooo-monero1-8/+7
2016-03-25Merge pull request #749Riccardo Spagni12-431/+1965
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 Spagni12-1965/+431
This reverts commit 7fa63a82a1c3a0243f6757c1689855ed3ca61695, reversing changes made to cb6be986c36b78eddb4b7f16e9ad440af8567dc4.
2016-03-25Merge pull request #749Riccardo Spagni12-431/+1965
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-24Transaction pool documentation (and some cleanup)Thomas Winget2-74/+372
tx_pool.h doxygen documentation completed. Many notes made on areas for improvement, be that functionality or code clarity. Commented code and unused code removed.
2016-03-24remove defunct code from cryptonote::coreThomas Winget2-22/+0
2016-03-24cryptonote::core doxygen documentationThomas Winget2-26/+617
2016-03-24doxygen documentation for difficulty functionsThomas Winget2-2/+16
2016-03-24Move checkpoint functions into checkpoints classThomas Winget8-358/+327
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-22doxygen documentation for checkpoints.{h,cpp}Thomas Winget2-6/+99
All functions in src/cryptonote_core/checkpoints.h are now documented in doxygen style. checkpoints.cpp has been reviewed, one function has been marked for discussion on correctness.
2016-03-22Remove unnecessary or defunct codeThomas Winget2-22/+0
2016-03-22Updated documentation for blockchain.*Thomas Winget2-14/+925
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-21Merge pull request #743Riccardo Spagni1-1/+1
a1c3829 also maybe do the block height this time, you know, just so that it actually works. (Riccardo Spagni)
2016-03-21also maybe do the block height this time, you know, just so that it actually ↵Riccardo Spagni1-1/+1
works.
2016-03-21Merge pull request #742Riccardo Spagni1-1/+1
23d1538 also update the timestamp for the hard fork (Riccardo Spagni)
2016-03-21also update the timestamp for the hard forkRiccardo Spagni1-1/+1
2016-03-21Merge pull request #741Riccardo Spagni1-0/+3
eda51a0 set fork date for September, add hyc's GPG key, remove aabramov's (Riccardo Spagni)
2016-03-21set fork date for September, add hyc's GPG key, remove aabramov'sRiccardo Spagni1-0/+3
2016-03-21Revert "Print stack trace upon exceptions"moneromooo-monero5-6/+2
Ain't nobody got time for link/cmake skullduggery. This reverts commit fff238ec94ac6d45fc18c315d7bc590ddfaad63d.
2016-03-19Print stack trace upon exceptionsmoneromooo-monero5-2/+6
Useful for debugging users' logs
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-29Merge pull request #688Riccardo Spagni2-1/+10
c2a1fee simplewallet: prompt for private keys when generating wallets (moneromooo-monero) 4513b4c simplewallet: add a new --restore-from-keys option (moneromooo-monero)
2016-02-23Wrap some more actions in a larger read txnHoward Chu1-11/+25
2016-02-23read txn/cursor stuffHoward Chu2-1/+14
Could wrap more later.
2016-02-23core: check whether an update is needed straight awaymoneromooo-monero1-1/+1
2016-02-23core: print "update needed" hard fork notifications in redmoneromooo-monero1-2/+2
2016-02-22simplewallet: add a new --restore-from-keys optionmoneromooo-monero2-1/+10
It is similar in use to --restore-from-view-key, but also expects a spend private key. Requested by luigi1112, and useful to restore MyMonero wallets.
2016-02-17core: check whether an update is needed straight awaymoneromooo-monero1-1/+1
2016-02-17core: print "update needed" hard fork notifications in redmoneromooo-monero1-2/+2
2016-02-08hardfork: add a default fork entry for v1 if none existmoneromooo-monero1-0/+5
To avoid special cases
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-monero4-12/+26
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 objectwarptangent2-4/+21
2016-02-08Merge pull request #643Riccardo Spagni1-8/+10
05bfb51 core: move the db lock to the data directory (moneromooo-monero)
2016-02-08Merge pull request #641Riccardo Spagni2-56/+87
7658ac0 blockchain: revert handle_get_objects adding block id on tx not found (moneromooo-monero) 3a0f4d8 berkeleydb: fix delete/free mismatch (moneromooo-monero) 1642be2 minor bugfixes and refactoring (Thomas Winget) 098dcf2 unit_tests: fix mnemonics unit test testing invalid seeds (moneromooo-monero)
2016-02-04core: move the db lock to the data directorymoneromooo-monero1-8/+10
Locking just one db turns out to not have been a good idea, since the pool and p2p state fdles have to be used anyway. Also ensure the directory exists before tring to lock.
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 Winget2-56/+88
- 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-02-01hardfork: allow passing chain height in get(height) for conveniencemoneromooo-monero1-1/+4
2016-01-31Merge pull request #635Riccardo Spagni2-0/+46
8b3539b core: prevent the database from being used by multiple daemons (moneromooo-monero)
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 Spagni3-5/+2
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-31core: prevent the database from being used by multiple daemonsmoneromooo-monero2-0/+46
A boost lock is used to determine whether more than one process wants to access the database. The boost file_lock doesn't seem to like locking directories, so we use an arbitrary file in it. This allows to still run two daemons if they have different database directories (ie, LMDB/BDB, different data directories).
2016-01-31blockchain: log number of outputs available for a new txmoneromooo-monero1-0/+1
2016-01-30tx_pool: fix serialization of new relayed datamoneromooo-monero1-2/+0
2016-01-30hardfork: fix mixup in indexing variable in get_voting_infomoneromooo-monero1-1/+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-monero4-0/+41
It can flush a particular tx, or the whole pool (the RPC command can flush a list of transactions too)
2016-01-29tx_pool: serialize missing kept_by_block flagmoneromooo-monero1-1/+4
2016-01-29tx_pool: do not accept txes not in a block if they timed out beforemoneromooo-monero2-2/+14
This is intended to avoid cases where a timed out tx will be re-relayed by another peer for which it has not timed out yet, which would cause the tx to stay in the network's pool for a long time (until all peers time it out before another one tries to relay it again).
2016-01-29tx_pool: fix use of invalidated iteratormoneromooo-monero1-1/+2
2016-01-29Fix V1/V2 use of hard fork related parametersmoneromooo-monero6-32/+65
Some of it uses hardcoded height, which will need some thinking for next (voted upon) fork.
2016-01-15added checkpointsRiccardo Spagni1-0/+8
2016-01-15hardfork: fix accepting v2 blocks too earlymoneromooo-monero1-2/+1
2015-12-31Merge pull request #587Riccardo Spagni1-28/+20
1e07110 Nicer looking exit when blockchain.bin is found (moneromooo-monero)
2015-12-31Nicer looking exit when blockchain.bin is foundmoneromooo-monero1-28/+20
Do not print the exception message, and write the important bit in red, since people will only read the last line otherwise.
2015-12-31core: do not use the persistent pool state for testsmoneromooo-monero2-1/+7
Fixes intermittent test failures when the pool contains unexpected transactions that were brought in from the live pool.
2015-12-31updated copyright yearRiccardo Spagni31-31/+31
2015-12-31fixed copyrights with bad year referencesRiccardo Spagni2-2/+2
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-30miner: minor fixes on stopmoneromooo-monero1-1/+4
- only try to stop if actually started - print number of threads before zeroing it This fixes the suspiciously doubled "Mining has been stopped" message on exit.
2015-12-30Merge pull request #573Riccardo Spagni1-0/+22
0953355 blockchain_db: inform user about new format if blockchain.bin is found (moneromooo-monero)
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-30Merge pull request #570Riccardo Spagni1-1/+1
fc34132 Remove assert from status command (hyc)
2015-12-30Merge pull request #568Riccardo Spagni2-9/+2
b0541a5 blockchain: remove obsolete containers (moneromooo-monero) 18a5211 blockchain: Fix height in call to on_blockchain_dec (moneromooo-monero)
2015-12-28blockchain_db: inform user about new format if blockchain.bin is foundmoneromooo-monero1-0/+22
2015-12-28blockchain: always stop the ioservice before returningmoneromooo-monero1-0/+2
Fixes a use after free
2015-12-27Remove assert from status commandhyc1-1/+1
Crashes every time...
2015-12-26blockchain: remove obsolete containersmoneromooo-monero2-8/+1
2015-12-26blockchain: Fix height in call to on_blockchain_decmoneromooo-monero1-1/+1
It was a noop anyway
2015-12-26hardfork: ensure current_fork_index can not become negative on rescanmoneromooo-monero1-1/+1
2015-12-25blockchain: fix a few block addition bugsmoneromooo-monero2-34/+46
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-monero3-2/+6
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-monero4-5/+21
And make it change behavior slightly when close/after first hard fork
2015-12-19Add missing semicolons after log statementsmoneromooo-monero2-4/+4
2015-12-17replace std::auto_ptr with std::unique_ptrmoneromooo-monero1-1/+1
The former is obsolete
2015-12-15Fix typowarptangent2-2/+2
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 codebasewarptangent12-317/+316
Remove trailing whitespace in same files.
2015-12-15Merge pull request #537Riccardo Spagni1-0/+1
a74cc1b hardfork: only accept major versions we know about (moneromooo-monero)
2015-12-14hardfork: only accept major versions we know aboutmoneromooo-monero1-0/+1
2015-12-14Tone down a bit L0 logs during daemon syncmoneromooo-monero1-1/+1
2015-12-13add a --fakechain argument for testsmoneromooo-monero4-8/+17
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-13tx_pool: fix "minumim" typo in messagemoneromooo-monero1-1/+1
2015-12-09Merge pull request #527Riccardo Spagni1-10/+23
336b375 Register daemon command line arguments to core if they're used in core (moneromooo-monero)
2015-12-08Register daemon command line arguments to core if they're used in coremoneromooo-monero1-10/+23
This fixes coretests, which does not register daemon specific arguments, but uses core, which uses those arguments. Also gets rid of an unwanted dependency on daemon code from core.
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-30Revert "Merge pull request #506"Riccardo Spagni1-2/+2
This reverts commit c6bf73131aaf804cb17f24c856f826be2761a566, reversing changes made to 8a52cf4055d247dd4b162985c931e99683992e3c.
2015-11-27core: serialize block major/minor versions as bytes, not varintsmoneromooo-monero1-2/+2
This allows them to be saved as a fixed (one byte) chunk whatever the value. Using a varint will use two bytes as the high bit gets set. This is backward compatible with current usage (0-2 values).
2015-11-24Merge pull request #501Riccardo Spagni3-27/+34
d887c18 hardfork: fix more major/minor issues (moneromooo-monero) 3b47ca2 hardfork: fix rescan on load (moneromooo-monero) 4cea2b1 Add IP blocking for misbehaving nodes (adapted from Boolberry) (Javier Smooth) 9c64b12 quiet down p2p logging a bit (Javier Smooth) 53c75ab blockchain: log versions as numbers, not characters (moneromooo-monero) edade8d hardfork: fix actual/voting confusion (moneromooo-monero)
2015-11-24hardfork: fix more major/minor issuesmoneromooo-monero3-24/+26
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-23hardfork: fix rescan on loadmoneromooo-monero1-1/+1
2015-11-23blockchain: log versions as numbers, not charactersmoneromooo-monero1-1/+1
2015-11-23hardfork: fix actual/voting confusionmoneromooo-monero1-3/+8
2015-11-22add recent static checkpointJavier Smooth1-0/+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-monero6-26/+123
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 Smooth5-12/+12
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 Smooth5-14/+24
version 2
2015-11-10hardfork: add a get_ideal_version(uint64_t) functionmoneromooo-monero2-0/+18
It returns the ideal version for a given height, which is based on the minimum height for a fork, disregarding votes
2015-11-08hardfork: allow per-fork voting thresholdsmoneromooo-monero3-21/+42
And setup the first fork to not vote
2015-10-27Remove some old/obsolete/unused codemoneromooo-monero2-64/+0
git history's here if needed to get any of this back
2015-10-26Build fixes for the old blockchain_storage versionmoneromooo-monero2-6/+8
2015-10-26Merge pull request #444Riccardo Spagni2-1/+12
ecbb732 Fix leak on real output when using a very recent output (moneromooo-monero)
2015-10-26Merge pull request #442Riccardo Spagni4-0/+68
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-monero2-1/+12
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-monero4-0/+68
2015-10-21hardfork: switch voting to block minor versionmoneromooo-monero3-9/+20
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-17hardfork: use DB transactions when reorganizingmoneromooo-monero1-3/+3
It speeds up a lot, which can be significant when reorganizing from the genesis block to create the hard fork data.
2015-10-17hardfork: simplify work done on reloadmoneromooo-monero2-1/+40
There is no need to fully recalculate and rewrite state, just refill state from the DB.
2015-10-11from hard fork 2, all outputs must be decomposedmoneromooo-monero4-1/+25
The wallet decomposes fully as of now too.
2015-10-10from hard fork 2, claim a quantized reward in coinbasemoneromooo-monero3-4/+21
The small leftover is carried forward
2015-10-10cryptonote_format_utils: add a function to tell if an amount is canonicalmoneromooo-monero2-0/+31
2015-10-04hardfork: move an assert so it actually worksmoneromooo-monero1-1/+1
An unsigned quantity is always >= 0
2015-09-27blockchain: on hardfork 2, require mixin 2 at least if possiblemoneromooo-monero1-0/+37
2015-09-27hardfork: make the voting window a weekmoneromooo-monero1-1/+1
2015-09-27hardfork: rescan speedupmoneromooo-monero3-15/+41
Add a block height before which version 1 is assumed Use DB transactions
2015-09-27hardfork: remove use of GNU extension for initializing objectmoneromooo-monero2-4/+5
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-27hardfork: change window semantics to not count the newly added blockmoneromooo-monero1-5/+20
This allows knowing the hard fork a block must obey in order to be added to the blockchain. The previous semantics would use that new block's version vote to determine this hard fork, which made it impossible to use the rules to validate transactions entering the tx pool (and made it impossible to validate a block before adding it to the blockchain).
2015-09-27blockchain: use different hard fork settings for testnet and mainnetmoneromooo-monero1-3/+19
2015-09-20hardfork: most state now saved to the DBmoneromooo-monero4-100/+97
There will be a delay on first load of an existing blockchain as it gets reparsed for this state data.
2015-09-20hardfork: remove the "parts are copyright cryptonote" noticesmoneromooo-monero2-4/+0
I coded the whole thing from scratch.
2015-09-19Add an RPC call and daemon command to get info on hard fork votingmoneromooo-monero4-5/+47
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-monero6-79/+82
2015-09-13core: moan when we think an update is needed to get latest hard fork infomoneromooo-monero4-0/+35
2015-09-12blockchain: use the new hardfork classmoneromooo-monero3-8/+29
2015-09-12New hardfork classmoneromooo-monero3-2/+475
This keeps track of voting via block version, in order to decide when to enable a particular fork's code.
2015-09-12blockchain: add a couple missing includesmoneromooo-monero1-0/+2
2015-08-24blockchain: remove obsolete call to libc srandmoneromooo-monero1-1/+0
crypto::rand is now used for output selection
2015-08-24wallet: only return tx keys via RPC if requestedmoneromooo-monero2-2/+9
To get the tx keys returned via RPC, set the "get_tx_key" or "get_tx_keys" request field to true (defaults to false).
2015-08-24Merge pull request #383Riccardo Spagni2-4/+0
3b5330e use correct unsigned type (roman) 59cc92b removed some gcc warnings. mainly unused variables. (roman)
2015-08-23removed some gcc warnings. mainly unused variables.roman2-4/+0
2015-08-19make tx keys available to the usermoneromooo-monero2-2/+3
They are also stored in the cache file, to be retrieved using a new get_tx_key command.
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-11Add a is_key_image_spent daemon command and RPC callmoneromooo-monero2-2/+18
2015-08-11blockchain: remove dead codemoneromooo-monero2-59/+6
2015-08-10Merge pull request #363Riccardo Spagni1-4/+12
4f19e68 blockchain: factor get_num_outpouts(amount) calls (moneromooo-monero) 275894c blockchain: always select random outs using triangular distribution (moneromooo-monero)
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.
2015-08-09blockchain: always select random outs using triangular distributionmoneromooo-monero1-1/+9
It was only used by the older blockchain_storage. We also move the code to the calling blockchain level, to avoid replicating the code in every DB implementation. This also makes the get_random_out method obsolete, and we delete it.
2015-08-09encrypted payment ids are now 64 bit, instead of 256 bitmoneromooo-monero7-27/+51
Pros: - smaller on the blockchain - shorter integrated addresses Cons: - less sparseness - less ability to embed actual information The boolean argument to encrypt payment ids is now gone from the RPC calls, since the decision is made based on the length of the payment id passed.
2015-08-09Encrypted payment IDsmoneromooo-monero3-6/+124
A payment ID may be encrypted using the tx secret key and the receiver's public view key. The receiver can decrypt it with the tx public key and the receiver's secret view key. Using integrated addresses now cause the payment IDs to be encrypted. Payment IDs used manually are not encrypted by default, but can be encrypted using the new 'encrypt_payment_id' field in the transfer and transfer_split RPC calls. It is not possible to use an encrypted payment ID by specifying a manual simplewallet transfer/transfer_new command, though this is just a limitation due to input parsing.
2015-07-18Merge pull request #343Riccardo Spagni1-1/+1
e20a4dd blockchain: fix testnet syncing (to not use blocks.dat) (moneromooo-monero)
2015-07-18blockchain: fix testnet syncing (to not use blocks.dat)moneromooo-monero1-1/+1
These are mainnet blocks, and would cause syncing on testnet to reject all incoming blocks.
2015-07-17Fixed threadpool bug when running on single core systems.NoodleDoodleNoodleDoodleNoodleDoodleNoo1-5/+8
*Thanks to freshman for reporting bug.
2015-07-15Removed on_idle() calls to Blockchain::store_blockchain() for lmdb.NoodleDoodleNoodleDoodleNoodleDoodleNoo4-13/+50
Added option to cache tx-input verification results.
2015-07-15Fixed binary size issue due to embedded checkpoint data.NoodleDoodleNoodleDoodleNoodleDoodleNoo2-7/+7
Fixed OSX compilation issues due to random lmdb resize points. Fixed infinite loop bug when calling core::get_block_template(..).
2015-07-15** CHANGES ARE EXPERIMENTAL (FOR TESTING ONLY)NoodleDoodleNoodleDoodleNoodleDoodleNoo9-1692/+2559
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-07-15Update blockchain.cppNoodleDoodleNoodleDoodleNoodleDoodleNoo1-1/+0
Fix compilation error
2015-07-15Experimental BDB workaround optimizationsNoodleDoodleNoodleDoodleNoodleDoodleNoo1-1/+20
2015-07-10Fix loop bug when calling core::get_block_template, causing calling thread ↵NoodleDoodleNoodleDoodleNoodleDoodleNoo1-0/+9
to lock up.
2015-06-20account: allow creating an account from a public address and view secret keymoneromooo-monero2-0/+17
2015-06-16Fix standard address deserializationmoneromooo-monero1-7/+17
2015-06-14Merge pull request #321Riccardo Spagni1-9/+6
bbc5475 Fix DNS checkpoint consensus code (moneromooo-monero)