Commit graph

2118 commits

Author SHA1 Message Date
warptangent
e02577f594
Move HardFork DB update to BlockchainDB::add_block()
Ensures the database is consistent.

Also simplifes blockchain_import in that verify mode off has less to
work around.
2016-02-08 09:28:19 -08:00
warptangent
3800875406
Make HardFork object available to BlockchainDB and derived DB implementations
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-08 09:28:17 -08:00
warptangent
fd46c96dce
BlockchainDB/LMDB: Refactor block-scope DB txn handling for add block
Move block-scope txn start and stop from BlockchainLMDB to BlockchainDB.
2016-02-08 09:28:15 -08:00
warptangent
f3a6000094
BlockchainDB/LMDB/BDB: Extract DB txn functions for block add/remove 2016-02-08 09:28:14 -08:00
warptangent
f47d5b0fe3
BlockchainLMDB: Allow two HardFork functions to update DB during block add
Note that this doesn't yet cause them to be called during block add.
2016-02-08 09:28:12 -08:00
warptangent
15ee0bef4b
BlockchainLMDB: extract txn macros used during block add/remove 2016-02-08 09:28:10 -08:00
Riccardo Spagni
50197b62a3
Merge pull request #644
9d62c16 blockchain_import: Add hard fork data for each block when verify mode is off (warptangent)
7006b2e blockchain_utilities: Have fake_core create HardFork object (warptangent)
8f863e7 Blockchain: Optionally pass in HardFork object (warptangent)
f7e337e fake_core: Check if hard fork subdbs need reset at start (warptangent)
c657e77 blockchain_import: Add --drop-hard-fork command (warptangent)
4122439 blockchain_import: Add exception to log output (warptangent)
2016-02-08 18:55:58 +02:00
warptangent
9d62c161a3
blockchain_import: Add hard fork data for each block when verify mode is off 2016-02-08 08:50:59 -08:00
warptangent
7006b2ebe1
blockchain_utilities: Have fake_core create HardFork object
The HardFork object is needed for the importer to update the hard fork
data when verify mode is off.
2016-02-08 08:50:53 -08:00
warptangent
8f863e742d
Blockchain: Optionally pass in HardFork object 2016-02-08 08:50:51 -08:00
warptangent
f7e337e625
fake_core: Check if hard fork subdbs need reset at start 2016-02-08 08:50:48 -08:00
warptangent
c657e772c4
blockchain_import: Add --drop-hard-fork command 2016-02-08 08:50:47 -08:00
warptangent
412243901d
blockchain_import: Add exception to log output 2016-02-08 08:50:27 -08:00
Riccardo Spagni
1cfe0bdbef
Merge pull request #648
f6abc53 simplewallet: check watch-only view key matches standard address (moneromooo-monero)
2016-02-08 18:34:40 +02:00
Riccardo Spagni
0c4222158f
Merge pull request #646
c7b96b9 wallet: check a key image isn't already present when adding one (moneromooo-monero)
2016-02-08 18:34:13 +02:00
Riccardo Spagni
a1a5b810bc
Merge pull request #645
d9f4b39 daemon: remove leftover debug log (moneromooo-monero)
2016-02-08 18:33:30 +02:00
Riccardo Spagni
de78962e1c
Merge pull request #643
05bfb51 core: move the db lock to the data directory (moneromooo-monero)
2016-02-08 18:32:08 +02:00
Riccardo Spagni
cea6f6fb9c
Merge pull request #641
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-08 18:31:42 +02:00
Riccardo Spagni
18b12cd24f
Merge pull request #640
3d1e690 Add make option to disable BerkeleyDB (warptangent)
2016-02-08 18:31:06 +02:00
Riccardo Spagni
c1378881ef
Merge pull request #639
119eb10 unit_tests: fix hard fork unit tests and add a test for major too (moneromooo-monero)
64a2aa3 hardfork: allow passing chain height in get(height) for convenience (moneromooo-monero)
2016-02-08 18:29:03 +02:00
Riccardo Spagni
f6dcefd80f
Merge pull request #638
6827061 tests: fix compilation failure after V1 define rename (moneromooo-monero)
2016-02-08 18:28:37 +02:00
moneromooo-monero
f6abc5324f
simplewallet: check watch-only view key matches standard address 2016-02-05 22:41:45 +00:00
moneromooo-monero
d9f4b395e8
daemon: remove leftover debug log 2016-02-05 16:36:28 +00:00
moneromooo-monero
c7b96b91ed
wallet: check a key image isn't already present when adding one
If it is, it points to reuse of a tx key, which isn't meant to happen.
If it does, a key image collision means that only one of those
outputs is spendable, so the wallet selects the larger amount,
unless that output was spent already.

This causes a discrepancy betewen reported received inputs and
payment total.

