Commit graph

1432 commits

Author SHA1 Message Date
Riccardo Spagni 057a019e41
Merge pull request #727
6b0a903 Small cleanups (Howard Chu)
01c1512 More for 92dd4ec6d6 (Howard Chu)
2016-03-15 23:50:58 +02:00
Howard Chu 6b0a903177 Small cleanups
Only one return and TXN_POSTFIX_RDONLY() per function
Only log rtxn_start if the rtxn wasn't already active
2016-03-15 13:35:31 +00:00
Howard Chu 01c1512f22 More for 92dd4ec6d6
Make sure we stop the right txn too
2016-03-15 13:35:23 +00:00
Mike C 5dd91f6332 fix formatting error on bitmonero print_block return
Example of current return for `print_block 912345`:

    timestamp: 1452793716
    previous hash:
b61c58b2e0be53fad5ef9d9731a55e8a81d972b8d90ed07c04fd37ca6403ff78
    nonce: 1646
    is orphan: 0
    height: 912345
    depth: 85434
    hash:
e22cf75f39ae720e8b71b3d120a5ac03f0db50bba6379e2850975b4859190bc6difficul
ty: 815625611
    reward: 7388968946286
    {
      "major_version": 1,
      "minor_version": 2,
      …

Without `std::endl`, the difficulty gets smashed on the end of the hash.
2016-03-14 23:31:09 -06:00
Mike C ee71946cdc Fix typo on bitmonerod rpc method error. 2016-03-14 23:09:21 -06:00
Riccardo Spagni 240a50f3fb
Merge pull request #723
2abdb2c avoid some val copies (Howard Chu)
2016-03-14 22:20:42 +02:00
Howard Chu 92dd4ec6d6 Hack for read/write txn mixup
save the thread ID of the writer thread so we don't try to use
the writetxn from reader threads
2016-03-14 20:19:46 +00:00
Howard Chu 2abdb2c9fd avoid some val copies 2016-03-14 09:40:49 +00:00
Riccardo Spagni 8689014eda
switch default utilities DB to lmdb, update checkpoints.dat 2016-03-12 21:09:44 +02:00
Riccardo Spagni dd3cd9e7b8
Merge pull request #718
41ea91a simplewallet: fix hang when setting auto-refresh to 0 (moneromooo-monero)
2016-03-12 16:25:35 +02:00
Riccardo Spagni 853f80e23a
Merge pull request #717
28bfc90 simplewallet: special ^C handling for windows (moneromooo-monero)
2016-03-12 16:21:53 +02:00
moneromooo-monero 41ea91a97a
simplewallet: fix hang when setting auto-refresh to 0
It would try to join the auto refresh thread, which would
only happen after it was done, which would take a long time
when doing so on a newly created wallet.
2016-03-12 14:21:34 +00:00
Riccardo Spagni b66d455536
Merge pull request #716
789e275 rpc: do not return bans if they're effectively spent (moneromooo-monero)
474e4c0 p2p: lock access to the blocked ips map (moneromooo-monero)
2016-03-12 16:21:20 +02:00
Riccardo Spagni bb7b31d5ed
Merge pull request #715
8bc1bd6 wallet: use minimum mixin when RPC asks for too low mixin (moneromooo-monero)
31d2e0f wallet_rpc_server: make use_fork_rules public (moneromooo-monero)
2016-03-12 16:14:07 +02:00
moneromooo-monero 28bfc903b9
simplewallet: special ^C handling for windows
Because obviously it doesn't work as other POSIX platforms.

Reported and tested by luigi1111.
2016-03-12 14:05:25 +00:00
moneromooo-monero 789e2755f7
rpc: do not return bans if they're effectively spent
The blocked ip list will still hold them till next time
a connection attempt is made with that IP, so the effective
length of the ban may be negative.
2016-03-12 13:49:08 +00:00
moneromooo-monero 474e4c00f0
p2p: lock access to the blocked ips map 2016-03-12 13:48:58 +00:00
moneromooo-monero 8bc1bd6b65
wallet: use minimum mixin when RPC asks for too low mixin
After the fork, normal transfer functions called via RPC
use the minimum mixin 2 if 0 or 1 is requested. While the
incoming transaction may be valid (eg, it has an unmixable
and at most a mixable input), it is a simple way to make
sure RPC users can't get a seemingly random accept/reject
behavior if they don't update their requested mixin.
2016-03-11 21:32:16 +00:00
moneromooo-monero 31d2e0f84d
wallet_rpc_server: make use_fork_rules public
We will need it in the wallet RPC server
2016-03-11 21:31:50 +00:00
Riccardo Spagni 0a4dd68c17 minor tweaks, add readme for crypto_ops_builder 2016-03-11 22:48:46 +02:00
Riccardo Spagni dfd0e9c97d
Merge pull request #712
66c2fc7 Need to link boost::chrono in more places now (Howard Chu)
b937a2c Use boost::thread instead of std::thread (Howard Chu)
2016-03-11 20:15:10 +02:00
Howard Chu 66c2fc7b70 Need to link boost::chrono in more places now 2016-03-11 16:17:08 +00:00
Howard Chu b937a2c915 Use boost::thread instead of std::thread
and all other associated IPC
2016-03-11 15:09:50 +00:00
Howard Chu 8941ce0398 More for bdec7cb
More uses of db error helper
2016-03-09 18:24:16 +00:00
Riccardo Spagni b96147030c
Merge pull request #705
f7ed167 blockchain_utilities: Update documentation (warptangent)
2016-03-05 23:14:06 +02:00
Riccardo Spagni d0f011d873
Merge pull request #704
e2b7e55 get_payments short ID (luigi1111)
2016-03-05 23:13:23 +02:00
Riccardo Spagni 93605eb05f
Merge pull request #702
0485d17 blockchain_export: Support BerkeleyDB (warptangent)
41487e3 blockchain_export: Move DB implementation includes (warptangent)
2016-03-05 23:12:05 +02:00
warptangent f7ed167fc0
blockchain_utilities: Update documentation 2016-03-05 13:11:44 -08:00
Riccardo Spagni 32dc08d19a
Merge pull request #700
bdec7cb BlockchainLMDB: Use DB error helper consistently (warptangent)
c5932eb BlockchainLMDB: Add DB error to exception (warptangent)
a49c355 Blockchain: Omit verbose time stats messages by default (warptangent)
2016-03-05 23:10:38 +02:00
Riccardo Spagni c3af15702f
Merge pull request #698
ee7a8b8 Get rid of lmdb_cur (Howard Chu)
2016-03-05 23:06:26 +02:00
Riccardo Spagni 14c1e214ad
Merge pull request #696
d57ec75 Fix language (Howard Chu)
2016-03-05 23:06:04 +02:00
luigi1111 e2b7e55be6 get_payments short ID
Add support for short/integrated/encrypted IDs to get_payments RPC
2016-03-05 13:30:48 -06:00
warptangent 0485d17274
blockchain_export: Support BerkeleyDB
TEST:

blockchain_export -h

This should show "berkeley" as an available option to --database.

With an existing BerkeleyDB database, run:

blockchain_export --database berkeley
2016-03-05 06:46:11 -08:00
warptangent 41487e32be
blockchain_export: Move DB implementation includes 2016-03-05 06:46:09 -08:00
warptangent bdec7cbfb3
BlockchainLMDB: Use DB error helper consistently 2016-03-03 21:27:13 -08:00
warptangent c5932eb5ea BlockchainLMDB: Add DB error to exception 2016-03-03 20:15:37 -08:00
warptangent a49c355cae
Blockchain: Omit verbose time stats messages by default
This is already the default for the daemon, but by checking a command
line argument and calling a Blockchain member function setter.

Initialize the variable to false so it's not dependent on an external
command-line argument check. This allows utilities like
blockchain_import to have a reasonable default without code changes.
2016-03-03 20:14:48 -08:00
Howard Chu ee7a8b87f9 Get rid of lmdb_cur
We don't need it now with per-txn cursors.
2016-03-03 19:06:27 +00:00
Howard Chu d57ec7595c Fix language 2016-03-03 00:34:19 +00:00
Howard Chu f5affbef26 More for df239428c0
Let ARMv7 work again
2016-03-03 00:13:13 +00:00
warptangent 2c823c1589
Make partial revert consistent
If user-defined comparator is used, subdb shouldn't be opened with
MDB_INTEGERKEY.

TODO: Again, this will be added back with future schema updates.
2016-03-01 02:47:16 -08:00
warptangent df239428c0
Revert part of 7db89ed2ee
For now, so existing databases work.

TODO: add these back with future schema updates.
2016-02-29 18:03:41 -08:00
warptangent c9c4060dc6
BlockchainLMDB: Add height and db error to exception 2016-02-29 17:52:54 -08:00
Riccardo Spagni bf09285443
Merge pull request #688
c2a1fee simplewallet: prompt for private keys when generating wallets (moneromooo-monero)
4513b4c simplewallet: add a new --restore-from-keys option (moneromooo-monero)
2016-02-29 17:30:29 -05:00
Riccardo Spagni c3c4e28061
Merge pull request #687
5e3557d move g_test_dbg_lock_sleep from a global to a function level static (moneromooo-monero)
2016-02-29 17:30:10 -05:00
Riccardo Spagni d60bf4ee36
Merge pull request #686
7db89ed ARMv7: fix unaligned accesses (Howard Chu)
5a07cef Wrap some more actions in a larger read txn (Howard Chu)
8cc7a36 read txn/cursor stuff (Howard Chu)
86a7f2b core: check whether an update is needed straight away (moneromooo-monero)
ea5fa5e core: print "update needed" hard fork notifications in red (moneromooo-monero)
2016-02-29 17:29:26 -05:00
moneromooo-monero c2a1fee428
simplewallet: prompt for private keys when generating wallets
instead of supplying them on the command line. It's more
unwieldy, but better protects against information leaks.
2016-02-27 11:53:11 +00:00
Howard Chu 7db89ed2ee ARMv7: fix unaligned accesses
And cleanup some key comparators
2016-02-25 13:57:00 +00:00
Howard Chu 5a07cefe7b Wrap some more actions in a larger read txn 2016-02-23 20:47:15 +00:00
Howard Chu 8cc7a36f0b read txn/cursor stuff
Could wrap more later.
2016-02-23 20:47:15 +00:00
moneromooo-monero 86a7f2b1e7 core: check whether an update is needed straight away 2016-02-23 20:29:17 +00:00
moneromooo-monero ea5fa5e9b6 core: print "update needed" hard fork notifications in red 2016-02-23 20:29:17 +00:00
moneromooo-monero 283894d8ff
dns_utils: const compatibility with older libunbound
https://www.nlnetlabs.nl/bugs-script/show_bug.cgi?id=515
2016-02-23 19:02:05 +00:00
moneromooo-monero 4513b4cd2b
simplewallet: add a new --restore-from-keys option
It is similar in use to --restore-from-view-key, but also expects
a spend private key.

Requested by luigi1112, and useful to restore MyMonero wallets.
2016-02-22 22:10:55 +00:00
moneromooo-monero 5e3557d2c3
move g_test_dbg_lock_sleep from a global to a function level static
This avoids the need to define that variable in every program
which uses epee.
2016-02-22 19:34:09 +00:00
moneromooo-monero 0eb4d054f6
db_bdb: add missing include for std::condition_variable 2016-02-20 15:38:43 +00:00
Riccardo Spagni 81a93cd171
Merge pull request #680
360f72f simplewallet: wording change for single tx confirmation (moneromooo-monero)
2016-02-20 17:11:31 +02:00
Riccardo Spagni c3baa82ac8
Merge pull request #678
11d555c Fix crash in std::map for connections_map (Howard Chu)
014f886 std::condvar is broken on Win32 with gcc/g++ 4.8 too (Howard Chu)
7c86c59 Use boost::thread instead of std::thread (Howard Chu)
2016-02-20 17:10:51 +02:00
Riccardo Spagni a903d9c3f6
Merge pull request #677
57e75fa BlockchainBDB: Check if hard fork subdbs need reset (warptangent)
47f6cf8 BlockchainBDB: Support blockchain_import --drop-hard-fork command (warptangent)
2016-02-20 17:09:49 +02:00
moneromooo-monero 360f72fa90
simplewallet: wording change for single tx confirmation 2016-02-20 11:17:28 +00:00
Howard Chu 014f8868f2 std::condvar is broken on Win32 with gcc/g++ 4.8 too
Use boost...
2016-02-18 21:31:21 +00:00
Howard Chu 7c86c5997d Use boost::thread instead of std::thread
std::thread crashes on (at least) ARMv6 g++ 4.8/4.9
2016-02-18 21:30:10 +00:00
warptangent 57e75fa33f
BlockchainBDB: Check if hard fork subdbs need reset
See f7e337e625 for LMDB equivalent.
2016-02-18 06:38:56 -08:00
warptangent 47f6cf8bea
BlockchainBDB: Support blockchain_import --drop-hard-fork command
See c657e772c4 for LMDB equivalent.
2016-02-18 06:37:45 -08:00
warptangent d258f6e63a
blockchain_import: Pass ARCH_WIDTH macro if 32-bit or not.
This also avoids warnings.
2016-02-18 06:14:35 -08:00
Riccardo Spagni 1889c0e81c
Merge pull request #675
27d4e50 core: check whether an update is needed straight away (moneromooo-monero)
8892173 core: print "update needed" hard fork notifications in red (moneromooo-monero)
2016-02-18 10:01:37 +02:00
Riccardo Spagni 43fe8c4933
Merge pull request #674
05e7ac0 blockchain_import: Check bit width for more than just WIN32 (warptangent)
2016-02-18 10:01:01 +02:00
moneromooo-monero 27d4e50dfa
core: check whether an update is needed straight away 2016-02-17 22:57:38 +00:00
moneromooo-monero 889217381f
core: print "update needed" hard fork notifications in red 2016-02-17 22:57:14 +00:00
Howard Chu 9218cad640 Fix cffc411c90
Don't include bdb header unless defined(BERKELEY_DB)
2016-02-17 20:41:34 +00:00
warptangent 05e7ac0360
blockchain_import: Check bit width for more than just WIN32
Pass the CMake bit width setting to compile flags for blockchain_import
and blockchain_converter.

For LMDB on 32-bit, hyc has found that batch size of 100 appears to be a
good default.
2016-02-17 12:37:15 -08:00
Howard Chu 02abe3590d Use MDB_PREV_MULTIPLE
in get_global_output_indices
2016-02-17 16:14:50 +00:00
Howard Chu 7a4755d3a4 Fixup after lmdb master resync 2016-02-17 16:14:38 +00:00
Riccardo Spagni c069814773
Merge pull request #672
3b13a74 Shutup about VERSION 0 (Howard Chu)
1537477 Use cursor in get_output_key (Howard Chu)
f2faf8c Use MDB_APPEND mode where possible (Howard Chu)
090b548 Use cursors in write txns (Howard Chu)
ed08d21 Keep a running blocksize count (Howard Chu)
0fc9334 Win32 import batchsize tweaks (Howard Chu)
2016-02-17 17:10:07 +02:00
Riccardo Spagni 6636b0a6da
Merge pull request #671
8f09b71 wallet: clear missing data on rescan_bc (moneromooo-monero)
2016-02-17 17:09:48 +02:00
Riccardo Spagni 3225a7d28d
Merge pull request #666
27f76e2 blockchain_import: Build string for db type list (warptangent)
1aa8a9d blockchain_import: Add mode argument representing multiple DB flags (warptangent)
cffc411 blockchain_import: Support BerkeleyDB (warptangent)
19c1aaa blockchain_import: Add database type argument (warptangent)
0fedce0 blockchain_import: Make LMDB-specific names general (warptangent)
2016-02-17 17:09:21 +02:00
Howard Chu 3b13a7473e Shutup about VERSION 0 2016-02-17 05:06:19 +00:00
Howard Chu 1537477c9f Use cursor in get_output_key 2016-02-17 04:05:29 +00:00
Howard Chu f2faf8cdd9 Use MDB_APPEND mode where possible
When keys are contiguous and monotonically increasing, this gets
denser page utilization (doesn't leave padding in page splits).
Can't be used for keys that are inserted in random order (e.g. hashes)
In total this only saves around 1.5% of space compared to original
DB code. The previous patch accounted for 0.8% savings on its own;
the blocks tables just aren't that big.
2016-02-17 04:05:29 +00:00
Howard Chu 090b548c3b Use cursors in write txns
Saves a bit of seek overhead. LMDB frees them automatically
in txn_(commit|abort) so they need no cleanup.
2016-02-17 04:05:29 +00:00
Howard Chu ed08d2152e Keep a running blocksize count
Used in batch size estimation, avoids rereading already processed
blocks during import
2016-02-17 04:05:28 +00:00
Howard Chu 0fc93345ea Win32 import batchsize tweaks
Reduce frequency of resizes: bump minimum increase from 128MB to 512MB
Use a bigger safety margin at small batch sizes
2016-02-17 04:05:28 +00:00
moneromooo-monero 8f09b71b9b
wallet: clear missing data on rescan_bc 2016-02-15 20:51:30 +00:00
warptangent 27f76e2ee4
blockchain_import: Build string for db type list 2016-02-14 16:25:35 -08:00
warptangent 1aa8a9d26f
blockchain_import: Add mode argument representing multiple DB flags
These modes match those optionally provided as part of the daemon's
--db-type argument.

Argument after the # is interpreted as a composite mode if there's only
one (no comma separated arguments).

Sample usage:

blockchain_import --database lmdb#fastest

blockchain_import --database berkeley#fastest

Multiple specific DB flags are still supported, e.g.

blockchain_import --database lmdb#nosync,nordahead

blockchain_import --database berkeley#txn_nosync
2016-02-14 16:25:35 -08:00
Howard Chu d8f9bb380c Keep a running blocksize count
Used in batch size estimation, avoids rereading already processed
blocks during import
2016-02-15 00:22:09 +00:00
warptangent cffc411c90
blockchain_import: Support BerkeleyDB 2016-02-14 16:02:38 -08:00
warptangent 19c1aaa9f6
blockchain_import: Add database type argument
Default to LMDB.
2016-02-14 16:02:37 -08:00
warptangent 0fedce00d5
blockchain_import: Make LMDB-specific names general
Also update terms to better distinguish blockchain management/engine
from database type.
2016-02-14 16:02:37 -08:00
Howard Chu bf22109d16 Win32 import batchsize tweaks
Reduce frequency of resizes: bump minimum increase from 128MB to 512MB
Use a bigger safety margin at small batch sizes
2016-02-14 19:31:52 +00:00
Riccardo Spagni 63e2d4195b
Merge pull request #657
1995923 BlockchainLMDB: Deal with DB exceptions at block level with particularity (warptangent)
c16cc20 BlockchainLMDB: Add sanity check for inconsistent state (warptangent)
9118d0a BlockchainLMDB: Call destructor on allocated txn if setup fails (warptangent)
f5581c3 BlockchainLMDB: Replace remaining txn pointer NULLs with nullptr (warptangent)
2016-02-13 19:54:47 +02:00
Riccardo Spagni 354d478286
Merge pull request #656
9832d18 cmake: Include OpenSSL libraries in static linking (warptangent)
c2f2437 cmake: Remove unused variable (warptangent)
7205210 cmake: Fix unbound config compile settings (warptangent)
3e72d97 cmake: Fix overly broad use of dynamic link settings (warptangent)
2016-02-13 19:51:56 +02:00
Riccardo Spagni 999992a64b
Merge pull request #652
c7e6b77 crypto: only check MONERO_USE_SOFTWARE_AES once (moneromooo-monero)
74aef21 crypto: use software AES based on the MONERO_USE_SOFTWARE_AES env var (moneromooo-monero)
2016-02-13 19:51:30 +02:00
warptangent 1995923559
BlockchainLMDB: Deal with DB exceptions at block level with particularity
Add another DB error exception type to distinguish failed txn setup from
general use of txn.

This keeps the error handling flow the same as before the block-level
txn setup changes that moved control up a layer to BlockchainDB.
2016-02-13 05:12:39 -08:00
warptangent c16cc204d3
BlockchainLMDB: Add sanity check for inconsistent state
This hasn't been known to occur in block-level txn abort, but throw
exception if it does.
2016-02-13 04:17:37 -08:00
warptangent 9118d0a44c
BlockchainLMDB: Call destructor on allocated txn if setup fails 2016-02-13 04:17:37 -08:00
warptangent f5581c3536
BlockchainLMDB: Replace remaining txn pointer NULLs with nullptr
For consistency.
2016-02-13 04:17:36 -08:00
warptangent 3e72d97ca7
cmake: Fix overly broad use of dynamic link settings
Remove LINK_SEARCH_START_STATIC and LINK_SEARCH_END_STATIC. This is more
appropriate when the compiler flag -static is used.

This had been causing CMake to omit the linker flags necesssary to
distinguish static and dynamic library linking. CMake had assumed static
linking for the target, causing it to omit explicit static link flags.
That is problematic without the -static compile flag being set.

With a library located in system directories, like libboost_date_time,
the full static path (.a), though found correctly by CMake, was treated
by the linker as a dynamic library. This is because
target_link_libraries() transforms the full path to -l<libname> if it's
in a system directory.  Without -static or explicit linker flags, the
dynamic library (.so) is linked.

Removing the above two properties removes the assumption of static. So
-Wl;-Bstatic is inserted where needed. This causes -l<libname> to
properly refer to the static library instead of dynamic.
2016-02-12 14:49:43 -08:00
moneromooo-monero c7e6b77395
crypto: only check MONERO_USE_SOFTWARE_AES once 2016-02-09 09:38:17 +00:00
moneromooo-monero 74aef213fe
crypto: use software AES based on the MONERO_USE_SOFTWARE_AES env var
Setting to no or 0 also works. If set, any other value enables it.

Useful for running with valgrind in cases where it fails at
properly implementing AES-NI.
2016-02-09 09:30:34 +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 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
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
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
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
moneromooo-monero 64a2aa3376
hardfork: allow passing chain height in get(height) for convenience 2016-02-01 20:06:55 +00: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
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
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 6288295f8e
rpc: add missing return on error when getting a tx 2016-01-30 13:28:12 +00:00
moneromooo-monero b7e37b7763
simplewallet: show_transfers can now show just failed txes 2016-01-30 13:26:57 +00:00
moneromooo-monero b11539fda7
wallet: detect and handle failed outgoing transfers
When a transaction is not found in the pool anymore, it is marked
as failed, and displayed as such in show_transfers.
2016-01-29 19:44:48 +00:00
moneromooo-monero 4b23714658
tx_pool: serialize missing kept_by_block flag 2016-01-29 19:44:25 +00:00
Riccardo Spagni b91fc2dc3c
Merge pull request #629
94b98fb tx_pool: do not accept txes not in a block if they timed out before (moneromooo-monero)
eadbdf3 tx_pool: fix use of invalidated iterator (moneromooo-monero)
3b1d7e0 Fix V1/V2 use of hard fork related parameters (moneromooo-monero)
2016-01-29 19:24:24 +02: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
warptangent b8cc6d46bd
BlockchainBDB: Continue when tx has no outputs
See 24b66243c2
2016-01-28 21:15:46 -08:00
warptangent b8707466e2
BlockchainBDB: 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" db. This is most noticeable for
HDDs.

See ffcf6bdb95
2016-01-28 21:15:44 -08:00
warptangent 1a5c3fa729
BlockchainBDB: 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.

See f11def012f
2016-01-28 21:15:42 -08:00
Riccardo Spagni afe2d1a09f
add received time to print_pool and print_pool_sh 2016-01-28 11:24:26 +02:00
Riccardo Spagni 153fe0cb75
Merge pull request #622
e514f0a even more typos (Henning Kopp)
9abc4b8 more typos fixed (Henning Kopp)
0693f3c fixed typo (Henning Kopp)
2016-01-25 19:39:07 +02:00
Riccardo Spagni 56570ee2b5
Merge pull request #621
f76f656 simplewallet: remove leftover command line refresh-type handling (moneromooo-monero)
2016-01-25 19:38:35 +02:00
Riccardo Spagni 96d0c0373e
Merge pull request #620
15d9ac8 wallet2: update spent comparison now that we have two spent states (moneromooo-monero)
2016-01-25 19:38:14 +02:00
Henning Kopp e514f0a369 even more typos 2016-01-25 15:05:29 +01:00
Henning Kopp 9abc4b831b more typos fixed 2016-01-25 13:42:44 +01:00
Henning Kopp 0693f3c7e6 fixed typo 2016-01-25 13:36:14 +01:00
moneromooo-monero f76f656d55
simplewallet: remove leftover command line refresh-type handling 2016-01-25 08:29:49 +00:00
moneromooo-monero 15d9ac8abd
wallet2: update spent comparison now that we have two spent states 2016-01-24 19:55:18 +00:00
me0wmix 28f95eb001 OpenBSD support for Monero. 2016-01-21 11:18:26 -07:00
warptangent 24b66243c2
db_lmdb: Continue when tx has no outputs 2016-01-19 16:55:31 -08:00
Howard Chu 30f92f5630 Fix hf when import with verify off
Delete the hf tables, so the next open will rescan and regenerate
2016-01-15 17:26:19 +00:00
Riccardo Spagni b9c7ba180d
added checkpoints 2016-01-15 15:22:31 +02:00
Riccardo Spagni a583a96d82
bumped version to 0.9.1 for point release 2016-01-15 15:03:43 +02:00
Riccardo Spagni 15e0cbd01e
Merge pull request #610
945ac78 hardfork: fix accepting v2 blocks too early (moneromooo-monero)
2016-01-15 15:02:26 +02:00
moneromooo-monero 945ac788d4
hardfork: fix accepting v2 blocks too early 2016-01-15 11:54:35 +00:00
binaryFate 0100e951d3 'max limit of...' is redundant wording, rephrase 2016-01-14 23:13:12 +01:00
binaryFate 80e38895b3 Print msg when successfully updating out_peers 2016-01-14 23:10:07 +01:00
Riccardo Spagni 92b753d5e4
Merge pull request #606
8ce12a9 Fix arm asm (Howard Chu)
94de39f Tweak arm6 flags (Howard Chu)
2016-01-12 14:44:46 +02:00
Riccardo Spagni d31d424726
Merge pull request #603
c5baf30 use load_file_to_string and exit with error on file read errors (Fabian Hirschmann)
7b2d27f remove new lines at the end of the password only (Fabian Hirschmann)
302cc9c add --password-file option (Fabian Hirschmann)
2016-01-12 14:43:38 +02:00
Howard Chu 8ce12a978e Fix arm asm
About 10% faster than plain C mul128 on raspi1B
2016-01-11 23:16:02 +00:00
moneromooo-monero 664dc42e18
rpc: fix missing target information in RPC call
which fixes the status command via RPC too.

Turns out there are two versions of the GET_INFO call.
I'd never noticed before.
2016-01-11 22:52:01 +00:00
moneromooo-monero eaf4dcd747
daemon: fix status command when run from command line 2016-01-11 21:50:41 +00:00
moneromooo-monero 67bbb56a6c
wallet2: decide at runtime which upper tx size to use
The value will be different depending on whether we've reached
the first hard fork, which allows a larger size, or not.

This fixes transactions being rejected by the daemon on mainnet
where the first hard fork is not yet active.
2016-01-10 11:56:13 +00:00
Fabian Hirschmann c5baf30208 use load_file_to_string and exit with error on file read errors 2016-01-09 19:11:34 +01:00
Fabian Hirschmann 7b2d27f89a remove new lines at the end of the password only 2016-01-09 18:59:39 +01:00
Fabian Hirschmann 302cc9c700 add --password-file option 2016-01-09 02:49:41 +01:00
moneromooo-monero a44d94d390
rpc: is_key_image_spent now checks the tx pool too 2016-01-05 22:16:24 +00:00
Riccardo Spagni 58dbc9d122
fixed conflicts 2016-01-03 20:02:44 +02:00
Howard Chu da0bce3472 Use CMAKE_LINKER, not hardcoded "ld" 2016-01-03 08:22:38 +00:00
moneromooo-monero 7f8e5ced47
daemon: fix ban length using wrong parameter 2016-01-02 16:30:12 +00:00
Riccardo Spagni 5c71f5d13e
update version 2015-12-31 23:12:13 +02: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 ac7d27d4f9
Merge pull request #584
5c67c48 wallet: don't forget to close the file after storing cache (moneromooo-monero)
2015-12-31 12:43:15 +02:00
moneromooo-monero 5c67c486e8
wallet: don't forget to close the file after storing cache
Also add some flags to open, as epee's save_string_to_file does,
to truncate file, etc.
2015-12-31 10:34:17 +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
moneromooo-monero bc8a52efd8
wallet: add a rescan_bc command and rescan_blockchain RPC
Blockchain hashes and key images are flushed, and blocks are
pulled anew from the daemon.
The console command is shortened to match bc_height.
This should make it a lot easier on users who are currently
told to remove this particular cache file but keep the keys
one, etc, etc.
2015-12-30 15:06:03 +00:00
moneromooo-monero 92ef6b54fe
wallet: protect against exceptions in the block pull thread
This can happen when the daemon exits, which would also cause
the wallet to crash via unhandled exception
2015-12-30 12:43:15 +00:00
moneromooo-monero af2106122d
net_peerlist: move a couple functions from public to private
They do not take the object lock, and are meant to be used only
internally, called from a function which does take the lock.
2015-12-30 11:37:49 +00:00
Riccardo Spagni 32a26332f8
no longer need to pass the size to rapidjson 2015-12-30 12:25:29 +02:00
Riccardo Spagni 9e45eadb98
Merge pull request #575
61befc2 wallet: store cache to file without unnecessary memory buffer (moneromooo-monero)
2015-12-30 09:40:33 +02:00
Riccardo Spagni b6d41cdac1
Merge pull request #574
61ce8d6 wallet_rpc_server: exit async, so we reply to stop_wallet RPC (moneromooo-monero)
9847db6 wallet: do not return error if incoming_transfers finds none (moneromooo-monero)
2015-12-30 09:40:04 +02: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 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
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
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
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 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 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
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 47ca455ea8
fixed missing parenthesis 2015-12-24 18:11:11 +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
Brendan Telzrow 791e7fb263 changed height to uint64_t 2015-12-23 13:10:59 -06:00
Brendan Telzrow 4cd7913a04 added RPC wallet command getheight 2015-12-23 10:04:04 -06: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 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