aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.cpp
Commit message (Collapse)AuthorAgeFilesLines
* updated copyright yearRiccardo Spagni2015-12-311-1/+1
|
* blockchain: kill ioservice on scope end, rather than manuallymoneromooo-monero2015-12-301-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.
* Merge pull request #572Riccardo Spagni2015-12-301-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)
| * blockchain: always stop the ioservice before returningmoneromooo-monero2015-12-281-0/+2
| | | | | | | | Fixes a use after free
* | blockchain: remove obsolete containersmoneromooo-monero2015-12-261-5/+1
| |
* | blockchain: Fix height in call to on_blockchain_decmoneromooo-monero2015-12-261-1/+1
|/ | | | It was a noop anyway
* blockchain: fix a few block addition bugsmoneromooo-monero2015-12-251-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.
* blockchain: fix an off by one error in unlocked time checkmoneromooo-monero2015-12-251-1/+1
|
* blockchain: reinstate double spending checks in check_tx_inputsmoneromooo-monero2015-12-251-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.
* blockchain: make some flag twiddling code closer to the originalmoneromooo-monero2015-12-251-2/+2
| | | | Probably paranoid and unnecessary
* blockchain: fix bitflipping test with quantized block rewardsmoneromooo-monero2015-12-251-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.
* blockchain: add missing m_tx_pool.on_blockchain_decmoneromooo-monero2015-12-251-0/+1
| | | | | It was missing in the port to DB. This is actually a noop, so should not have functional changes.
* blockchain: fix switch to alternative blockchain for more than one blockmoneromooo-monero2015-12-251-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.
* blockchain: add a missing validity check to rollback_blockchain_switchingmoneromooo-monero2015-12-251-0/+6
| | | | It was present in the original code
* core: catch exceptions from get_output_keymoneromooo-monero2015-12-251-2/+18
| | | | | This can happen when trying to find an amount that does not exist, and fixes a core test.
* db: throw when given a non txout_to_key output to addmoneromooo-monero2015-12-251-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.
* Allow the wallet to access hard fork informationmoneromooo-monero2015-12-191-2/+2
| | | | And make it change behavior slightly when close/after first hard fork
* Add missing semicolons after log statementsmoneromooo-monero2015-12-191-3/+3
|
* replace std::auto_ptr with std::unique_ptrmoneromooo-monero2015-12-171-1/+1
| | | | The former is obsolete
* Fix typowarptangent2015-12-151-1/+1
|
* blockchain.cpp: Change indentation from 4 to 2 spaceswarptangent2015-12-151-2193/+2191
|
* Replace tabs with two spaces for consistency with rest of codebasewarptangent2015-12-151-74/+74
| | | | Remove trailing whitespace in same files.
* Tone down a bit L0 logs during daemon syncmoneromooo-monero2015-12-141-1/+1
|
* add a --fakechain argument for testsmoneromooo-monero2015-12-131-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.
* blockchain: log block (not chain) height in "BLOCK SUCCESFULLY ADDED"moneromooo-monero2015-12-131-1/+1
| | | | | This makes it log the same height as the original code, which is less confusing when comparing behaviors.
* blockchain: fix off by one in get_blocksmoneromooo-monero2015-12-131-1/+1
|
* blockchain_db: fixup missing key images in early DB versionmoneromooo-monero2015-12-061-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.
* hardfork: fix more major/minor issuesmoneromooo-monero2015-11-241-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.
* blockchain: log versions as numbers, not charactersmoneromooo-monero2015-11-231-1/+1
|
* fixed testnet fork point, added comment data back inRiccardo Spagni2015-11-221-3/+3
|
* update v2 testnet fork heightRiccardo Spagni2015-11-211-3/+6
|
* Relay transactions when they linger too long in the poolmoneromooo-monero2015-11-211-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.
* More changes for 2-min blocksJavier Smooth2015-11-131-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
* Adjust difficulty target (2 min) and full reward zone (60 kbytes) for block ↵Javier Smooth2015-11-131-5/+8
| | | | version 2
* hardfork: allow per-fork voting thresholdsmoneromooo-monero2015-11-081-6/+8
| | | | And setup the first fork to not vote
* Remove some old/obsolete/unused codemoneromooo-monero2015-10-271-49/+0
| | | | git history's here if needed to get any of this back
* Merge pull request #444Riccardo Spagni2015-10-261-0/+11
|\ | | | | | | ecbb732 Fix leak on real output when using a very recent output (moneromooo-monero)
| * Fix leak on real output when using a very recent outputmoneromooo-monero2015-10-251-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.
* | Merge pull request #442Riccardo Spagni2015-10-261-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)
| * | Add functions to iterate through blocks, txes, outputs, key imagesmoneromooo-monero2015-10-251-0/+20
| |/
* / hardfork: switch voting to block minor versionmoneromooo-monero2015-10-211-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.
* blockchain_export can now export to a blocks.dat formatmoneromooo-monero2015-10-171-5/+6
| | | | | Also make the number of blocks endian independant, and add support for testnet
* from hard fork 2, all outputs must be decomposedmoneromooo-monero2015-10-111-0/+17
| | | | The wallet decomposes fully as of now too.
* from hard fork 2, claim a quantized reward in coinbasemoneromooo-monero2015-10-101-2/+10
| | | | The small leftover is carried forward
* blockchain: on hardfork 2, require mixin 2 at least if possiblemoneromooo-monero2015-09-271-0/+37
|
* hardfork: rescan speedupmoneromooo-monero2015-09-271-1/+4
| | | | | Add a block height before which version 1 is assumed Use DB transactions
* blockchain: on hardfork 2, allow miners to claim less money than allowedmoneromooo-monero2015-09-271-3/+7
| | | | So they can avoid dust if they so wish
* blockchain: use different hard fork settings for testnet and mainnetmoneromooo-monero2015-09-271-3/+19
|
* hardfork: most state now saved to the DBmoneromooo-monero2015-09-201-13/+28
| | | | | There will be a delay on first load of an existing blockchain as it gets reparsed for this state data.
* Add an RPC call and daemon command to get info on hard fork votingmoneromooo-monero2015-09-191-1/+6
|