Since tx keys are 256 bits, this should never happen except if
done on purpose, or if a sender uses a bad PRNG.
2016-02-05 16:24:23 +00:00
moneromooo-monero
05bfb51d3e
core: move the db lock to the data directory
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-04 18:09:45 +00:00
moneromooo-monero
7658ac0f45
blockchain: revert handle_get_objects adding block id on tx not found
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-03 21:08:03 +00:00
moneromooo-monero
3a0f4d8a57
berkeleydb: fix delete/free mismatch
Despite being C++, the stats object is allocated by the underlying
C layer using malloc(3).
2016-02-03 08:49:11 +00:00
Thomas Winget
1642be242d minor bugfixes and refactoring
- 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-02 18:58:39 +00:00
warptangent
3d1e690cb2
Add make option to disable BerkeleyDB
Sample use:
BERKELEY_DB=0 make debug

This makes development with BlockchainLMDB easier when virtual methods
have changed and don't match BlockchainBDB.
2016-02-01 13:06:15 -08:00
moneromooo-monero
098dcf2885
unit_tests: fix mnemonics unit test testing invalid seeds
Some word triplets, such as "mugged names nail", are not valid
results from any 32 bit value. If used to decode a 32 bit value,
the result will therefore encode to a different word triplet.

Fix this by using random words converted from an actual random
bitstring, ensuring we always get valid triplets.
2016-02-01 20:47:03 +00:00
moneromooo-monero
119eb10d7c
unit_tests: fix hard fork unit tests and add a test for major too 2016-02-01 20:07:15 +00:00
moneromooo-monero
64a2aa3376
hardfork: allow passing chain height in get(height) for convenience 2016-02-01 20:06:55 +00:00
moneromooo-monero
6827061d5f
tests: fix compilation failure after V1 define rename 2016-01-31 22:11:57 +00:00
Riccardo Spagni
5feebb4d87
Merge pull request #636
616df49 Revert "Merge pull request #632" (Riccardo Spagni)
2016-01-31 15:50:52 +02:00
Riccardo Spagni
616df496e9 Revert "Merge pull request #632"
This reverts commit 58f890652e, reversing
changes made to 39d73d2a27.
2016-01-31 15:49:11 +02:00
Riccardo Spagni
f780f2e7ba
Merge pull request #635
8b3539b core: prevent the database from being used by multiple daemons (moneromooo-monero)
2016-01-31 15:22:14 +02:00
Riccardo Spagni
569316aea3
Merge pull request #634
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-31 15:21:45 +02:00
Riccardo Spagni
8d976a0683
Merge pull request #633
80882ac wallet: guard against exception in process_blocks (moneromooo-monero)
2016-01-31 15:21:13 +02:00
Riccardo Spagni
58f890652e
Merge pull request #632
2cf8b32 wallet: guard against exception in process_blocks (moneromooo-monero)
2016-01-31 15:20:47 +02:00
Riccardo Spagni
39d73d2a27
Merge pull request #631
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-31 15:20:18 +02:00
Riccardo Spagni
ac961f66f6
Merge pull request #630
bf6d147 new flush_txpool command, and associated RPC call (moneromooo-monero)
6288295 rpc: add missing return on error when getting a tx (moneromooo-monero)
b7e37b7 simplewallet: show_transfers can now show just failed txes (moneromooo-monero)
b11539f wallet: detect and handle failed outgoing transfers (moneromooo-monero)
4b23714 tx_pool: serialize missing kept_by_block flag (moneromooo-monero)
2016-01-31 15:19:40 +02:00
moneromooo-monero
8b3539bc11
core: prevent the database from being used by multiple daemons
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-31 12:58:08 +00:00
moneromooo-monero
7fc6fa3fa2
wallet: forbid dust altogether in output selection where appropriate 2016-01-31 11:03:09 +00:00
moneromooo-monero
5e1a7391e8
blockchain: log number of outputs available for a new tx 2016-01-31 10:59:58 +00:00
moneromooo-monero
80882ac6dd
wallet: guard against exception in process_blocks
If an exception occurs, the thread needs to be joined, or it
will be deleted while still live, and terminate the process.
2016-01-30 23:52:43 +00:00
moneromooo-monero
2cf8b32229
wallet: guard against exception in process_blocks
If an exception occurs, the thread needs to be joined, or it
will be deleted while still live, and terminate the process.
2016-01-30 23:34:23 +00:00
moneromooo-monero
bcac1018af
daemon: fix a few issues reported by valgrind
In particular, ensure we check the status of RPC response structures,
as some functions will return success, but with a BUSY status, when
the daemon is not yet synced, and the response will not filled.
2016-01-30 22:14:51 +00:00
moneromooo-monero
a7e817482c
tx_pool: fix serialization of new relayed data 2016-01-30 22:14:09 +00:00
moneromooo-monero
601ad76a5e
hardfork: fix mixup in indexing variable in get_voting_info 2016-01-30 22:13:20 +00:00
moneromooo-monero
444e22f01a
blockchain: remove unused timer 2016-01-30 19:02:33 +00:00