Commit graph

384 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 8f863e742d
Blockchain: Optionally pass in HardFork object 2016-02-08 08:50:51 -08: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
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
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
moneromooo-monero 64a2aa3376
hardfork: allow passing chain height in get(height) for convenience 2016-02-01 20:06:55 +00: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 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
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 5e1a7391e8
blockchain: log number of outputs available for a new tx 2016-01-31 10:59:58 +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
moneromooo-monero 7edfdd8f24
blockchain: fix m_sync_counter uninitialized variable use
It counts the number of blocks added since last zeroing
2016-01-30 19:01:43 +00:00
moneromooo-monero bf6d1474c0
new flush_txpool command, and associated RPC call
It can flush a particular tx, or the whole pool (the RPC command
can flush a list of transactions too)
2016-01-30 13:28:26 +00:00
moneromooo-monero 4b23714658
tx_pool: serialize missing kept_by_block flag 2016-01-29 19:44:25 +00:00
moneromooo-monero 94b98fb5fa
tx_pool: do not accept txes not in a block if they timed out before
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-29 17:21:25 +00:00
moneromooo-monero eadbdf354a
tx_pool: fix use of invalidated iterator 2016-01-29 17:21:20 +00:00
moneromooo-monero 3b1d7e03fc
Fix V1/V2 use of hard fork related parameters
Some of it uses hardcoded height, which will need some thinking
for next (voted upon) fork.
2016-01-29 17:21:11 +00:00
Riccardo Spagni b9c7ba180d
added checkpoints 2016-01-15 15:22:31 +02:00
moneromooo-monero 945ac788d4
hardfork: fix accepting v2 blocks too early 2016-01-15 11:54:35 +00:00
Riccardo Spagni b98d88c17e
Merge pull request #587
1e07110 Nicer looking exit when blockchain.bin is found (moneromooo-monero)
2015-12-31 22:34:57 +02:00
moneromooo-monero 1e07110a7a
Nicer looking exit when blockchain.bin is found
Do not print the exception message, and write the important bit
in red, since people will only read the last line otherwise.
2015-12-31 17:09:00 +00:00
moneromooo-monero 40f97ce83d
core: do not use the persistent pool state for tests
Fixes intermittent test failures when the pool contains
unexpected transactions that were brought in from the
live pool.
2015-12-31 14:24:06 +00:00
Riccardo Spagni de03926850
updated copyright year 2015-12-31 08:39:56 +02:00
Riccardo Spagni 810a11267c
fixed copyrights with bad year references 2015-12-31 08:37:27 +02:00
moneromooo-monero 576effe11a
blockchain: kill ioservice on scope end, rather than manually
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-30 16:08:30 +00:00
moneromooo-monero ed5d017c0f
miner: minor fixes on stop
- 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-30 16:06:32 +00:00
Riccardo Spagni ddc6d45f96
Merge pull request #573
0953355 blockchain_db: inform user about new format if blockchain.bin is found (moneromooo-monero)
2015-12-30 09:39:27 +02:00
Riccardo Spagni fd36eea6dd
Merge pull request #572
b39aae7 Tweak 45800a25e9 (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-30 09:38:41 +02:00
Riccardo Spagni aa6dd048d8
Merge pull request #570
fc34132 Remove assert from status command (hyc)
2015-12-30 09:37:25 +02:00
Riccardo Spagni a7e56870fe
Merge pull request #568
b0541a5 blockchain: remove obsolete containers (moneromooo-monero)
18a5211 blockchain: Fix height in call to on_blockchain_dec (moneromooo-monero)
2015-12-30 09:36:18 +02:00
moneromooo-monero 09533557b5
blockchain_db: inform user about new format if blockchain.bin is found 2015-12-28 23:03:46 +00:00
moneromooo-monero 4a5a5ff157
blockchain: always stop the ioservice before returning
Fixes a use after free
2015-12-28 22:47:46 +00:00
hyc fc341325a7 Remove assert from status command
Crashes every time...
2015-12-27 08:44:18 +00:00
moneromooo-monero b0541a56eb
blockchain: remove obsolete containers 2015-12-26 18:01:24 +00:00
moneromooo-monero 18a5211173
blockchain: Fix height in call to on_blockchain_dec
It was a noop anyway
2015-12-26 18:00:45 +00:00
moneromooo-monero 50ee591152
hardfork: ensure current_fork_index can not become negative on rescan 2015-12-26 13:17:00 +00:00
moneromooo-monero f33a88cfc1
blockchain: fix a few block addition bugs
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-25 22:13:38 +00:00
moneromooo-monero a9ff11c816
blockchain: fix an off by one error in unlocked time check 2015-12-25 22:12:52 +00:00
moneromooo-monero f294be35bc
blockchain: reinstate double spending checks in check_tx_inputs
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-25 22:11:21 +00:00
moneromooo-monero 737b6d6cf5
blockchain: make some flag twiddling code closer to the original
Probably paranoid and unnecessary
2015-12-25 22:10:27 +00:00
moneromooo-monero 81cb0fcdcc
blockchain: fix bitflipping test with quantized block rewards
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-25 22:07:58 +00:00
moneromooo-monero 22ddf09bea
blockchain: add missing m_tx_pool.on_blockchain_dec
It was missing in the port to DB.
This is actually a noop, so should not have functional changes.
2015-12-25 22:04:13 +00:00
moneromooo-monero d837c0ca90
blockchain: fix switch to alternative blockchain for more than one block
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-25 22:02:07 +00:00
moneromooo-monero 5cec076e13
blockchain: add a missing validity check to rollback_blockchain_switching
It was present in the original code
2015-12-25 22:01:21 +00:00