Commit Graph

8379 Commits

Author SHA1 Message Date
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
0db5ca7a49
Merge pull request #571
b773e66 MDB_VL32 - resync with master (Howard Chu)
2015-12-30 09:38:01 +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
9b3300fe9b
Merge pull request #569
ee9d71e BlockchainDB: skip fixup check if read-only database (warptangent)
2015-12-30 09:36:54 +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
61befc2293
wallet: store cache to file without unnecessary memory buffer 2015-12-29 15:46:37 +00:00
Riccardo Spagni
90dbae918f
Merge pull request #566
50ee591 hardfork: ensure current_fork_index can not become negative on rescan (moneromooo-monero)
b90e14d tests: add a unit test for canonical decomposed amounts (moneromooo-monero)
2015-12-29 11:04:15 +02:00
moneromooo-monero
3b56036bb3 Merge pull request #1 from LMDB/crash-fix
Tweak 45800a25e9
2015-12-29 00:11:46 +00:00
hyc
b39aae7aa5 Tweak 45800a25e9
trivial cleanup
2015-12-29 00:11:35 +00:00
moneromooo-monero
61ce8d6fde
wallet_rpc_server: exit async, so we reply to stop_wallet RPC
Reported by saddam
2015-12-28 23:38:30 +00: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
Howard Chu
b773e66877 MDB_VL32 - resync with master
WIN32 - close file mapping handle in env_close
cursor_unref - ignore cursor with empty stack
2015-12-28 20:46:48 +00:00
moneromooo-monero
9847db6920
wallet: do not return error if incoming_transfers finds none
reported by saddam
2015-12-28 20:27:06 +00:00
moneromooo-monero
78b65cf7e8
db_lmdb: safety close db at exit
Noticed by hyc

Also set m_open to false when closed
2015-12-28 19:23:02 +00:00
moneromooo-monero
45800a25e9
db_lmdb: fix a strdup/delete[] mistmatch 2015-12-28 19:22:37 +00:00
hyc
fc341325a7 Remove assert from status command
Crashes every time...
2015-12-27 08:44:18 +00:00
warptangent
ee9d71e9f9
BlockchainDB: skip fixup check if read-only database 2015-12-26 14:30:20 -08: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
b90e14d927
tests: add a unit test for canonical decomposed amounts 2015-12-26 11:41:50 +00:00
Riccardo Spagni
95ceb715dc
Merge pull request #565
79beed2 tests: fix various tests by using parameters better suited to monero (moneromooo-monero)
d0a8362 tests: fix some double spending tests (moneromooo-monero)
2358d0d tests: use 255 as a "too high" block version (moneromooo-monero)
f33a88c blockchain: fix a few block addition bugs (moneromooo-monero)
a9ff11c blockchain: fix an off by one error in unlocked time check (moneromooo-monero)
f294be3 blockchain: reinstate double spending checks in check_tx_inputs (moneromooo-monero)
737b6d6 blockchain: make some flag twiddling code closer to the original (moneromooo-monero)
81cb0fc blockchain: fix bitflipping test with quantized block rewards (moneromooo-monero)
22ddf09 blockchain: add missing m_tx_pool.on_blockchain_dec (moneromooo-monero)
d837c0c blockchain: fix switch to alternative blockchain for more than one block (moneromooo-monero)
5cec076 blockchain: add a missing validity check to rollback_blockchain_switching (moneromooo-monero)
3cabdb5 core: catch exceptions from get_output_key (moneromooo-monero)
5eef645 db: throw when given a non txout_to_key output to add (moneromooo-monero)
2015-12-26 10:23:17 +02:00
moneromooo-monero
79beed221d
tests: fix various tests by using parameters better suited to monero
Either smaller coin values (as monero has smaller block rewards),
or pre-hard fork values (full reward zone), or post-Bytecoin values
(emission speed).
2015-12-25 22:26:34 +00:00
moneromooo-monero
d0a8362b6b
tests: fix some double spending tests
Some tests assume the first output in a transaction goes to the recipient.
However, it can be the change. When it is, the recipient's keys will not
recognize this output. To fix this, we send all we have, to ensure there
is no change, and the first output goes to the recipient.

