Commit graph

1445 commits

Author SHA1 Message Date
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 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
Riccardo Spagni 514aa724f4
Merge pull request #558
a004130 fix for 'failed to generate new wallet: failed to save file' error during wallet generation (Lex Kalinkin)
2015-12-24 16:47:01 +02:00
Lex Kalinkin a004130a04 fix for 'failed to generate new wallet: failed to save file' error during wallet generation 2015-12-24 16:12:42 +02:00
Riccardo Spagni e285820dfb
Merge pull request #556
22581a0 epee: regularly cleanup connections we kept a reference to (moneromooo-monero)
2015-12-23 13:59:37 +02:00
moneromooo-monero 22581a0441
epee: regularly cleanup connections we kept a reference to
Since connections from the ::connect method are now kept in
a deque to be able to cancel them on exit, this leaks both
memory and a file descriptor. Here, we clean those up after
30 seconds, to avoid this. 30 seconds is higher then the
5 second timeout used in the async code, so this should be
safe. However, this is an assumption which would break if
that async code was to start relying on longer timeouts.
2015-12-23 11:19:16 +00:00
Riccardo Spagni a06b0b2b95
Merge pull request #554
26c5118 README.md: mention --no-igd in the Tor paragraph (moneromooo-monero)
2015-12-22 14:53:08 +02:00
Riccardo Spagni e6dbea094c
Merge pull request #553
1e2f2d7 epee: fix hang on exit (moneromooo-monero)
17ff6f2 net_node: fix a hang on exit (moneromooo-monero)
2015-12-22 14:42:37 +02:00
moneromooo-monero 26c5118000
README.md: mention --no-igd in the Tor paragraph 2015-12-22 12:41:54 +00:00
moneromooo-monero 1e2f2d7da0
epee: fix hang on exit
When the boost ioservice is stopped, pending work notifications
will not happen. This includes deadline timers, which would
otherwise time out the now cancelled I/O operations. When this
happens just after starting a new connect operation, this can
leave that operations in a state where it won't receive either
the completion notification nor a timeout, causing a hang.

This is fixed by keeping a list of connections corresponding
to the connect operations, and cancelling them before stopping
the boost ioservice.

Note that the list of these connections can grow unbounded, as
they're never cleaned up. Cleaning them up would involve
working out which connections do not have any pending work,
and it's not quite clear yet how to go about this.
2015-12-22 12:39:02 +00:00
moneromooo-monero 17ff6f2114
net_node: fix a hang on exit
One loop was not paying attention to the stop signal, and could
end up looping forever
2015-12-22 12:38:52 +00:00
Riccardo Spagni 40880d7cb8
Merge pull request #552
9428d53 Strip redundant includes (hyc)
2015-12-22 10:29:29 +02:00
Riccardo Spagni 21053c6420
Merge pull request #551
cfe15b8 Also set stacksize for Win32 not on MSVC (Howard Chu)
2015-12-22 10:28:15 +02:00
Riccardo Spagni c41f785d56
Merge pull request #550
8c93608 wallet: fix load/save versioning bug for recently added tx data (moneromooo-monero)
2015-12-22 10:27:44 +02:00
Riccardo Spagni 76837fe5bc
Merge pull request #549
af1da98 README.md: fix Tor paragraph to use warptangent's TCP DNS changes (moneromooo-monero)
2015-12-22 10:25:20 +02:00
Riccardo Spagni aa7d6c5412
Merge pull request #547
8ea7af1 Allow the wallet to access hard fork information (moneromooo-monero)
760331b epee: make log macros behave like statements (moneromooo-monero)
3f2970f Add missing semicolons after log statements (moneromooo-monero)
2015-12-22 10:10:54 +02:00
Riccardo Spagni cab57ca49d
Merge pull request #546
bd15f97 README.md: mention rlwrap usage (moneromooo-monero)
2015-12-22 10:10:13 +02:00
Riccardo Spagni b42966aead
Merge pull request #545
0ab56b8 print top block hash in daemon diff command (moneromooo-monero)
2015-12-22 10:07:35 +02:00
hyc 9428d53d6f Strip redundant includes
In particular, <boost/program_options.hpp> blows up daemon.cpp.obj,
making it too big to compile in debug mode on Win32. Even on a
release build it drops daemon.cpp.o on Linux from 31MB to 20MB.
This has no effect on the final linked binary size.
2015-12-21 16:23:59 +00:00
Howard Chu cfe15b81bd Also set stacksize for Win32 not on MSVC 2015-12-20 18:41:36 +00:00
moneromooo-monero 8c93608f2f
wallet: fix load/save versioning bug for recently added tx data
The version number passed to those data's serialize function
was always 0, not the wallet's version as I had expected.
A version number now exists for these structures so they're
versioned correctly.
2015-12-20 14:03:15 +00:00
moneromooo-monero bd15f97d2a
README.md: mention rlwrap usage 2015-12-19 19:21:03 +00:00
moneromooo-monero af1da980f0
README.md: fix Tor paragraph to use warptangent's TCP DNS changes 2015-12-19 19:12:38 +00:00
moneromooo-monero 8ea7af1ba3
Allow the wallet to access hard fork information
And make it change behavior slightly when close/after first hard fork
2015-12-19 14:52:30 +00:00
moneromooo-monero 760331b427
epee: make log macros behave like statements
In particular, make this kind of thing do what one expects
it to do:

if (x) LOG_PRINT("True"); else LOG_PRINT("No");
2015-12-19 14:48:52 +00:00
moneromooo-monero 3f2970fadb
Add missing semicolons after log statements 2015-12-19 14:47:37 +00:00
moneromooo-monero 0ab56b80db
print top block hash in daemon diff command
and add top block hash in get_info RPC
2015-12-18 19:56:17 +00:00
Riccardo Spagni 5d33b43d8d
Merge pull request #544
01e92eb replace std::auto_ptr with std::unique_ptr (moneromooo-monero)
2015-12-18 12:18:00 +02:00
Riccardo Spagni 64ff3c7201
Merge pull request #543
63cb1a5 move another non user useful log to L1 (moneromooo-monero)
02827d5 p2p: minor log formatting fix (moneromooo-monero)
2015-12-18 12:16:10 +02:00
Riccardo Spagni 45249d92a7
Merge pull request #542
9b4f8b4 wallet: save to a temporary file, then rename (moneromooo-monero)
2015-12-18 12:15:01 +02:00
moneromooo-monero 01e92ebdb0
replace std::auto_ptr with std::unique_ptr
The former is obsolete
2015-12-17 22:47:13 +00:00
moneromooo-monero 63cb1a59aa
move another non user useful log to L1 2015-12-17 22:35:34 +00:00
moneromooo-monero 02827d5155
p2p: minor log formatting fix 2015-12-17 22:35:01 +00:00
moneromooo-monero 9b4f8b4b7e
wallet: save to a temporary file, then rename
This should avoid most of wallet cache corruption cases
2015-12-17 22:32:54 +00:00