aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core (follow)
AgeCommit message (Collapse)AuthorFilesLines
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)
2015-06-14Fix DNS checkpoint consensus codemoneromooo-monero1-9/+6
It's supposed to load all records and pick one that it finds twice.
2015-06-12account: add a couple constsmoneromooo-monero2-4/+4
2015-06-12Integrated addresses (standard address plus payment id)moneromooo-monero4-4/+100
2015-06-11Merge pull request #303Riccardo Spagni2-0/+7
c882af6 wallet: add watch only wallet support (moneromooo-monero) f7767c6 account: add a forget_spend_key method (moneromooo-monero)
2015-05-31account: add a forget_spend_key methodmoneromooo-monero2-0/+7
2015-05-31cleaning up, removing redundant files, renaming, fixing incorrect licensesRiccardo Spagni2-2/+2
2015-05-16Support debugging command --pop-blocks on in-memory blockchainwarptangent1-0/+3
Add public method blockchain_storage::debug_pop_block_from_blockchain() Ensure blockchain_import calls destructors before exit. To test: DATABASE=memory make release // create blockchain.bin from blockchain.raw if needed build/release/bin/blockchain_import --block-stop 1000 // try popping a single block build/release/bin/blockchain_import --pop-blocks 1
2015-05-13Fixes changes to sort tx by fee per kbThomas Winget2-14/+46
2015-05-13Merge pull request #281Riccardo Spagni1-1/+1
ac011b4 Rename src/blockchain_converter/ to src/blockchain_utilities/ (warptangent) ed9c639 Add --block-number option to blockchain_import (warptangent) 1eb4c66 Update blockchain utilities with portable bootstrap file format (warptangent) 54bd9c1 Add MDB_NORDAHEAD as a supported LMDB flag for blockchain_import (warptangent) a52496d Condense #if directives (warptangent) 8c1a188 Add basic "pop blocks" command to blockchain_import for debugging (warptangent) 71af046 Update log statements (warptangent)
2015-05-13resolved merge conflict in tx_pool.cppRiccardo Spagni2-12/+40
2015-05-08Update log statementswarptangent1-1/+1
Use filesystem path conversion to string() instead of c_str(). Windows may otherwise output an address.
2015-05-06Merge pull request #269Riccardo Spagni4-0/+43
641d824 Keep memory pool consistent when stuck tx removed (warptangent) b76857f Add mempool output to daemon via command and RPC (warptangent)
2015-04-30Sort txs by per-kb-fee for minersThomas Winget2-7/+35
2015-04-30When removing 'stuck' transactions, don't ignore the first tx in the poolThomas Winget1-5/+5
2015-04-23Keep memory pool consistent when stuck tx removedwarptangent1-0/+1
When a stuck tx is removed from memory pool, first remove the associated spent key images.
2015-04-23Add mempool output to daemon via command and RPCwarptangent4-0/+42
This is for the "print_pool" command and "get_transaction_pool" RPC method. Add mempool's spent key images to the results.
2015-04-22DNS Checkpoint updating-related fixes/changesThomas Winget3-8/+72
Only one thread will be doing the updating. Two valid responses must match, and the first two that match will be used.
2015-04-08Disable DNS checkpoint updating on testnetThomas Winget1-0/+2
2015-04-07Merge BlockchainDB into upstreamThomas Winget12-149/+2817
2015-04-07Only compile BerkeleyDB as an option in non-staticThomas Winget1-0/+7
2015-04-05handle unlikely rounding up after sqrtJavier Smooth1-0/+3
2015-04-05triangular distribution to choose recent outputs more often for mixinsJavier Smooth1-1/+5
2015-04-01remerged; commands JSON. logging upgrade. doxygenrfree2monero1-0/+5
2015-04-01Merge remote-tracking branch 'monero-official/master' into network-1.6-work1rfree2monero7-26/+95
2015-03-29Merge upstream into blockchainThomas Winget3-15/+25
2015-03-26Merge pull request #244Riccardo Spagni1-10/+17
e6740ee Enforce DNSSEC for checkpoint updates (Thomas Winget) dbf46a7 DNSSEC added (hardcoded key) (Thomas Winget)
2015-03-26Merge pull request #242Riccardo Spagni2-5/+8
b43716c Do store transaction's blob size in transaction_chain_entry (Sergey Kazenyuk) 3be518f Use single get_transaction_hash to get both id and blob size (Sergey Kazenyuk)
2015-03-25Steps toward multiple dbs available -- workingThomas Winget3-34/+52
There will need to be some more refactoring for these changes to be considered complete/correct, but for now it's working. new daemon cli argument "--db-type", works for LMDB and BerkeleyDB. A good deal of refactoring is also present in this commit, namely Blockchain no longer instantiates BlockchainDB, but rather is passed a pointer to an already-instantiated BlockchainDB on init().
2015-03-25Merge upstream updates into blockchain branchThomas Winget7-13/+72
2015-03-24Enforce DNSSEC for checkpoint updatesThomas Winget1-10/+17
2015-03-24Merge upstream to daemonize changesThomas Winget3-1/+13
Preparation for PR
2015-03-22Update Blockchain::get_db() to return reference instead of pointerwarptangent1-2/+2
Where this method is used, a BlockchainDB object is always expected, so a pointer is unnecessary and less safe.
2015-03-16Add support for database open with flagswarptangent2-3/+3
Add support to: - BlockchainDB, BlockchainLMDB - blockchain_import utility to open LMDB database with one or more LMDB flags. Sample use: $ blockchain_import --database lmdb#nosync $ blockchain_import --database lmdb#nosync,nometasync
2015-03-15Blockchain: add get_db() accessor, needed for blockchain_importwarptangent1-0/+5
This handling may be changed in the future.
2015-03-15Do store transaction's blob size in transaction_chain_entrySergey Kazenyuk2-4/+5
2015-03-15Use single get_transaction_hash to get both id and blob sizeSergey Kazenyuk1-2/+4
2015-03-13BlockchainDB implementations have names nowThomas Winget1-2/+3
In order to make things more general, BlockchainDB now has get_db_name() which should return a string with the "name" of that type of db. This "name" will be the subfolder name that holds that db type's files within the monero folder. Small bugfix: blockchain_converter was not correctly appending this in the prior hard-coded-string implementation of the subfolder data directory concept.
2015-03-06Moved BlockchainDB into its own src/ subfolderThomas Winget7-2797/+4
Ostensibly janitorial work, but should be more relevant later down the line. Things that depend on core cryptonote things (i.e. cryptonote_core) don't necessarily depend on BlockchainDB and thus have no need to have BlockchainDB baked in with them.
2015-03-06update checkpointsmooth1-0/+1
2015-03-05add comment about avoiding overflowsmooth1-0/+6
2015-03-04minimum subsidy for mining incentives, remove unused LEGACY_FEE definesmooth2-1/+6
2015-03-01DNS checkpoint loading for testnet should now be correctThomas Winget4-4/+19
2015-02-24RPC calls for background daemon added inThomas Winget2-0/+7
The RPC calls the daemon executable uses to talk to the running daemon instance have mostly been added back in. Rate limiting has not been added in upstream, but is on its way in a separate effort, so those calls are still NOPed out.
2015-02-24Daemonize changes pulled in -- daemon buildsThomas Winget2-8/+33
many RPC functions added by the daemonize changes (and related changes on the upstream dev branch that were not merged) were commented out (apart from return). Other than that, this *should* work...at any rate, it builds, and that's something.
2015-02-23Changed log level of debug message -- too spammyThomas Winget1-1/+1
2015-02-23BlockchainLMDB: Add profiling to tx_exists()warptangent3-1/+8
2015-02-23BlockchainLMDB: Add batch transaction support to tx_exists()warptangent1-6/+9
2015-02-23BlockchainDB, BlockchainLMDB: Add profiling for DB commitswarptangent3-0/+18
2015-02-23BlockchainDB: Add virtual function declarations for batch transactionswarptangent1-0/+3
2015-02-23BlockchainLMDB: Add check for open database to two functionswarptangent1-0/+3
2015-02-23BlockchainLMDB: Add support for batch transactionswarptangent2-55/+289
2015-02-23Improve block and tx processing efficiency by less repeat hashingwarptangent4-11/+28
BlockchainLMDB::add_block() BlockchainLMDB::add_transaction_data() BlockchainDB::add_transaction()
2015-02-23Add profiling to block and tx processingwarptangent2-0/+48
2015-02-23Move LMDB storage to subfolderwarptangent2-1/+12
2015-02-23Fix formattingwarptangent1-6/+5
2015-02-23Fix log statementwarptangent1-1/+1
2015-02-23Remove unused variablewarptangent1-1/+0
2015-02-23Add log statementwarptangent1-0/+1
2015-02-23Add and extend log statementswarptangent1-6/+10
2015-02-23Blockchain: match original function declaration from blockchain_storagewarptangent2-2/+2
2015-02-22Fix Blockchain::get_tail_id() to set parameter to last block number instead ↵warptangent1-1/+1
of height This reflects the behavior of blockchain_storage::get_tail_id(). Fixes #27 so that RPC method getlastblockheader works.
2015-02-22Revert "Bounds error, should fix #27"warptangent1-1/+1
This reverts commit 6f1c4b4c2c78c930fe30ed648e855a6ce55f7dcd.
2015-02-20Bounds error, should fix #27Thomas Winget1-1/+1
2015-02-202014 network limit 1.2 +utils +toc -doc -drmonerorfree2monero4-26/+28
new update of the pr with network limits more debug options: discarding downloaded blocks all or after given height. trying to trigger the locking errors. debug levels polished/tuned to sane values. debug/logging improved. warning: this pr should be correct code, but it could make an existing (in master version) locking error appear more often. it's a race on the list (map) of peers, e.g. between closing/deleting them versus working on them in net-limit sleep in sending chunk. the bug is not in this code/this pr, but in the master version. the locking problem of master will be fixed in other pr. problem is ub, and in practice is seems to usually cause program abort (tested on debian stable with updated gcc). see --help for option to add sleep to trigger the error faster.
2015-02-202014 network limit 1.1 +utils +toc -doc -drmonerorfree2monero4-3/+53
Update of the PR with network limits works very well for all speeds (but remember that low download speed can stop upload because we then slow down downloading of blockchain requests too) more debug options fixed pedantic warnings in our code should work again on Mac OS X and FreeBSD fixed warning about size_t tested on Debian, Ubuntu, Windows(testing now) TCP options and ToS (QoS) flag FIXED peer number limit FIXED some spikes in ingress/download FIXED problems when other up and down limit
2015-02-202014 network limit 1.0a +utils +toc -doc -drmonerorfree2monero3-0/+28
commands and options for network limiting works very well e.g. for 50 KiB/sec up and down ToS (QoS) flag peer number limit TODO some spikes in ingress/download TODO problems when other up and down limit added "otshell utils" - simple logging (with colors, text files channels)
2015-02-05Merge remote-tracking branch 'monero-project/master' into blockchainThomas Winget1-4/+34
2015-02-02Add compile-time support for both db implementations: in-memory and LMDBwarptangent7-4/+54
Usage: default is lmdb for blockchain branch: $ make release same as: $ DATABASE=lmdb make release for original in-memory implementation: $ DATABASE=memory make release
2015-02-01Blockchain: reflect log updates from blockchain_storagewarptangent1-7/+7
See commit 4ba680f2946966df2030e5765e40ee0a36b112c4
2015-02-01Blockchain: reflect log and assert updates from blockchain_storagewarptangent1-37/+38
See commit cf5a8b1d6c3df615641e81328bb3d8cf80cd70e3
2015-02-01Blockchain: reflect log level of blockchain_storagewarptangent1-8/+8
Update to match LOG_PRINT_RED_Lx statements. See commit cf5a8b1d6c3df615641e81328bb3d8cf80cd70e3
2015-02-01Blockchain: reflect assert behavior of blockchain_storage for ↵warptangent1-0/+2
get_tx_outputs_gindexs()
2015-02-01Update recently added log statement to fix possible null dereferencewarptangent1-1/+5
This would have been triggered if function was called without fourth parameter and ring signature check failed.
2015-01-27replaced 64-bit multiplication in difficulty.cpp with a portable versionRiccardo Spagni1-4/+34
2015-01-19Should fix std::min issues related to size_tThomas Winget1-2/+2
2015-01-14Remove code previously made unused and marked unusedwarptangent2-26/+0
2015-01-11Fix height assertion in Blockchain::handle_alternative_block()warptangent1-1/+1
It expects the total number of blocks of main chain, not last block id (off-by-one error). This again behaves like the same height assertion done in original implementation in blockchain_storage::handle_alternative_block(). This allows a reorganization to proceed after an alternative block has been added.
2015-01-11Fix comparison between main and alternate chain's cumulativewarptangent1-2/+10
difficulty. This fixes the continual reorganization between a main and alternate chain, using the same two latest blocks from each. The check that cumulative difficulty of the alternate chain is bigger than main's was not using main's last block, but incorrectly using the passed-in block's previous block. main_chain_cumulative_difficulty was being used in two different ways. This has been split up to keep use of main_chain_cumulative_difficulty consistent.
2015-01-11Remove a have_block() check so alternate block can be processedwarptangent1-7/+27
Remove have_block() check from Blockchain::handle_block_to_main_chain(). Add logging to have_block(). This allows blockchain reorganization to proceed further. have_block() check here causes an error after a blockchain reorganize begins with error: "Attempting to add block to main chain, but it's already either there or in an alternate chain." While reorganizing to become the main chain, a block in the alternative chain would be refused due to have_block() rightfully finding it in the alternative chain. The reorganization would end in rollback, restoring to previous blockchain. Original implementation didn't call it here, and it doesn't appear necessary to be called from here in this implementation either. When needed, it appears it's called prior to handle_block_to_main_chain().
2015-01-11Complete implementation of transaction removalwarptangent4-23/+97
Complete method BlockchainLMDB::remove_output() - use output index as the key for: m_output_indices, m_output_txs, m_output_keys - call new method BlockchainLMDB::remove_amount_output_index() Add method to remove amount output index. - BlockchainLMDB::remove_amount_output_index() - for m_output_amounts This also fixes the segfault when blockchain reorganization is attempted.
2015-01-11Use block index when obtaining block's difficulty for log statementwarptangent1-2/+2
Use last block id, not number of blocks (off-by-one error). Fixes error at start of blockchain reorganization: "Attempt to get cumulative difficulty from height <XXXXXX> failed -- difficulty not in db"
2015-01-09Fix transfers to support mixinswarptangent2-3/+42
Implement BlockchainLMDB::get_output_global_index() - returns global output index for a given amount and amount output index. Add information to debug statement for failed ring signature check within Blockchain::check_tx_inputs() Fixes bitmonerod RPC call "/getrandom_outs.bin" to return correct output keys, used in creating a transaction with mixins. TODO: get_output_global_index() could be refactored with part of get_output_tx_and_index() as the latter uses the former's functionality. Keep track of LMDB read transaction.
2015-01-09Fix transfers (without mixins)warptangent4-1/+85
Fix Blockchain::get_tx_outputs_gindexs() to return amount output indices. Implement BlockchainLMDB::get_tx_amount_output_indices() and call it from the function instead of BlockchainLMDB::get_tx_output_indices() Previously, Blockchain::get_tx_outputs_gindexs() was instead returning global output indices, which are internal to LMDB databases. Allows bitmonerod RPC /get_o_indexes.bin to return the amount output indices as expected. Allows simplewallet refresh to set correct amount output indices for incoming transfers. simplewallet can now construct and send valid transactions (currently only without mixins). This is a fix that doesn't require altering the structure of the current LMDB databases. TODO: This can be done more efficiently by adding another LMDB database (key-value table). It's not used during regular transaction validation by bitmonerod. I think it's currently used only or mainly by simplewallet for just its own incoming transactions. So the current behavior is not a primary bottleneck. Currently, it's using the "output_amounts" database, walking through a given amount's list of values, comparing each one to a given global output index. The iteration number of the match is the desired result: the amount output index. This is done for each global output index of the transaction. A tx's amount output indices can be stored in various other ways allowing for faster lookup. Since a tx is only written once, there are no special future write requirements for its list of indices.
2015-01-09throw inline functions need to keep exception typeThomas Winget1-3/+5
As it is useful for functions calling BlockchainDB functions to know whether an exception is expected (attempting to get a block that doesn't exist and counting it missing if not, to save time checking if it does, for example), the inline functions throw{0,1} need to keep the exception type information. Slight comment update due to copy/paste failure.
2015-01-09Fixes segfault in Blockchain::handle_alternative_blockThomas Winget2-6/+12
This commit should fix the segfault in Blockchain::handle_alternative_block, and also updates a few comments that were either incorrect or incomplete.
2015-01-04Merge pull request #19 from warptangent/fix_tx_outputThomas Winget1-1/+1
Obtain tx hash and tx output index from amount and output offset
2015-01-04Obtain tx hash and tx output index from amount and output offsetwarptangent1-1/+1
Fixes problem of obtaining incorrect outputs used for tx input. Reverts to earlier intended behavior that was fixed in previous commit's split of get_output_tx_and_index into two functions.
2015-01-04db_lmdb: fix global index calculation off by 1moneromooo-monero1-1/+1
This finally fixes raw tx being accepted by the daemon.
2015-01-04Fixes a bug with getting output metadata from BlockchainDBThomas Winget4-17/+37
Thanks to moneromooo-monero for spotting the bug.
2015-01-04db_lmdb: remove redundant checksmoneromooo-monero1-10/+4
2015-01-04update comments to reflect changed codeThomas Winget1-4/+1
2015-01-04db_lmdb: do not give the group database write permissionsmoneromooo-monero1-1/+1
2015-01-04db_lmdb: catch attempt to remove block from an empty blockchainmoneromooo-monero1-0/+3
It would probably have thrown when not finding a block at height 2^64-1, but better make things clear.
2015-01-04db_lmdb: factor all the log+throw code pathsmoneromooo-monero1-485/+138
2015-01-04db_lmdb: factor the MDB_val setup codemoneromooo-monero1-197/+74
It makes the code simpler, avoids possible copy/paste errors (wrong sizeof, etc), and generally unclutters the calling code.
2015-01-04blockchain: do not append "testnet" to the data directorymoneromooo-monero1-6/+0
It is already there (unless overridden via command line).
2015-01-04db_lmdb: remove block timestamp too when removing a blockmoneromooo-monero1-0/+6
2015-01-04db_lmdb: do not cast const awaymoneromooo-monero1-13/+13
2015-01-04blockchain: fix wallet syncing from scratchmoneromooo-monero1-1/+2
When the wallet syncs from the first block, it is fine to start at the genesis block.
2015-01-04db_lmdb: do not keep a dangling pointer to stack objectsmoneromooo-monero1-0/+4
2015-01-04db_lmdb: make cursor internal members privatemoneromooo-monero1-0/+1
2015-01-04blockchain_storage: refactor genesis block creationmoneromooo-monero2-16/+6
The existing assert is kept as it is stricter than the function's internal assert.
2015-01-04blockchain_storage: add consts where appropriatemoneromooo-monero2-110/+110
2015-01-04checkpoints: add consts where appropriatemoneromooo-monero2-7/+7
2015-01-04blockchain: add consts where appropriatemoneromooo-monero2-84/+84
2015-01-04blockchain_db: add consts where appropriatemoneromooo-monero3-121/+121
2015-01-04blockchain_db: factor some exception codemoneromooo-monero1-148/+48
Ideally, the log would go in the exception's ctor, but two log levels are used, so I'd need to specify the level in the ctor, which isn't great as it's not really related to the exception.
2015-01-04build: add liblmdb to the cmake autodetection systemmoneromooo-monero1-1/+1
update for rebase (warptangent 2015-01-04) src/cryptonote_core/CMakeLists.txt (edit) - replace LMDB_LIBRARIES with LMDB_LIBRARY set from autodetection
2015-01-04extraneous semicolon in Blockchain::complete_timestamps_vectorThomas Winget1-1/+1
credit here: https://bitcointalk.org/index.php?topic=583449.msg9562845#msg9562845
2015-01-04raised maximum mapsize for lmdb to ~16GBThomas Winget1-1/+1
2015-01-04more blockchain height-related fixes, syncing other nodes code this timeThomas Winget1-4/+4
2015-01-04very, VERY primitive blockchain converterThomas Winget2-14/+19
hard-coded config folder, hard-coded BlockchainDB subclass. Needs finessing, but should be testable this way. update for rebase (warptangent 2015-01-04) fix conflicts with upstream CMakeLists.txt files src/CMakeLists.txt (edit original commit) src/blockchain_converter/CMakeLists.txt (add)
2015-01-04add new checkpointing behavior to Blockchain classThomas Winget2-3/+78
2015-01-04Store output pubkeys separately, bug fixesThomas Winget2-9/+54
2015-01-04Minor bugfixes, redundancy removalThomas Winget3-10/+104
Minor bugfixes in block removal Storing outputs outside their transactions is largely unnecessary, and thus has been removed.
2015-01-04moar bug fixes, removed debug printsThomas Winget2-8/+4
2015-01-04BlockchainLMDB seems to be working*!Thomas Winget3-141/+155
* - Well, mostly. Haven't let it sync too far just yet. Currently trying to figure out the best way to deal with LMDB/mmap virtual memory pages.
2015-01-04some bug fixes, but still needs workThomas Winget3-35/+73
There are quite a few debug prints in this commit that will need removed later, but for posterity (in case someone wants to debug this while I'm away), I left them in. Currently errors when syncing on the first block that has a "real" transaction. Seems to not be able to validate the ring signature, but I can't for the life of me figure out what's going wrong.
2015-01-04Minor bug fixes and debug printsThomas Winget2-6/+122
Blockchain and BlockchainLMDB classes now have a debug print at the beginning of each function at log level 2. These can be removed at any time, but for now are quite useful. Blockchain runs, and adds the genesis block just fine, but for some reason isn't getting new blocks.
2015-01-04minor fixes to Blockchain.cppThomas Winget2-3/+7
2015-01-04Integrate BlockchainDB into cryptonote_coreThomas Winget8-24/+58
Probably needs more looking at -- lot of things were done...in a rushed sort of way. That said, it all builds and *should* be at least testable. update for rebase (warptangent 2015-01-04) fix conflicts with upstream CMakeLists.txt files src/CMakeLists.txt (remove edits from original commit) tests/CMakeLists.txt (remove edits from original commit) src/cryptonote_core/CMakeLists.txt (edit) - use blockchain db .cpp and .h files - add LMDB_LIBRARIES
2015-01-04All LMDB BlockchainDB implemented, not testedThomas Winget2-135/+900
All of the functionality for the LMDB implementation of BlockchainDB is implemented, but only what is in tests/unit_tests/BlockchainDB.cpp has been tested. This is basically add a block, see if you can get the block and a tx from the block. More tests should be added at some point.
2015-01-04LMDB blockchain: remove outputs and spent keysThomas Winget1-0/+63
2015-01-04Adding block data to LMDB BlockchainDB codedThomas Winget3-8/+258
Still needs testing (and need to write a few more unit tests), but everything should be there. Lots of unfortunate duplication, but...well, I can't see a way around it using LMDB. A couple of other minor changes in this commit, only slightly relevant.
2015-01-04Parts of LMDB impl of BlockchainDB done and workingThomas Winget4-69/+431
The rest should just be tedious copypasta and modification.
2015-01-04Initial commit of lmdb BlockchainDB implThomas Winget2-0/+472