I'm not sure why this worked with Cryptonote. The tests sent 17 coins,
which seems way smaller than the first Bytecoin block reward, so there
would have been change too. Maybe outputs were not shuffled originally.
2015-12-25 22:23:36 +00:00
moneromooo-monero
2358d0d5be
tests: use 255 as a "too high" block version
While the original cryptonote accepted only the current major
version, we can accept higher ones.
2015-12-25 22:22:12 +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
moneromooo-monero
3cabdb5ef2
core: catch exceptions from get_output_key
This can happen when trying to find an amount that does not exist,
and fixes a core test.
2015-12-25 21:59:26 +00:00
moneromooo-monero
5eef64578b
db: throw when given a non txout_to_key output to add
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.
2015-12-25 21:56:37 +00:00
Riccardo Spagni
a7e63f27c1
Merge pull request #564
ba4e217 Update liblmdb, unify 32/64 sources (Howard Chu)
2015-12-25 21:50:27 +02:00
Riccardo Spagni
c35501c6ad
Merge pull request #562
d4c2fae BlockchainDB: Remove txs in reverse order (warptangent)
2015-12-25 21:49:18 +02:00
Riccardo Spagni
6f71918a12
Merge pull request #561
ffcf6bd BlockchainLMDB: When removing, find amount output index fast by starting at end (warptangent)
f11def0 BlockchainLMDB: Remove tx outputs in reverse order (warptangent)
2015-12-25 21:48:51 +02:00
Riccardo Spagni
719a6a89c6
Merge pull request #557
791e7fb changed height to uint64_t (Brendan Telzrow)
4cd7913 added RPC wallet command getheight (Brendan Telzrow)
2015-12-25 21:48:25 +02:00
Howard Chu
ba4e217c90 Update liblmdb, unify 32/64 sources 2015-12-25 08:56:03 +00:00
warptangent
d4c2fae2fb
BlockchainDB: Remove txs in reverse order
Data should be removed in the reverse order it was added. Not doing so
breaks assumptions and can cause problems in other DB implementations.

This matches the order of tx removal in
blockchain_storage::purge_block_data_from_blockchain.
2015-12-24 15:09:09 -08:00
warptangent
ffcf6bdb95
BlockchainLMDB: When removing, find amount output index fast by starting at end
This improves blockchain reorganization time by allowing one of the more
expensive DB lookups when popping a block to not have to seek through a
long dup list in the "output_amounts" subdb. This is most noticeable for
HDDs.

As before, the dup list is still walked if necessary (but in reverse),
and the global output index still confirmed to be the one looked for.
But under proper use, the result will be found at the end of the dup
list, so we start there.

Removing an amount output index is always done in the context of popping
a block, so the global output index being looked for should be the last
one in that amount key's dup list. Even if the txs themselves aren't
removed in reverse order (supposed to be according to original
implementation), the specified amount output index will still be near
the end, because the txs are in the same block.

TEST:

Pop blocks with blockchain_import.

Blocks should be successfully removed with no errors shown.

bitmonerod should be able to start syncing from the reduced blockchain
height.
2015-12-24 13:32:35 -08:00
warptangent
f11def012f
BlockchainLMDB: Remove tx outputs in reverse order
Data should be removed in the reverse order it was added.

This matches the order of removal in
blockchain_storage::pop_transaction_from_global_index.
2015-12-24 13:30:12 -08:00
Riccardo Spagni
d0e434f0d8
Merge pull request #560
6c86859 unit_tests: fix hard fork tests (moneromooo-monero)
8b0200a unit_tests: new test for IP blocking (moneromooo-monero)
2015-12-24 18:16:54 +02:00
Riccardo Spagni
0eaee358be
Merge pull request #559
47ca455 fixed missing parenthesis (Riccardo Spagni)
2015-12-24 18:12:44 +02:00
moneromooo-monero
6c868595b7
unit_tests: fix hard fork tests
A couple stopped passing when the hard fork code was made
to reject incoming hard fork versions it did not know about.
2015-12-24 16:12:03 +00:00
Riccardo Spagni
47ca455ea8
fixed missing parenthesis 2015-12-24 18:11:11 +02:00
moneromooo-monero
8b0200adf8
unit_tests: new test for IP blocking 2015-12-24 16:05:19 +00:00