Commit graph

1930 commits

Author SHA1 Message Date
moneromooo-monero 5cb03a15be
unit_tests: fix blockchain unit test after hard fork import fix 2016-02-08 20:58:43 +00:00
moneromooo-monero 759383c52d
hardfork: add a default fork entry for v1 if none exist
To avoid special cases
2016-02-08 20:58:06 +00:00
moneromooo-monero c7f82ec769
blockchain: initialize m_hardfork to NULL
It can now be set by some other code, and is thus tested
2016-02-08 20:57:20 +00:00
moneromooo-monero 8649b9f1ef
blockchain_db: pass hard fork object as a simple pointer 2016-02-08 20:56:31 +00:00
moneromooo-monero a333c42cde
core_tests: add tests for hard fork behaviors (MRL-0004)
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-08 18:52:00 +00:00
moneromooo-monero 945fe90e08
core_tests: allow setting miner tx max_outs when creating a block 2016-02-08 18:50:08 +00:00
moneromooo-monero 8e4c2e6ebe
unit_tests: fix hard fork unit test compilation 2016-02-08 18:44:27 +00:00
moneromooo-monero 9ef57946a0
blockchain_utilities: remove unused num_blocks variable 2016-02-08 18:26:03 +00:00
moneromooo-monero 6c8e5c3459
blockchain: reset hardfork object when resetting blockchain
Not doing so will prevent the new genesis block from being
reset if a switch past v1 had occured already.
2016-02-08 18:22:03 +00:00
Riccardo Spagni 24ccdb9b6e
Merge pull request #650
e298b14 Blockchain: Update comments on removing block (warptangent)
b368e29 blockchain_import: Get hard fork version from HardFork (warptangent)
e02577f Move HardFork DB update to BlockchainDB::add_block() (warptangent)
3800875 Make HardFork object available to BlockchainDB and derived DB implementations (warptangent)
fd46c96 BlockchainDB/LMDB: Refactor block-scope DB txn handling for add block (warptangent)
f3a6000 BlockchainDB/LMDB/BDB: Extract DB txn functions for block add/remove (warptangent)
f47d5b0 BlockchainLMDB: Allow two HardFork functions to update DB during block add (warptangent)
15ee0be BlockchainLMDB: extract txn macros used during block add/remove (warptangent)
2016-02-08 19:52:36 +02:00
warptangent e298b14a55
Blockchain: Update comments on removing block 2016-02-08 09:28:25 -08:00
warptangent b368e29f67
blockchain_import: Get hard fork version from HardFork
Replace temporary assignment that used hardcoded values.
2016-02-08 09:28:21 -08:00
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