Commit Graph

10029 Commits

Author SHA1 Message Date
Pieter Wuille 66270a416e
Merge #10557: Make check to distinguish between orphan txs and old txs more efficient.
18bacec6c Make check to distinguish between orphan txs and old txs more efficient. (Alex Morcos)

Tree-SHA512: b6b4bad89aa561975dce7b68b2fdad5623af5ebcb9c38fd6a72b5f6d0544ed441df4865591ac018f7ae0df9b5c60820cb4d9e55664f5667c9268458df70fd554
2017-07-14 11:54:50 -07:00
João Barbosa a2420ae2f1 Avoid unnecessary work in SetNetworkActive 2017-07-14 15:01:05 +01:00
Wladimir J. van der Laan db825d293b
Merge #10806: build: verify that the assembler can handle crc32 functions
d34d77a build: verify that the assembler can handle crc32 functions (Cory Fields)

Pull request description:

  Also, enable crc32 even if -msse4.2 wasn't added by us, as long as it works. This allows custom flags (such as -march=native) to work as expected.

  Addresses #10670.

Tree-SHA512: e1a41a87b078d270bc645814315b229ad9c16556a4d14fb66b27a65b28d0caf9bf324f8c1e221854992aa17f53466eece06faebbf74d59b3d4ff2e6db6c614a4
2017-07-14 09:23:59 +02:00
Pieter Wuille a9e82f6512 Use cpuid intrinsics instead of asm code 2017-07-13 16:43:05 -07:00
João Barbosa 4652791141 Fix uninitialized atomic variables 2017-07-13 23:25:56 +01:00
John Newbery 5c643241e5 [utils] allow square brackets for ipv6 addresses in bitcoin-cli
-rpcconnect can now accept ipv6 addresses with and without square
brackets.
2017-07-13 17:15:36 -04:00
Alex Morcos dd97a529ad Properly forbid -salvagewallet and -zapwallettxes for multi wallet. 2017-07-13 13:48:28 -04:00
Cory Fields d34d77a51b build: verify that the assembler can handle crc32 functions
Also, enable crc32 even if -msse4.2 wasn't added by us, as long as it works.
This allows custom flags (such as -march=native) to work as expected.
2017-07-13 12:49:05 -04:00
Jonas Schnelli 2aef1f1829
[Qt] migrate old fee slider value to new dropbown
Always round up (conservative)
2017-07-13 12:21:22 +02:00
Jonas Schnelli bc1be90e37
[Qt] replace fee slider with a Dropdown, extend conf. targets 2017-07-13 12:20:09 +02:00
Jonas Schnelli 7666250ffb
Merge #10810: missing white space in function arg
69a4339ef missing white space in function arg (Lawrence Nahum)

Pull request description:

Tree-SHA512: 94d832eca0b5429cf48c7c1d4489942b53182c5b7ad9f24264867e7631301173c23a48f7b2e8fd22ff1b3137bafacb3f9d4320f4df235668c9096aaefff7afe8
2017-07-13 09:21:14 +02:00
Pieter Wuille e4fcbf797e
Merge #10780: Simplify "!foo || (foo && bar)" as "!foo || bar"
1e3a3200a Simplify "!foo || (foo && bar)" as "!foo || bar" (practicalswift)

Tree-SHA512: d5ce6d7a9f3741e7abe8542b840268aa683e276aac7587041d32385a4c1273e20c236bec7590e27540dde72defb3f879d4695822bb7bfdb092cc20d9aefa64c1
2017-07-12 18:25:35 -07:00
Lawrence Nahum 69a4339ef5
missing white space in function arg 2017-07-13 01:36:39 +02:00
Pieter Wuille 479afa0f84
Merge #9804: Fixes subscript 0 (&var[0]) where should use (var.data()) instead.
30ac7688e Fix subscript[0] potential bugs in key.cpp (Jeremy Rubin)
4b1c0f2e2 Remove unnecessary branches in utilstrencodings string constructors. (Jeremy Rubin)
e19db7b5a Fix subscript[0] in utilstrencodings.cpp (Jeremy Rubin)
bc2e7fd98 Fix subscript[0] in streams.h (Jeremy Rubin)
4cac0d1e0 Fix subscript[0] in validation.cpp (Jeremy Rubin)
ac658e55f Fix subscript[0] in torcontrol (Jeremy Rubin)
b6856ebed Fix subscript[0] in netaddress.cpp (Jeremy Rubin)
361d95265 Fix subscript[0] in base58.cpp (Jeremy Rubin)
6896dbf16 Cleanup (safe, it was checked) subscript[0] in MurmurHash3 (and cleanup MurmurHash3 to be more clear). (Jeremy Rubin)
96f2119e6 Fix subscript[0] in compressor.cpp (Jeremy Rubin)
500710bd2 Fix 2 subscript[0] bugs in pubkey.cpp, and eliminate one extra size check (Jeremy Rubin)
e0451e3e2 Fix subscript[0] bug in net.cpp if GetGroup returns a 0-sized vector (Jeremy Rubin)

Tree-SHA512: 5b9103652cf8c615bd8f4f32b3573d291d6b67c39e0308ce00100bc6625f346e8e016b4c999f4f34f5c37ae059490a83c3b513deb21f838af785227d06e02362
2017-07-12 16:29:48 -07:00
Pieter Wuille 2a09a3891f
Merge #10714: Avoid printing incorrect block indexing time due to uninitialized variable
959dd8781 Avoid printing incorrect block indexing time due to uninitialized variable (practicalswift)

Tree-SHA512: a76e43c3ffa734ed5c7eadf363f345f268aa0e6ce775aba8f856fe3bbc82f240dc7c734c5ca3ac500a12eb41fae00623413e79f484d5acf809b6e400851d771d
2017-07-12 15:17:24 -07:00
John Newbery fe4fabaf12 [refactor] move SplitHostPort() into utilstrencodings
This moves SplitHostPort from libbitcoin_common to libbitcoin_util so it
is available to bitcoin-cli.
2017-07-12 17:06:15 -04:00
Gregory Sanders 228987d84c getbalance example covers at least 6 confirms 2017-07-12 14:40:02 -04:00
Matt Corallo 1016dacfac Fix signed/unsigned comparison warning introduced in c8e29d7ff0. 2017-07-12 14:03:42 -04:00
Chris Stewart 8276e70de1 Adding assert to avoid a memory access violation inside of PartialMerkleTree::CalcHash()
Adding comment to assert in PartialMerkleTree::CalcHash()

Adding comment on CMerkleBlock indicating it calls something that contains an assert

Removing EOL whitespace
2017-07-12 10:48:37 -05:00
Alex Morcos 0f402b9263 Fix rare edge case of paying too many fees when transaction has no change.
Due to the iterative process of selecting new coins in each loop a new fee is
calculated that needs to be met each time.  In the typical case if the most
recent iteration of the loop produced a much smaller transaction and we have now
gathered inputs with too many fees, we can just reduce the change.  However in
the case where there is no change output, it is possible to end up with a
transaction which drastically overpays fees.  This commit addresses that case,
by creating a change output if the overpayment is large enough to support it,
this is accomplished by rerunning the transaction creation loop without
selecting new coins.

Thanks to instagibbs for working on this as well
2017-07-11 12:20:41 -04:00
Alex Morcos 253cd7ec4f Only reserve key for scriptChange once in CreateTransaction
This does not affect behavior but allows us to have access to an output to
scriptChange even if we currently do not have change in the transaction.
2017-07-11 12:17:56 -04:00
Wladimir J. van der Laan b27b004532
Merge #10543: Change API to estimaterawfee
5e3b7b5 Improve error reporting for estimaterawfee (Alex Morcos)
1fafd70 Add function to report highest estimate target tracked per horizon (Alex Morcos)
9c85b91 Change API to estimaterawfee (Alex Morcos)

Tree-SHA512: e624c6e7967e9e48abe49f5818bd674e5710e571cc093029d2f90d39fdfba3c1f30e83bf89f6dce97052b59a7d9636a64642ccfb26effd149c417d0afbed0c0b
2017-07-11 15:36:56 +02:00
Wladimir J. van der Laan badd81bd31
Merge #10792: Replace MAX_OPCODE for OP_NOP10.
c8e29d7 Replace MAX_OPCODE for OP_NOP10. (Mark Friedenbach)

Tree-SHA512: f6a4129db24fe3feb044acaec3b94194cc4fa909de3d0a45a664b32f886a7d8ab997c9cb6ff0870c4aee66d8e038cf0453dbbb518316829d15e84da9882f3e69
2017-07-11 15:24:11 +02:00
Wladimir J. van der Laan 104f5f21dc
Merge #10589: More economical fee estimates for RBF and RPC options to control
f135923 Add RPC options for RBF, confirmation target, and conservative fee estimation. (Alex Morcos)
f0bf33d Change default fee estimation mode. (Alex Morcos)
e0738e3 remove default argument from estimateSmartFee (Alex Morcos)
d507c30 Introduce a fee estimate mode. (Alex Morcos)
cfaef69 remove default argument from GetMinimumFee (Alex Morcos)

Tree-SHA512: 49c3a49a6893790a7e8b4e93a48f123dd5307af26c2017800683b76b4df8fc904ba73402917878676242c7440e3e04288d0c1ff3c2c907418724efc03cedab50
2017-07-11 11:58:02 +02:00
Wladimir J. van der Laan 379aed0e53
Merge #10676: document script-based return fields for validateaddress
f2f1d0a document script-based return fields for validateaddress (Gregory Sanders)

Tree-SHA512: 3310bb82b63ef20e46dd7ebcc9e15828cc7b6767ef19ddd869eeb5e4ee5b31ee307d21a44a9c81dbfe9d031bd48219e3ee1d330fc7b343d63d5365b68639c062
2017-07-11 11:43:37 +02:00
Mark Friedenbach c8e29d7ff0 Replace MAX_OPCODE for OP_NOP10.
That OP_NOP10 is the last executable opcode is a bit of a obscure trivia, and the MAX_OPCODE constant already exists. This merely standardizes use of MAX_OPCODE over OP_NOP10 where it makes sense and is more clear.
2017-07-11 16:45:42 +09:00
Wladimir J. van der Laan 21ed30a314
Merge #10179: Give CValidationInterface Support for calling notifications on the CScheduler Thread
1f668b6 Expose if CScheduler is being serviced, assert its not in EmptyQueue (Matt Corallo)
3192975 Flush CValidationInterface callbacks prior to destruction (Matt Corallo)
08096bb Support more than one CScheduler thread for serial clients (Matt Corallo)
2fbf2db Add default arg to CScheduler to schedule() a callback now (Matt Corallo)
cda1429 Give CMainSignals a reference to the global scheduler (Matt Corallo)
3a19fed Make ValidationInterface signals-type-agnostic (Matt Corallo)
ff6a834 Use TestingSetup to DRY qt rpcnestedtests (Matt Corallo)

Tree-SHA512: fab91e34e30b080ed4d0a6d8c1214910e383c45440676e37be61d0bde6ae98d61e8903d22b846e95ba4e73a6ce788798350266feba246d8a2ab357e8523e4ac5
2017-07-11 09:38:51 +02:00
Matt Corallo 1f668b6468 Expose if CScheduler is being serviced, assert its not in EmptyQueue 2017-07-10 21:08:19 -04:00
Alex Morcos 5e3b7b5686 Improve error reporting for estimaterawfee 2017-07-10 20:07:17 -04:00
Alex Morcos 1fafd704da Add function to report highest estimate target tracked per horizon 2017-07-10 20:07:17 -04:00
Alex Morcos 9c85b91dc1 Change API to estimaterawfee
Report results for all 3 possible time horizons instead of specifying time horizon as an argument.
2017-07-10 20:07:13 -04:00
Alex Morcos f135923ee2 Add RPC options for RBF, confirmation target, and conservative fee estimation.
Add support for setting each of these attributes on a per RPC call basis to sendtoaddress, sendmany, fundrawtransaction (already had RBF), and bumpfee (already had RBF and conf target).
2017-07-10 12:40:02 -04:00
Wladimir J. van der Laan 9edda0c5f5
Merge #10747: [rpc] fix verbose argument for getblock in bitcoin-cli
58e9864 [rpc] fix verbose argument for getblock in bitcoin-cli (John Newbery)

Tree-SHA512: 7f176e1ddd9f3f7722ea0d268549629567ecf0c30bebf368824997566df0bfa01d31cf761abc9ca355e48c0bf0cb06d49d15a02b858999fcb7472dc7df2fbbf2
2017-07-10 17:50:21 +02:00
practicalswift 1e3a3200af Simplify "!foo || (foo && bar)" as "!foo || bar" 2017-07-09 13:39:58 +02:00
Jeremy Rubin 30ac7688e3 Fix subscript[0] potential bugs in key.cpp 2017-07-08 13:37:06 -07:00
Jeremy Rubin 4b1c0f2e2e Remove unnecessary branches in utilstrencodings string constructors. 2017-07-08 13:33:01 -07:00
Jeremy Rubin e19db7b5ad Fix subscript[0] in utilstrencodings.cpp 2017-07-08 13:33:01 -07:00
Jeremy Rubin bc2e7fd984 Fix subscript[0] in streams.h 2017-07-08 13:33:01 -07:00
Jeremy Rubin 4cac0d1e04 Fix subscript[0] in validation.cpp 2017-07-08 13:33:01 -07:00
Jeremy Rubin ac658e55ff Fix subscript[0] in torcontrol 2017-07-08 13:33:01 -07:00
Jeremy Rubin b6856ebedc Fix subscript[0] in netaddress.cpp 2017-07-08 13:33:01 -07:00
Jeremy Rubin 361d95265a Fix subscript[0] in base58.cpp 2017-07-08 13:33:01 -07:00
Jeremy Rubin 6896dbf169 Cleanup (safe, it was checked) subscript[0] in MurmurHash3 (and cleanup MurmurHash3 to be more clear). 2017-07-08 13:33:01 -07:00
Jeremy Rubin 96f2119e6c Fix subscript[0] in compressor.cpp 2017-07-08 13:33:01 -07:00
Jeremy Rubin 500710bd29 Fix 2 subscript[0] bugs in pubkey.cpp, and eliminate one extra size check 2017-07-08 13:31:47 -07:00
Jeremy Rubin e0451e3e2a Fix subscript[0] bug in net.cpp if GetGroup returns a 0-sized vector 2017-07-08 13:31:47 -07:00
romanornr d9d1bd3267
nCheckDepth chain height fix 2017-07-08 19:49:11 +02:00
Pavel Janík 5618b7d1ad Do not shadow upper local variable `state`. 2017-07-08 09:30:35 +02:00
Pieter Wuille 0aadc11fd8 Avoid dereference-of-casted-pointer 2017-07-07 10:45:31 -07:00
Matt Corallo 3192975f1d Flush CValidationInterface callbacks prior to destruction
Note that the CScheduler thread cant be running at this point,
it has already been stopped with the rest of the init threadgroup.
Thus, just calling any remaining loose callbacks during Shutdown()
is sane.
2017-07-07 12:55:57 -04:00
Matt Corallo 08096bbbc6 Support more than one CScheduler thread for serial clients
This will be used by CValidationInterface soon.

This requires a bit of work as we need to ensure that most of our
callbacks happen in-order (to avoid synchronization issues in
wallet) - we keep our own internal queue and push things onto it,
scheduling a queue-draining function immediately upon new
callbacks.
2017-07-07 11:33:18 -04:00
Matt Corallo 2fbf2dbe15 Add default arg to CScheduler to schedule() a callback now 2017-07-07 11:33:18 -04:00
Matt Corallo cda1429d5b Give CMainSignals a reference to the global scheduler
...so that it can run some signals in the background later
2017-07-07 11:33:18 -04:00
MarcoFalke ed88e3194c
Merge #10744: Use method name via __func__ macro
9bbf600 Use method name from __func__ macro (darksh1ne)

Tree-SHA512: da6d0714f458b538189bbc2b53252ba353dcc1ef15fa780cb7f690a034b58ab0dbaa3a89f83f044c746241ee265a70fc092449f1cc7be4f190775423fbca5fc5
2017-07-07 13:13:45 +02:00
Alex Morcos f0bf33da83 Change default fee estimation mode.
Fee estimates will default to be non-conservative if the transaction in question is opt-in-RBF.
2017-07-06 22:20:23 -04:00
Alex Morcos e0738e3d31 remove default argument from estimateSmartFee 2017-07-06 22:20:23 -04:00
Alex Morcos d507c301bc Introduce a fee estimate mode.
GetMinimumFee now passes the conservative argument into estimateSmartFee.
Call CalculateEstimateType(mode) before calling GetMinimumFee or estimateSmartFee to determine the value of this argument.
CCoinControl can now be used to control this mode.
2017-07-06 22:20:23 -04:00
Alex Morcos cfaef69ace remove default argument from GetMinimumFee 2017-07-06 22:20:23 -04:00
Wladimir J. van der Laan 5af6572534
Merge #10698: Be consistent in calling transactions "replaceable" for Opt-In RBF
73c942e Use "replaceable" instead of "rbfoptin" in bitcoin-tx. (Matt Corallo)
fb915d5 Use "replaceable" instead of "optIntoRbf" in fundrawtransaction. (Matt Corallo)
928c681 Use "replaceable" instead of "optintorbf" in createrawtransaction. (Matt Corallo)

Tree-SHA512: 8922451c00abb63aaa08b4a9e314e89c22233b32f207259fbc25367f7d5b67efbaccc7e2a4958c18611ad498da302296242860c7be965a0e996dcde3e89efa07
2017-07-06 20:37:40 +02:00
Wladimir J. van der Laan 30bc0f6726
Merge #10710: REST/RPC example update
b8bb425 REST/RPC example update (Michael Rotarius)

Tree-SHA512: 3a7003f5996f58d9881e7b7a9155f8b1c233faea2977cd02c481567b60fa47105433184da3d887ef3ec28775ad33719b779bff2753d64b775b29d8a7a6214fda
2017-07-06 18:17:51 +02:00
Wladimir J. van der Laan 191d12b073
qt: First translations update for 0.15 2017-07-06 09:43:05 +02:00
Matt Corallo 73c942ecd3 Use "replaceable" instead of "rbfoptin" in bitcoin-tx.
To be consistent with RPC naming
2017-07-05 18:11:22 -04:00
Matt Corallo fb915d5b18 Use "replaceable" instead of "optIntoRbf" in fundrawtransaction.
To be consistent with other RPCs
2017-07-05 18:11:22 -04:00
Matt Corallo 928c6811f2 Use "replaceable" instead of "optintorbf" in createrawtransaction.
To be consistent with other places (and add the missing named
args entry for it).
2017-07-05 18:11:19 -04:00
John Newbery 58e9864083 [rpc] fix verbose argument for getblock in bitcoin-cli 2017-07-05 12:09:58 +01:00
darksh1ne 9bbf60047e Use method name from __func__ macro
Use __func__ macro in std::runtime_exception to:
1. fix method name in CWalletTx::GetAvailableWatchOnlyCredit()
2. refactor CWalletTx::GetAvailableCredit()
2017-07-04 22:22:53 +03:00
Wladimir J. van der Laan 6dbcc74a0e
Merge #10193: scripted-diff: Remove #include <boost/foreach.hpp>
b1268a1 clang-format: Delete ForEachMacros (Jorge Timón)
5995735 scripted-diff: Remove #include <boost/foreach.hpp> (Jorge Timón)
3eff827 scripted-diff: Remove BOOST_REVERSE_FOREACH (Jorge Timón)
33aed5b Fix const_reverse_iterator constructor (pass const ptr) (Jorge Timón)
300851e Introduce src/reverse_iterator.hpp and include it... (Jorge Timón)

Tree-SHA512: df3405328e9602d0a433ac134ba59a5c9a6202ef64188df2f94a59b2ce58dec7c988b25d0671c7937de516a96b2e6daeb9d04c82fa363b616ee4cf6e9cb0fac6
2017-07-04 18:05:18 +02:00
Matt Corallo 3a19fed9db Make ValidationInterface signals-type-agnostic
(by hiding boost::signals stuff in the .cpp)

This allows us to give it a bit more intelligence as we move
forward, including routing some signals through CScheduler. While
the introduction of a "internals" pointer in the class is pretty
ugly, the fact that we no longer need to include boost/signals
directly from validationinterface.h is very much worth the loss.
2017-07-03 20:54:36 -04:00
Matt Corallo ff6a834fc3 Use TestingSetup to DRY qt rpcnestedtests 2017-07-03 20:52:25 -04:00
Jonas Schnelli 7397af9d31
Merge #10728: fix typo in help text for removeprunedfunds
ecb4fc382 fix typo in help text for removeprunedfunds (Akio Nakamura)

Tree-SHA512: 2603851f1ac90bc0b90ced6355b0056e4cb658303cb2cd03ee0827ed0053157ebb87de48076f4d4f556991bfdbdb65d0a68a8dbd275c501cee4c9b5746a9562b
2017-07-03 14:20:42 +02:00
Wladimir J. van der Laan d81bec7666
Merge #10683: rpc: Move the `generate` RPC call to rpcwallet
2a96283 rpc: Update `generate` for developer notes (Wladimir J. van der Laan)
df7e2f0 rpc: Move the `generate` RPC call to rpcwallet (Wladimir J. van der Laan)

Tree-SHA512: ec658d6178f8435dc54b9d9c6dd59f873055a8ae0c3f177c02049d77b93107dd5fc17a1ff56d50f051810d52fdf306846eaba2ef4fc8d2a6cfa831f57a1045c4
2017-07-03 13:59:50 +02:00
Akio Nakamura ecb4fc382b fix typo in help text for removeprunedfunds 2017-07-03 16:29:13 +09:00
practicalswift 959dd8781e Avoid printing incorrect block indexing time due to uninitialized variable
Fixes:

init.cpp: In function ‘bool AppInitMain(boost::thread_group&, CScheduler&)’:
init.cpp:1499:56: warning: ‘nStart’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart);
                                                        ^
2017-07-02 22:00:27 +02:00
Gregory Sanders f2f1d0a83e document script-based return fields for validateaddress 2017-06-30 08:43:23 -04:00
Michael Rotarius b8bb4257fe REST/RPC example update 2017-06-30 13:21:08 +02:00
Wladimir J. van der Laan 2935b469ae
Merge #10192: Cache full script execution results in addition to signatures
e3f9c05 Add CheckInputs() unit tests (Suhas Daftuar)
a3543af Better document CheckInputs parameter meanings (Matt Corallo)
309ee1a Update -maxsigcachesize doc clarify init logprints for it (Matt Corallo)
b014668 Add CheckInputs wrapper CCoinsViewMemPool -> non-consensus-critical (Matt Corallo)
eada04e Do not print soft-fork-script warning with -promiscuousmempool (Matt Corallo)
b5fea8d Cache full script execution results in addition to signatures (Matt Corallo)
6d22b2b Pull script verify flags calculation out of ConnectBlock (Matt Corallo)

Tree-SHA512: 0c6c3c79c64fcb21e17ab60290c5c96d4fac11624c49f841a4201eec21cb480314c52a07d1e3abd4f9c764785cc57bfd178511f495aa0469addb204e96214fe4
2017-06-29 20:19:21 +02:00
Wladimir J. van der Laan 0c3542e5de
Merge #10660: Allow to cancel the txdb upgrade via splashscreen keypress 'q'
542ce6e Report [CANCELLED] instead of [DONE] when shut down during txdb upgrade (Jonas Schnelli)
83fbea3 Report txdb upgrade not more often then every 10% (Jonas Schnelli)
06c5b6e Show txdb upgrade progress in debug log (Jonas Schnelli)
316fcb5 Allow to cancel the txdb upgrade via splashscreen callback (Jonas Schnelli)
ae09d45 Allow to shut down during txdb upgrade (Jonas Schnelli)
00cb69b [Qt] allow to execute a callback during splashscreen progress (Jonas Schnelli)

Tree-SHA512: 23190f23f441bfd60821e49f8b3698a6bef97eb0e0ee659328e4a7395769ecd1616420eacc38aa1fa0ff62b9de5f13a0098dc798cdec6bff649575cefebc0db2
2017-06-29 19:55:21 +02:00
Jonas Schnelli 542ce6e246
Report [CANCELLED] instead of [DONE] when shut down during txdb upgrade 2017-06-29 17:48:13 +02:00
Jonas Schnelli 83fbea3f25
Report txdb upgrade not more often then every 10% 2017-06-29 17:48:13 +02:00
Jonas Schnelli 06c5b6edd3
Show txdb upgrade progress in debug log 2017-06-29 17:48:12 +02:00
Jonas Schnelli 316fcb5106
Allow to cancel the txdb upgrade via splashscreen callback 2017-06-29 17:48:12 +02:00
Jonas Schnelli ae09d4583b
Allow to shut down during txdb upgrade 2017-06-29 17:48:11 +02:00
Jonas Schnelli 00cb69bc86
[Qt] allow to execute a callback during splashscreen progress 2017-06-29 17:48:08 +02:00
Wladimir J. van der Laan 4c72cc33eb
Merge #10673: [qt] Avoid potential null pointer dereference in TransactionView::exportClicked()
fd9599b [qt] Avoid potential null pointer dereference in TransactionView::exportClicked() (practicalswift)

Tree-SHA512: 33cbb65bd86aceb58918eb0a19e1727599a22285e7c89d4e7d3b2639c879dc8939708fd506006c6c092f624050d1131f997cc37f837cb980aa440f8abe5a3c18
2017-06-29 15:03:15 +02:00
Wladimir J. van der Laan 2a962834fe rpc: Update `generate` for developer notes
Fix nits by John Newbery.
2017-06-29 12:02:44 +02:00
Wladimir J. van der Laan df7e2f057b rpc: Move the `generate` RPC call to rpcwallet
This makes it possible to mine to any wallet when multi-wallet mode is added.
Solves the same problem as #10649, but IMO in a cleaner way.

It also gets rid of the circuitous `ScriptForMining` method on
`CValidationInterface`, which really doesn't belong there.

After this change it's still possible to mine without wallet through
`generatetoaddress`.
2017-06-29 12:02:43 +02:00
Pieter Wuille 90a002ea64
Merge #10558: Address nits from per-utxo change
21d4afa12 Comment clarifications in coins.cpp (Alex Morcos)
3c8a9aeff Add belt-and-suspenders in DisconnectBlock (Alex Morcos)

Tree-SHA512: d83e12ed71674faaaaebc03ffa1e2276984c35a29db419268ac9e14a45b33ccab716e3606dff8cfe1dcee4bec6e4794d2ca90341f10d5684be80e3fee61addf8
2017-06-28 11:44:22 -07:00
Pieter Wuille 30c21306c1
Merge #10685: Clarify CCoinsViewMemPool documentation.
381b8fc36 Clarify CCoinsViewMemPool documentation. (Matt Corallo)

Tree-SHA512: 0d1520595a03ea4038b4119871d79dfc28a50f42ac7667b30a583805d4fe4b0480a6912b9b4f7660c7223778ef85f2f9d1870551383a35c5e8c88cd2935f59d3
2017-06-28 11:22:00 -07:00
Wladimir J. van der Laan d4e551adfe
Merge #10148: Use non-atomic flushing with block replay
176c021 [qa] Test non-atomic chainstate writes (Suhas Daftuar)
d6af06d Dont create pcoinsTip until after ReplayBlocks. (Matt Corallo)
eaca1b7 Random db flush crash simulator (Pieter Wuille)
0580ee0 Adapt memory usage estimation for flushing (Pieter Wuille)
013a56a Non-atomic flushing using the blockchain as replay journal (Pieter Wuille)
b3a279c [MOVEONLY] Move LastCommonAncestor to chain (Pieter Wuille)

Tree-SHA512: 47ccc62303f9075c44d2a914be75bd6969ff881a857a2ff1227f05ec7def6f4c71c46680c5a28cb150c814999526797dc05cf2701fde1369c06169f46eccddee
2017-06-28 18:26:41 +02:00
Wladimir J. van der Laan 9a941a1010
Merge #10631: Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class
aa95947 Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class (practicalswift)

Tree-SHA512: 3835e9b4ceaa4b2db485a25dfa3e5fe50c2e3ecb22ca9d5331aed7728aa496d4378fb84c0a1a3c47b0adecc10a00bca99cc239cbaf94cf2ce5b4cda497db6023
2017-06-28 15:05:23 +02:00
practicalswift aa95947ded Use the override specifier (C++11) where we expect to be overriding the virtual function of a base class 2017-06-28 02:12:06 +02:00
Alex Morcos 21d4afa12f Comment clarifications in coins.cpp 2017-06-27 16:08:06 -04:00
Suhas Daftuar e3f9c05b96 Add CheckInputs() unit tests
Check that cached script execution results are only valid for the same
script flags; that script execution checks are returned for non-cached
transactions; and that cached results are only valid for transactions
with the same witness hash.
2017-06-27 16:05:04 -04:00
Alex Morcos 3c8a9aefff Add belt-and-suspenders in DisconnectBlock
These extra variables were previously checked before the move to per-txout database.
2017-06-27 15:04:56 -04:00
Matt Corallo 381b8fc365 Clarify CCoinsViewMemPool documentation.
Thanks to @sdaftuar for correcting my misunderstanding.
2017-06-27 14:47:07 -04:00
Alex Morcos 18bacec6c2 Make check to distinguish between orphan txs and old txs more efficient.
Checking for the existence in the CCoinsViewCache of the outputs of a new tx
will result in a disk hit for every output since they will not be found.  On the
other hand if those outputs exist already, then the inputs must also have been
missing, so we can move this check inside the input existence check so in the
common case of a new tx it doesn't need to run.

The purpose of the check is to avoid spamming the orphanMap with slightly old
txs which we have already seen in a block, but it is already only optimistic
(depending on the outputs not being spent), so make it even more efficient by
only checking the cache and not the entire pcoinsTip.
2017-06-27 14:14:15 -04:00
Alex Morcos 22378adbe5 Remove no longer used mempool.exists(outpoint) 2017-06-27 14:10:03 -04:00
Wladimir J. van der Laan ac52492cd2
Merge #10118: Util: Remove redundant calls to argsGlobal.IsArgSet()
ed866ab Indentation after 'Remove redundant calls to gArgs.IsArgSet()' (Jorge Timón)
506b700 Util: Remove redundant calls to gArgs.IsArgSet() (Jorge Timón)

Tree-SHA512: 4f97a0bf2a76c0f351a6343db62898cf057d745c848de00fa09465e870a120f28e0d836cafd6a047f4ec0da7ab671aebee43fa7410c9f0e66382edd1bb2009ba
2017-06-27 16:29:11 +02:00
practicalswift fd9599b135 [qt] Avoid potential null pointer dereference in TransactionView::exportClicked() 2017-06-27 15:06:39 +02:00
Wladimir J. van der Laan 1680ee0edf
Merge #10400: [RPC] Add an uptime command that displays the amount of time (in seconds) bitcoind has been running
c074752 [RPC] Add an uptime command that displays the amount of time that bitcoind has been running (Ricardo Velhote)

Tree-SHA512: 8f59d4205042885f23f5b87a0eae0f5d386e9c6134e5324598e7ee304728d4275f383cd154bf1fb25350f5a88cc0ed9f97edb099e9b50c4a0ba72d63ec5ca5b4
2017-06-27 11:34:15 +02:00
Jorge Timón ed866ab923
Indentation after 'Remove redundant calls to gArgs.IsArgSet()' 2017-06-27 07:39:52 +02:00
Jorge Timón 506b700dcb
Util: Remove redundant calls to gArgs.IsArgSet()
Return empty std::vector<std::string> with ArgsManager::GetArgs if
nothing is set for that string
2017-06-27 02:54:19 +02:00
Pieter Wuille 21180ff734 Simplify return values of GetCoin/HaveCoin(InCache)
This removes the possibility for GetCoin/HaveCoin/HaveCoinInCache to return
true while the respective coin is spent. By doing it across all calls, some
extra checks can be eliminated.

coins_tests is modified to call HaveCoin sometimes before and sometimes
after AccessCoin. A further change is needed because the semantics for
GetCoin slightly changed, causing a pruned entry in the parent cache to not
be pulled into the child in FetchCoin.
2017-06-26 16:16:26 -07:00
Suhas Daftuar 176c021d08 [qa] Test non-atomic chainstate writes
Adds new functional test, dbcrash.py, which uses -dbcrashratio to exercise the
logic for recovering from a crash during chainstate flush.

dbcrash.py is added to the extended tests, as it may take ~10 minutes to run

Use _Exit() instead of exit() for crash simulation

This eliminates stderr output such as:
    terminate called without an active exception
or
    Assertion failed: (!pthread_mutex_destroy(&m)), function ~recursive_mutex, file /usr/local/include/boost/thread/pthread/recursive_mutex.hpp, line 104.

Eliminating the stderr output on crash simulation allows testing with
test_runner.py, which reports a test as failed if stderr is produced.
2017-06-26 14:48:42 -07:00
Matt Corallo d6af06d68a Dont create pcoinsTip until after ReplayBlocks.
This requires that we not access pcoinsTip in InitBlockIndex's
FlushStateToDisk (so we just skip it until later in AppInitMain)
and the LoadChainTip in LoadBlockIndex (which there is already one
later in AppinitMain, after ReplayBlocks, so skipping it there is
fine).

Includes some simplifications by Suhas Daftuar and Pieter Wuille.
2017-06-26 10:46:51 -07:00
Pieter Wuille eaca1b7b08 Random db flush crash simulator 2017-06-26 10:46:51 -07:00
Pieter Wuille 0580ee08ff Adapt memory usage estimation for flushing 2017-06-26 10:45:48 -07:00
Pieter Wuille 013a56aa1a Non-atomic flushing using the blockchain as replay journal 2017-06-26 10:45:48 -07:00
Pieter Wuille b3a279cd58 [MOVEONLY] Move LastCommonAncestor to chain 2017-06-26 10:45:48 -07:00
Wladimir J. van der Laan 234ffc677e
Merge #10559: Change semantics of HaveCoinInCache to match HaveCoin
5257698 Change semantics of HaveCoinInCache to match HaveCoin (Alex Morcos)

Tree-SHA512: 397e9ba28646b81fffa53e55064735d4d242aaffdf8484506825f785b0e414f334e4c5cd1e4e1dd9a4b6d1f6954c7ecad15429934a1c4e8d39f596cbd9f5dd80
2017-06-26 17:11:15 +02:00
Wladimir J. van der Laan 22a0aca329
Merge #10496: Add Binds, WhiteBinds, Whitelistedrange to CConnman::Options
07b2afe add Binds, WhiteBinds to CConnman::Options (Marko Bencun)
ce79f32 add WhitelistedRange to CConnman::Options (Marko Bencun)

Tree-SHA512: c23a6f317c955338af531fa3e53e3c42e995f88c6e1939bbc2ad119fa5b786c54b3dad3d2e9b3f830b7292c0c63a02fcff66a89907d0fa8d7c83aefade01af45
2017-06-26 15:04:54 +02:00
Wladimir J. van der Laan f3f1e2e7d3
Merge #9544: [trivial] Add end of namespace comments. Improve consistency.
5a9b508 [trivial] Add end of namespace comments (practicalswift)

Tree-SHA512: 92b0fcae4d1d3f4da9e97569ae84ef2d6e09625a5815cd0e5f0eb6dd2ecba9852fa85c184c5ae9de5117050330ce995e9867b451fa8cd5512169025990541a2b
2017-06-26 13:40:26 +02:00
Ricardo Velhote c07475294a
[RPC] Add an uptime command that displays the amount of time that bitcoind has been running 2017-06-25 20:25:45 +01:00
Wladimir J. van der Laan d609fd85ca
Merge #9176: Globals: Pass Consensus::Params through CBlockTreeDB::LoadBlockIndexGuts()
b324b28 Globals: Pass Consensus::Params through CBlockTreeDB::LoadBlockIndexGuts() (Jorge Timón)

Tree-SHA512: 9ef561a026960dc69df52603f4d60246c913bdd127465e8238f0954c6bbbc6b8b3b039bab70df38be1cbf5d06788fb631a2236b49c0167633d54366103c7c055
2017-06-25 10:26:01 +02:00
Wladimir J. van der Laan bef02fb6ac
Merge #10412: Improve wallet rescan API
deaf48b Handle TIMESTAMP_WINDOW within CWallet::RescanFromTime (Russell Yanofsky)
5b2be2b Make CWallet::RescanFromTime comment less ambiguous (Russell Yanofsky)
9bb66ab Add RescanFromTime method and use from rpcdump (Russell Yanofsky)
ccf84bb Move birthday optimization out of ScanForWalletTransactions (Russell Yanofsky)

Tree-SHA512: cd38433b8f5c5e44ecfba830a6a26bd9a9d0f4a22ae42bce17773d1a6fb25e1ee4289484996dad2d7acfa03059917ff062459f25030a761da7083ba5fbc87bc9
2017-06-24 16:37:42 +02:00
Wladimir J. van der Laan eee398fa12
Merge #10608: Add a comment explaining the use of MAX_BLOCK_BASE_SIZE.
1887337 Add a comment explaining the use of MAX_BLOCK_BASE_SIZE. (Gregory Maxwell)

Tree-SHA512: 4c643a3696241fbf4eac8d58bb26586f319338b28ee86d20394a8ea362911b467853eb40c43487ede753209a3c7bee2e576d2ca80627e9fc924fabefbcaea34b
2017-06-24 15:45:14 +02:00
Wladimir J. van der Laan b62b4c873e
Merge #10627: fixed listunspent rpc convert parameter
e503b2b fixed listunspent rpc convert parameter (tnaka)

Tree-SHA512: 6da1cee8fd8459187825fad47678b36bbf6b4582f03f557c8a48c2c4273d9e12405e8bb6ade02a06e6555419eefb1dc298d4d4781ebb3b6b72743ca6108cb18e
2017-06-24 15:39:43 +02:00
Wladimir J. van der Laan 00350bd6db
Merge #10191: [trivial] Rename unused RPC arguments 'dummy'
0ef7de9 [RPCs] Remove submitblock parameters argument help text (John Newbery)

Tree-SHA512: f39ad4bb3006e3d722fa51ae2ab4a48726e740993d6bed5737b355d1e0a99cf475ca9519f97adf8cde1b7187b14a24d5951ce4f34624d01d9ef84b49124c2894
2017-06-24 15:15:18 +02:00
Wladimir J. van der Laan 2772dc9f21
Merge #10446: net: avoid extra dns query per seed
c1be285 chainparams: make supported service bits option explicit (Cory Fields)
d5c7c1c net: use an internal address for fixed seeds (Cory Fields)
6cdc488 net: switch to dummy internal ip for dns seed source (Cory Fields)
6d0bd5b net: do not allow resolving to an internal address (Cory Fields)
7f31762 net: add an internal subnet for representing unresolved hostnames (Cory Fields)

Tree-SHA512: 9bf1042bef546ac3ef0e0d3a9a5555eb21628ff2674a0cf8c6367194b22bfdab477adf452c0e7c56f44e0fb37debc5e14bdb623452e076fb9c492c7702601d7a
2017-06-24 12:25:13 +02:00
Wladimir J. van der Laan 232508fe0f
Merge #10577: Add an explanation of quickly hashing onto a non-power of two range.
dd869c6 Add an explanation of quickly hashing onto a non-power of two range. (Gregory Maxwell)

Tree-SHA512: 8b362e396206a4ee2e825908dcff6fe4525c12b9c85a6e6ed809d75f03d42edcfba5e460a002e5d17cc70c103792f84d99693563b638057e4e97946dd1d800b2
2017-06-24 11:28:04 +02:00
MarcoFalke e0a7801223
Merge #10662: Initialize randomness in benchmarks
5155d11 Initialize randomness in benchmarks (Andrew Chow)

Tree-SHA512: 235006eb161893e1a84d5b2747cbaf7c82ced179ab2b9df30197b4cb2d3c4f31e47fa5b9cf62aced0fe244da47f3a38fbbe91fe86b0a90f1d86604da5d806fb1
2017-06-24 10:19:44 +02:00
Wladimir J. van der Laan 8c841a31a9
Merge #10626: doc: Remove outdated minrelaytxfee comment
fab9b60 doc: Remove outdated minrelaytxfee comment (MarcoFalke)

Tree-SHA512: e36c5a554a9773f034c2d358c52a772688009a5a71dfd3f664d9b5566c98378f44ef7c6dc0902b42d69ab5fd54b60d4850a2903823d0b2309c7ae063d1923f7f
2017-06-24 10:16:32 +02:00
Andrew Chow 5155d1101e Initialize randomness in benchmarks
Call RandomInit() in bench_bitcoin to initialize the RNG so that it
does not cause an assertion error.
2017-06-23 14:21:10 -07:00
Russell Yanofsky deaf48b046 Handle TIMESTAMP_WINDOW within CWallet::RescanFromTime
This way CWallet::RescanFromTime callers don't need to subtract
TIMESTAMP_WINDOW themselves.

This is pure refactoring, there is no change in behavior.
2017-06-22 17:16:24 -04:00
Russell Yanofsky 5b2be2b787 Make CWallet::RescanFromTime comment less ambiguous 2017-06-22 17:14:40 -04:00
Cory Fields c1be285364 chainparams: make supported service bits option explicit 2017-06-22 15:21:22 -04:00
Cory Fields d5c7c1cfe3 net: use an internal address for fixed seeds 2017-06-22 15:21:22 -04:00
Wladimir J. van der Laan 8c2098ad12
Merge #10565: [coverage] Remove subtrees and benchmarks from coverage report
d5711f4 Filter subtrees and and benchmarks from coverage report (Andrew Chow)
405b86a Replace lcov -r commands with faster way (Andrew Chow)
c8914b9 Have `make cov` optionally include branch coverage statistics (Andrew Chow)

Tree-SHA512: 9c349a7baeb7430ea586617c52f91177df58e3546d6dc573e26815ddb79e30ab1873542d85ac1daca5e1fb2c6d6c8965824b42d027b6b0496a744af57b095852
2017-06-22 20:57:11 +02:00
Wladimir J. van der Laan 6bef7ca8bc
Merge #10633: doc: Fix various typos
0a5a6b9 Fixed multiple typos (Dimitris Tsapakidis)

Tree-SHA512: 57748710bcbc03945b160db5e95bd686a2c64605f25d5e11d8ed9d0e1be3b3bf287a63588dc6eb33d0cef4ff17c765fda7c226d667a357acc539c8fcf2b9bb7e
2017-06-22 20:46:37 +02:00
Wladimir J. van der Laan 01c4b143a8
Merge #10248: Rewrite addrdb with less duplication using CHashVerifier
cf68a48 Deduplicate addrdb.cpp and use CHashWriter/Verifier (Pieter Wuille)

Tree-SHA512: 0301332e797f64da3a1588c9ebaf533af58da41e38f8a64206bff20102c5e82c2a7c630ca3150cf451b2ccf4acb3dd45e44259b6ba15e92786e9e9a2b225bd2f
2017-06-22 19:54:22 +02:00
Wladimir J. van der Laan ffce893982
Merge #9517: [refactor] Switched httpserver.cpp to use RAII wrapped libevents.
1ae86ec Changed event RAII helper functions to inline to deal with duplicate symbol linker errors. (Karl-Johan Alm)
fd369d2 Switched httpserver.cpp to use RAII wrapped libevents. (Kalle Alm)

Tree-SHA512: 877e431f211024d42a3b0800e860e02833398611433e8393f8d5d4970f47f4bd670b900443678c067fec110c087aaab7dc1981ccbf17f6057676fdbbda89aed9
2017-06-22 19:16:37 +02:00
Wladimir J. van der Laan 209eef60a9
Merge #9343: Don't create change at dust limit
6171826 Don't create change at the dust limit, even if it means paying more than expected (Alex Morcos)

Tree-SHA512: d4cf939b97a92d63d4703ad152093c9dc60e74af590697bc21adbcdf17fc9e6ffb37d46d5eefafbd69327d1bcb79911f1b826ce1d960d895d464c4408c4995c3
2017-06-22 18:23:11 +02:00
Matt Corallo a3543af3cc Better document CheckInputs parameter meanings 2017-06-22 12:21:09 -04:00
Matt Corallo 309ee1ae7b Update -maxsigcachesize doc clarify init logprints for it 2017-06-22 12:21:09 -04:00
Matt Corallo b014668e27 Add CheckInputs wrapper CCoinsViewMemPool -> non-consensus-critical
This wraps CheckInputs in ATMP's cache-inputs call to check that
each scriptPubKey the CCoinsViewCache provides is the one which
was committed to by the input's transaction hash.
2017-06-22 12:21:09 -04:00
Dimitris Tsapakidis 0a5a6b90bc Fixed multiple typos
A few "a->an" and "an->a".
"Shows, if the supplied default SOCKS5 proxy" -> "Shows if the supplied default SOCKS5 proxy". Change made on 3 occurrences.
"without fully understanding the ramification of a command" -> "without fully understanding the ramifications of a command".
Removed duplicate words such as "the the".
2017-06-22 19:18:10 +03:00
Wladimir J. van der Laan 87e69c2549
Merge #10530: Fix invalid instantiation and possibly unsafe accesses of array in class base_uint<BITS>
e5c6168 Fix instantiation and array accesses in class base_uint<BITS> (Pavlos Antoniou)

Tree-SHA512: e4d39510d776c5ae8814cd5fb5c5d183cd8da937e339bff95caff68a84492fbec68bf513c5a6267446a564d39093e0c7fc703c645b511caab80f7baf7955b804
2017-06-22 17:16:44 +02:00
Jorge Timón b1268a19d0
clang-format: Delete ForEachMacros 2017-06-22 03:48:54 +02:00
Jorge Timón 5995735c5b
scripted-diff: Remove #include <boost/foreach.hpp>
-BEGIN VERIFY SCRIPT-
sed -i ':a;N;$!ba;s/#include <boost\/foreach.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp
-END VERIFY SCRIPT-
2017-06-22 03:48:52 +02:00
Jorge Timón 3eff827f89
scripted-diff: Remove BOOST_REVERSE_FOREACH
-BEGIN VERIFY SCRIPT-
sed -i 's/BOOST_REVERSE_FOREACH(\(.*\), \(.*\))/for (\1 : reverse_iterate(\2))/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ;
-END VERIFY SCRIPT-
2017-06-22 03:48:50 +02:00
Jorge Timón 33aed5bf89
Fix const_reverse_iterator constructor (pass const ptr) 2017-06-22 03:48:49 +02:00
Jorge Timón 300851ec16
Introduce src/reverse_iterator.hpp and include it...
...where it will be needed

Taken from https://gist.github.com/arvidsson/7231973 with small
modifications to fit the bitcoin core project
2017-06-22 03:48:42 +02:00
practicalswift 700d8d85bd Remove obsolete _MSC_VER check
* MSVC++ 8.0 _MSC_VER == 1400 (Visual Studio 2005)
* C++11 is supported since MSVC 2010
* Compiling without C++11 support is no longer possible
2017-06-21 14:28:26 +02:00
Pieter Wuille b3eb0d6485
Merge #10537: Few Minor per-utxo assert-semantics re-adds and tweak
9417d7a33 Be much more agressive in AccessCoin docs. (Matt Corallo)
f58349ca8 Restore some assert semantics in sigop cost calculations (Matt Corallo)
3533fb4d3 Return a bool in SpendCoin to restore pre-per-utxo assert semantics (Matt Corallo)
ec1271f2b Remove useless mapNextTx lookup in CTxMemPool::TrimToSize. (Matt Corallo)

Tree-SHA512: 158a4bce063eac93e1d50709500a10a7cb1fb3271f10ed445d701852fce713e2bf0da3456088e530ab005f194ef4a2adf0c7cb23226b160cecb37a79561f29ca
2017-06-20 18:27:45 -07:00
Pieter Wuille efbcf2b1d5
Merge #10503: Use REJECT_DUPLICATE for already known and conflicted txn
d9bec888f Use REJECT_DUPLICATE for already known and conflicted txn (Pieter Wuille)

Tree-SHA512: adc6dc5caed731c3fd5c8784e8820a074e320360cdb5579c5b9299f9799dd99de60b7382d336ab1909dab8b23e744456d78aa0c3b1c8dd1af3d1b779314cf8fa
2017-06-20 18:00:21 -07:00
Pieter Wuille b33ca14f59
Merge #9549: [net] Avoid possibility of NULL pointer dereference in MarkBlockAsInFlight(...)
95543d874 [net] Avoid possibility of NULL pointer dereference in MarkBlockAsInFlight(...) (practicalswift)

Tree-SHA512: 80fd4f2712f20377185bd8d319255f2c54ae47b54c706f7e0d384a0a6ade1465ceb6e2a4a7f7b51987a659524474a954eddf228865ebb3fc513948b5b6d7ab6d
2017-06-20 17:02:40 -07:00
Pieter Wuille d636f3943d
Merge #10536: Remove unreachable or otherwise redundant code
4265bf351 Remove unreachable or otherwise redundant code (practicalswift)

Tree-SHA512: bc9666ab5d20c936d78c50c0361405aca9edd116602aa9bcd71a79a904b647ac9eca0651d1a9d530189a6ac1c4e235bfc69ec1a68f7e36cc14d6848ac2206b7b
2017-06-20 16:16:38 -07:00
tnaka e503b2b680 fixed listunspent rpc convert parameter 2017-06-19 11:48:57 +09:00
MarcoFalke fab9b60fbd doc: Remove outdated minrelaytxfee comment 2017-06-18 21:33:44 +02:00
MarcoFalke e053e05c13
Merge #10592: [trivial] fix indentation for ArgsManager class
7810993 [trivial] fix indentation for ArgsManager class (John Newbery)

Tree-SHA512: 3d24fa94ba49ad73383ca8077776492bd75f1c2158c835c1d55b4be4787f107c2de5336173e083a5585df21ef053614628fe4fe6ddf2c05df567177445661b7b
2017-06-18 14:07:51 +02:00
Pieter Wuille cafe24f039
Merge #10614: random: fix crash on some 64bit platforms
9af207c81 random: fix crash on some 64bit platforms (Cory Fields)

Tree-SHA512: c9516b69bec224c7e650dfc7c50f04cdd93a1006d515699bc64a311a03662d4ad33a834861194a1649ed212b37fb50aadfb004954cdf8b9bc1dc82f3ea962897
2017-06-16 17:37:49 -07:00
Pieter Wuille de8db47b7f
Merge #10587: Net: Fix resource leak in ReadBinaryFile(...)
f2fb132cb Net: Fix resource leak in ReadBinaryFile(...) (practicalswift)

Tree-SHA512: 879b9334d8bb681fa4b6f96d8ecb54e2a8948065f7be5fe7880131479c813602fc9d4a4314f043e6591e1aed50ffafa7c247362a9cdeb049b0721170e227b89a
2017-06-16 16:36:42 -07:00
Pieter Wuille d76e84a214
Merge #10602: Make clang-format use C++11 features (e.g. A<A<int>> instead of A<A<int> >)
131a8ceb7 Make clang-format use C++11 features (e.g. A<A<int>> instead of A<A<int> >) (practicalswift)

Tree-SHA512: e3c0ee683b654eae638deb41c52cf3187fa958dc5fa67778eaf8a83946b63f5b1d24c47bb965eaa910e3fcdcaf9eebf461eb3fc8e3a73ebaf03c7904521fda00
2017-06-16 15:03:00 -07:00
Cory Fields 9af207c810 random: fix crash on some 64bit platforms
rbx needs to be stashed in a 64bit register on 64bit platforms. With this crash
in particular, it was holding a stack canary which was not properly restored
after the cpuid.

Split out the x86+PIC case so that x86_64 doesn't have to worry about it.
2017-06-16 15:19:15 -04:00
Gregory Maxwell 18873373bd Add a comment explaining the use of MAX_BLOCK_BASE_SIZE. 2017-06-16 00:46:16 +00:00
Marko Bencun 07b2afef10 add Binds, WhiteBinds to CConnman::Options
Part of a series of changes to clean up the instantiation of connman
by decoupling the command line arguments.

We also now abort with an error when explicit binds are set with
-listen=0.
2017-06-15 23:07:14 +02:00
Marko Bencun ce79f32518 add WhitelistedRange to CConnman::Options
Part of a series of changes to clean up the instantiation of connman
by decoupling the command line arguments.
2017-06-15 23:06:12 +02:00
practicalswift 131a8ceb73 Make clang-format use C++11 features (e.g. A<A<int>> instead of A<A<int> >) 2017-06-15 17:31:58 +02:00
Pavel Janík cc0ed26753 Supress struct/class mismatch warnings introduced in #10284. 2017-06-15 14:43:44 +02:00
Wladimir J. van der Laan c2ab38bdd5
Merge #10284: Always log debug information for fee calculation in CreateTransaction
1bebfc8 Output Fee Estimation Calculations in CreateTransaction (Alex Morcos)

Tree-SHA512: e25a27f7acbbc3a666d5d85da2554c5aaec4c923ee2fdbcfc532c29c6fbdec3c9e0d6ae6044543ecc339e7bd81df09c8d228e0b53a2c5c2dae0f1098c9453272
2017-06-15 14:20:14 +02:00
Wladimir J. van der Laan 7c72fb99af
Merge #10582: Pass in smart fee slider value to coin control dialog
e9cd778 Pass in smart fee slider value to coin control dialog (Alex Morcos)

Tree-SHA512: 3899c3eb89b06e9cc842b33fabcce40a84fcc3a88ac2b02861f63419925312ac2a9f632567c02b0a060f5c5cd55f337e35e99b80535d1c1b8fcb7fd0c539f3c0
2017-06-15 12:52:26 +02:00
Cory Fields 6cdc488e36 net: switch to dummy internal ip for dns seed source
This addresss the TODO to avoid resolving twice.
2017-06-14 18:05:01 -04:00
Cory Fields 6d0bd5b73d net: do not allow resolving to an internal address
In order to prevent mixups, our internal range is never allowed as a resolve
result. This means that no user-provided string will ever be confused with an
internal address.
2017-06-14 18:05:01 -04:00
Cory Fields 7f31762cb6 net: add an internal subnet for representing unresolved hostnames
We currently do two resolves for dns seeds: one for the results, and one to
serve in addrman as the source for those addresses.

There's no requirement that the source hostname resolves to the stored
identifier, only that the mapping is unique. So rather than incurring the
second lookup, combine a private subnet with a hash of the hostname.

The resulting v6 ip is guaranteed not to be publicy routable, and has only a
negligible chance of colliding with a user's internal network (which would be
of no consequence anyway).
2017-06-14 18:05:00 -04:00
John Newbery 7810993335 [trivial] fix indentation for ArgsManager class 2017-06-14 17:13:00 -04:00
Alex Morcos 61718268b5 Don't create change at the dust limit, even if it means paying more than expected 2017-06-14 15:34:19 -04:00
John Newbery 0ef7de953f [RPCs] Remove submitblock parameters argument help text 2017-06-14 13:50:45 -04:00
practicalswift f2fb132cb0 Net: Fix resource leak in ReadBinaryFile(...)
Introduced in 0b6f40d4ca via PR #10408.
2017-06-14 17:35:37 +02:00
Alex Morcos e9cd7786da Pass in smart fee slider value to coin control dialog
Since cfe77ef41 the global nTxConfirmTarget wasn't being updated by the smart
fee slider and thus the coin control dialog and labels were not being updated.
2017-06-14 10:57:28 -04:00
Wladimir J. van der Laan 228c319a94
Merge #9895: Turn TryCreateDirectory() into TryCreateDirectories()
1d1ea9f Turn TryCreateDirectory() into TryCreateDirectories() (Marko Bencun)

Tree-SHA512: 49a524167bcf66e351a964c88d09cb3bcee12769a32da83410e3ba649fa4bcdbf0478d41e4d09bb55adb9b3f122e742271db6feb30bbafe2a7973542b5f10f79
2017-06-14 16:12:14 +02:00
Wladimir J. van der Laan c94b89e90d
Merge #9738: gettxoutproof() should return consistent result
6294f32 gettxoutproof() should return consistent result (John Newbery)

Tree-SHA512: 1c36f78ea07a3bdde09e9494207b4372d54bcd94ed2d56e339e78281f6693e26a93e4c3123453d5c0f6e994d0069d5a1c806786c4af71864f87ea4841611c379
2017-06-14 15:48:52 +02:00
Wladimir J. van der Laan b63be2c685
Merge #10377: Use rdrand as entropy source on supported platforms
cb24c85 Use rdrand as entropy source on supported platforms (Pieter Wuille)

Tree-SHA512: c42eaa01a14e6bc097c70b6bf8540d61854c2f76cb32be69c2a3c411a126f7b4bf4a4486e4493c4cc367cc689319abde0d4adb799d29a54fd3e81767ce0766fc
2017-06-14 15:22:15 +02:00
Pieter Wuille 1ad3d4e126
Merge #10502: scripted-diff: Remove BOOST_FOREACH, Q_FOREACH and PAIRTYPE
1238f13cf scripted-diff: Remove PAIRTYPE (Jorge Timón)
18dc3c396 scripted-diff: Remove Q_FOREACH (Jorge Timón)
7c00c2672 scripted-diff: Fully remove BOOST_FOREACH (Jorge Timón)
a5410ac5e Small preparations for Q_FOREACH, PAIRTYPE and #include <boost/foreach.hpp> removal (Jorge Timón)

Tree-SHA512: d3ab4a173366402e7dcef31608977b757d4aa07abbbad2ee1bcbcfa311e994a4552f24e5a55272cb22c2dcf89a4b0495e02e9d9aceae4b08c0bab668f20e324c
2017-06-13 18:05:58 -07:00
Pieter Wuille cb24c8539d Use rdrand as entropy source on supported platforms 2017-06-13 17:02:05 -07:00
Marko Bencun 1d1ea9f096 Turn TryCreateDirectory() into TryCreateDirectories()
Use case: TryCreateDirectory(GetDataDir() / "blocks" / "index") would
fail if the blocks directory was not explicitly created before.

The line that did so was in a weird location and could be removed as a
result.
2017-06-14 00:04:13 +02:00
Wladimir J. van der Laan a4fe07714d
Merge #10544: Update to LevelDB 1.20
3ee3d04 Add extra LevelDB source to Makefile (MarcoFalke)
2424989 leveldb: enable runtime-detected crc32 instructions (Cory Fields)
cf44e4c Squashed 'src/leveldb/' changes from a31c8aa40..196962ff0 (Pieter Wuille)

Tree-SHA512: 19ade77e3f6265507b3ab7b9aa5150d378aa0751e24ac7a61567b0f720a566cedc6c3d3336da17a3bd2b5d068ee86600d96a15228f78bd20ccf98c8fc9041a91
2017-06-13 19:48:13 +02:00
Alex Morcos 1bebfc8d3a Output Fee Estimation Calculations in CreateTransaction 2017-06-13 12:35:04 -04:00
Wladimir J. van der Laan a514ac3dcb
Merge #10534: Clarify prevector::erase and avoid swap-to-clear
e241a63 Clarify prevector::erase and avoid swap-to-clear (Pieter Wuille)

Tree-SHA512: fa7602038feb4417158df13ee7c0351673acf38f8a824e75889710344c46a9b8d5f6059faeb521f73e48b7ad3e1a238a9e433e4b44f7c3b9085ff08ef65271fa
2017-06-13 18:32:44 +02:00
Wladimir J. van der Laan 303c171b94
Merge #10553: Simplify "bool x = y ? true : false". Remove unused function and trailing semicolon.
67ca816 Simplify "bool x = y ? true : false" to "bool x = y" (practicalswift)
9f841a6 [tests] Remove accidental trailing semicolon (practicalswift)
30c2d9d [tests] Remove unused function InsecureRandBytes(size_t len) (practicalswift)

Tree-SHA512: ae62c255c88133cad12084b6011c105bb96b729c8103330350683d9c20020c5d7617693795df4dff6cc305f2405cb2e4e2ece182d6e6d7c3c8db82aa2f882c41
2017-06-13 11:55:11 +02:00
Pieter Wuille 8d9f45ea6a
Merge #10564: Return early in IsBanned.
bf376eacc Return early in IsBanned. (Gregory Maxwell)

Tree-SHA512: d8ed4aaf9a7523b00effa4ac17cec3be1ec1f5c5ce64d89833fbc8f3d73d13b022043354fbcf2682b2af05070d115e1fc0cc0b122197e9ddee5959c3fb9dd16d
2017-06-12 15:49:13 -07:00
Gregory Maxwell dd869c60ca Add an explanation of quickly hashing onto a non-power of two range.
In Olaoluwa Osuntokun's recent protocol proposal they were using a
 mod in an inner loop.  I wanted to suggest a normative protocol
 change to use the trick we use here, but to find an explanation
 of it I had to dig up the PR on github.  After I posted about it
 several other developers commented that it was very interesting
 and they were unaware of it.

I think ideally the code should be self documenting and help
 educate other contributors about non-obvious techniques that
 we use.  So I've written a description of the technique with
 citations for future reference.
2017-06-12 22:44:55 +00:00
Pieter Wuille c98ebf1bfb
Merge #10568: Remove unnecessary forward class declarations in header files
4087d9ea7 Remove unnecessary forward class declarations in header files (practicalswift)

Tree-SHA512: 80a9b2cd339ba9c606c0dd93739ac80941b6050388fee2edd7976ae8b5e332fd0b4f1df1e89c1d6d28a77c23a36b1e874e72977985fb8f710c65c45c3a926f97
2017-06-12 15:17:51 -07:00
Alex Morcos 8e69adc665 Add missing include for atomic in db.h 2017-06-12 14:39:48 -04:00
practicalswift 4087d9ea7c Remove unnecessary forward class declarations in header files 2017-06-12 20:37:43 +02:00
Wladimir J. van der Laan b7296bcea0
Merge #10550: Don't return stale data from CCoinsViewCache::Cursor()
3ff1fa8 Use override keyword on CCoinsView overrides (Russell Yanofsky)
24e44c3 Don't return stale data from CCoinsViewCache::Cursor() (Russell Yanofsky)

Tree-SHA512: 08699dae0925ffb9c018f02612ac6b7eaf73ec331e2f4f934f1fe25a2ce120735fa38596926e924897c203f7470e99f0a99cf70d2ce31ff428b105e16583a861
2017-06-12 16:29:59 +02:00
practicalswift 4265bf351a Remove unreachable or otherwise redundant code 2017-06-12 15:01:46 +02:00
Wladimir J. van der Laan 177433ad22
Merge #8694: Basic multiwallet support
c237bd7 wallet: Update formatting (Luke Dashjr)
9cbe8c8 wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets (Luke Dashjr)
a2a5f3f wallet: Base backup filenames on original wallet filename (Luke Dashjr)
b823a4c wallet: Include actual backup filename in recovery warning message (Luke Dashjr)
84dcb45 Bugfix: wallet: Fix warningStr, errorStr argument order (Luke Dashjr)
008c360 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets (Luke Dashjr)
0f08575 Wallet: Support loading multiple wallets if -wallet used more than once (Luke Dashjr)
b124cf0 Wallet: Replace pwalletMain with a vector of wallet pointers (Luke Dashjr)
19b3648 CWalletDB: Store the update counter per wallet (Luke Dashjr)
74e8738 Bugfix: ForceSetArg should replace entr(ies) in mapMultiArgs, not append (Luke Dashjr)
23fb9ad wallet: Move nAccountingEntryNumber from static/global to CWallet (Luke Dashjr)
9d15d55 Bugfix: wallet: Increment "update counter" when modifying account stuff (Luke Dashjr)
f28eb80 Bugfix: wallet: Increment "update counter" only after actually making the applicable db changes to avoid potential races (Luke Dashjr)

Tree-SHA512: 23f5dda58477307bc07997010740f1dc729164cdddefd2f9a2c9c7a877111eb1516d3e2ad4f9b104621f0b7f17369c69fcef13d28b85cb6c01d35f09a8845f23
2017-06-12 13:27:17 +02:00
Wladimir J. van der Laan fa1f106218
Merge #10488: Note that the prioritizetransaction dummy value is deprecated, and has no meaning
40796e1 Remove references to priority that snuck back in in 870824e9. (Matt Corallo)

Tree-SHA512: fd6f772a9fdf14b3b125e84a79059d7ab34b3571b35dc48f8d4b9f22ea71c6cdd4ae88c2e135ae317a16744c28dd23cf7f7dd88ea9d8b2d408e57845ef87d03b
2017-06-12 13:00:39 +02:00
practicalswift 67ca816849 Simplify "bool x = y ? true : false" to "bool x = y" 2017-06-11 15:44:01 +02:00
Wladimir J. van der Laan 2c2d988062
Merge #10546: Remove 33 unused Boost includes
49de096 Remove unused Boost includes (practicalswift)

Tree-SHA512: ff2dad94f9eeb1dc50fcffd0e94e1686be04e4e5bc45f58ae955d630c15cd25bb8f5583d0aa1f2f263b5a723be79747ef3c6e6b417c7be7787c0abc8d1874019
2017-06-11 15:37:15 +02:00
Wladimir J. van der Laan e4918316d8
Merge #10561: Remove duplicate includes
e53a0fa Remove duplicate includes (practicalswift)

Tree-SHA512: 5101afaf190ade3ffbea666ff5d0cb59d3e1dbdd9a3db3d91df7b51c13cc9f5a699438e8a753655365f6dc14529bc95883e715b5a6ab73158374e13ec311f70b
2017-06-11 14:32:30 +02:00
Wladimir J. van der Laan 562caf1c74
Merge #10560: Remove unused constants
dce8239 Comment out unused constant REJECT_DUST (practicalswift)
3289ef4 Remove unused constant MEMPOOL_GD_VERSION (practicalswift)

Tree-SHA512: 8dd772c963037cd0a1db0d5bf5f7a5cce3f5cd8fb6fa983949f9f0c1c8312ffd251a62c1e5d32f3584d2bcc562d8c8a9bf7900609dee9a4f12898caa2be9c38f
2017-06-11 14:22:40 +02:00
MarcoFalke 3ee3d04374 Add extra LevelDB source to Makefile 2017-06-09 19:25:36 -07:00
Cory Fields 2424989e4f leveldb: enable runtime-detected crc32 instructions 2017-06-09 19:25:36 -07:00
Pieter Wuille e4030ab4f4 Update to LevelDB 1.20 2017-06-09 19:24:30 -07:00
Andrew Chow c45cbaf69f Fix stopatheight
Moves stopatheight check into the ActivateBestChain loop so that the block height is actually checked and stopped at the appropriate time.
2017-06-09 13:40:45 -07:00
Pieter Wuille e241a63c23 Clarify prevector::erase and avoid swap-to-clear 2017-06-09 13:23:20 -07:00
Pieter Wuille 76f268b9bd
Merge #10521: Limit variable scope
90593ed92 Limit variable scope (practicalswift)

Tree-SHA512: 4719e303688a31aefbe1d239e86b21dd3c2045524e08bd628c6ba0c6c2a97de14d04305b9beafe0b1dcde7229793e6663168953f192e88ed409be5c30fd2a9a9
2017-06-09 13:09:24 -07:00
Matt Corallo 9417d7a336 Be much more agressive in AccessCoin docs.
While the current implementation is pretty free, there is a lot
of possibility for this to blow up in our face with future changes,
especially as the backing map gets tweaked.
2017-06-09 13:10:08 -04:00
Matt Corallo f58349ca85 Restore some assert semantics in sigop cost calculations
There are some similar asserts which are left removed in policy
and ATMP (policy code being broken isn't a huge deal, but if we
fail to verify some consensus rules, we should most definitely
crash).
2017-06-09 13:10:08 -04:00
Matt Corallo 3533fb4d33 Return a bool in SpendCoin to restore pre-per-utxo assert semantics
Since its free to do so, assert that Spends succeeded when we expect
them to.
2017-06-09 13:10:05 -04:00
practicalswift e53a0fa12a Remove duplicate includes 2017-06-09 15:39:37 +02:00
practicalswift dce82397c1 Comment out unused constant REJECT_DUST 2017-06-09 15:21:28 +02:00
practicalswift 49de096c2a Remove unused Boost includes 2017-06-09 10:25:26 +02:00
Gregory Maxwell bf376eaccc Return early in IsBanned.
I am not aware of any reason that we'd try to stop a ban-list timing
 side-channel and the prior code wouldn't be enough if we were.
2017-06-09 02:05:53 +00:00
practicalswift 3289ef4fe1 Remove unused constant MEMPOOL_GD_VERSION 2017-06-09 01:45:36 +02:00
Alex Morcos 525769853e Change semantics of HaveCoinInCache to match HaveCoin
Previously it was possible for HaveCoinInCache to return true for a spent
coin. It is more clear to keep the semantics the same. HaveCoinInCache is
used for two reasons:
- tracking coins we may want to uncache, in which case it is unlikely there
would be spent coins we could uncache (not dirty)
- optimistically checking whether we have already included a tx in the
blockchain, in which case a spent coin is not a reliable indicator that we have.
2017-06-08 16:56:50 -04:00
Wladimir J. van der Laan 29f80cd230
Merge #10545: Use list initialization (C++11) for maps/vectors instead of boost::assign::map_list_of/list_of
3fb81a8 Use list initialization (C++11) for maps/vectors instead of boost::assign::map_list_of/list_of (practicalswift)

Tree-SHA512: 63a9ac9ec5799472943dce1cd92a4b14e7f1fe12758a5fc4b1efceaf2c85a4ba71dad5ccc50813527f18b192e7714c076e2478ecd6ca0d452b24e88416f872f7
2017-06-08 20:26:40 +02:00
Russell Yanofsky 3ff1fa8c4a Use override keyword on CCoinsView overrides 2017-06-08 09:28:28 -04:00
Wladimir J. van der Laan 9c248e39f2
Merge #10481: Decodehextx scripts sanity check
ac4e438 Sanity check transaction scripts in DecodeHexTx (Andrew Chow)
5b75c47 Add a valid opcode sanity check to CScript (Andrew Chow)

Tree-SHA512: a516e95c274c9d131123150c798cae8bed75925e8a4d59469967dd7f1d49f7f8161e26afb61024b821bd8dcdffdfd0d19b8dcad20b39b1106820326d8d56904d
2017-06-08 13:36:48 +02:00
Wladimir J. van der Laan 35e7f13f68
Merge #10548: Use std::unordered_{map,set} (C++11) instead of boost::unordered_{map,set}
246a02f Use std::unordered_{map,set} (C++11) instead of boost::unordered_{map,set} (practicalswift)

Tree-SHA512: 35cd42012248174751e4b87efbc78689957f731d7710dea7e369974c6ec31b15b32d1537fb0d875c94c7ffb5046d9784735e218e5baeed96d525861dab6d4252
2017-06-08 12:45:34 +02:00
Wladimir J. van der Laan 71ab6e5538
Merge #10547: [tests] Use FastRandomContext instead of boost::random::{mt19937,uniform_int_distribution}
227ae9b [tests] Use FastRandomContext instead of boost::random::{mt19937,uniform_int_distribution} (practicalswift)

Tree-SHA512: 1bde6c8b9498051fa2eae4913eb1f5411adea8dea1511c0df859aea57a2a7db6f5839945ddf2eccdddfa322bceacad35a5d875742db7d15e40dbea83185307bb
2017-06-08 12:39:43 +02:00
practicalswift 30c2d9db48 [tests] Remove unused function InsecureRandBytes(size_t len) 2017-06-08 09:43:54 +02:00
Wladimir J. van der Laan 6c2d81f34d
Merge #10524: [tests] Remove printf(...)
0abc588 [tests] Remove printf(...) (practicalswift)

Tree-SHA512: a56fa1edce050f5a44a53842223fc99e4e8ade413047e04f2064faeb5c4a418864a94471853d5c26a20608d1dcc18b9226d7fe15172f79a66cc5cf6e1443f7e9
2017-06-08 09:43:09 +02:00
Pieter Wuille e801084dec
Merge #10321: Use FastRandomContext for all tests
e94584858 scripted-diff: Use new naming style for insecure_rand* functions (Pieter Wuille)
2fcd9cc86 scripted-diff: Use randbits/bool instead of randrange where possible (Pieter Wuille)
2ada67852 Use randbits instead of ad-hoc emulation in prevector tests (Pieter Wuille)
5f0b04eed Replace rand() & ((1 << N) - 1) with randbits(N) (Pieter Wuille)
3ecabae36 Replace more rand() % NUM by randranges (Pieter Wuille)
efee1db21 scripted-diff: use insecure_rand256/randrange more (Pieter Wuille)
1119927df Add various insecure_rand wrappers for tests (Pieter Wuille)
124d13a58 Merge test_random.h into test_bitcoin.h (Pieter Wuille)
90620d66c scripted-diff: Rename cuckoo tests' local rand context (Pieter Wuille)
37e864eb9 Add FastRandomContext::rand256() and ::randbytes() (Pieter Wuille)

Tree-SHA512: d09705a3ec718ae792f7d66a75401903ba7b9c9d3fc36669d6e3b9242f0194738106be26baefc8a8e3fa6df7c9a35978c71c0c430278a028b331df23a3ea3070
2017-06-07 15:12:14 -07:00
John Newbery 6294f3283a gettxoutproof() should return consistent result
We can call gettxoutproof() with a list of transactions. Currently, if
the first transaction is unspent (and all other transactions are in the
same block), then the call will succeed. If the first transaction has
been spent, then the call will fail. The means that the following two
calls will return different results:

gettxoutproof(unspent_tx1, spent_tx1)
gettxoutproof(spent_tx1, unspent_tx1)

This commit makes behaviour independent of transaction ordering by looping
through all transactions provided and trying to find which block they're in.

This commit also increases the test coverage and tests more failure
cases for gettxoutproof()
2017-06-07 17:38:21 -04:00
Andrew Chow c8914b9dbb Have `make cov` optionally include branch coverage statistics
Added an option to configure to allow for branch coverage statistics gathering.

Disabled logprint macro when coverage testing is on so that unnecessary branches are not analyzed.
2017-06-07 14:19:01 -07:00
Andrew Chow ac4e438229 Sanity check transaction scripts in DecodeHexTx
Make sure that the scripts of decoded transactions are valid scripts.
2017-06-07 14:07:26 -07:00
Andrew Chow 5b75c47784 Add a valid opcode sanity check to CScript
Added a function in CScript that checks if the script contains valid opcodes.

Add a test for that function
2017-06-07 12:40:01 -07:00
Pieter Wuille e945848582 scripted-diff: Use new naming style for insecure_rand* functions
-BEGIN VERIFY SCRIPT-
sed -i 's/\<insecure_randbits(/InsecureRandBits(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_randbool(/InsecureRandBool(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_randrange(/InsecureRandRange(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_randbytes(/InsecureRandBytes(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_rand256(/InsecureRand256(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<insecure_rand(/InsecureRand32(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
sed -i 's/\<seed_insecure_rand(/SeedInsecureRand(/g' src/test/*.cpp src/test/*.h src/wallet/test/*.cpp
-END VERIFY SCRIPT-
2017-06-07 12:08:39 -07:00
practicalswift 0abc58890c [tests] Remove printf(...) 2017-06-07 20:42:54 +02:00
practicalswift 227ae9b34d [tests] Use FastRandomContext instead of boost::random::{mt19937,uniform_int_distribution} 2017-06-07 20:38:03 +02:00
Pieter Wuille 2fcd9cc86b scripted-diff: Use randbits/bool instead of randrange where possible
-BEGIN VERIFY SCRIPT-
sed -i 's/insecure_randbits(1)/insecure_randbool()/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(2)/insecure_randbool()/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(4)/insecure_randbits(2)/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(32)/insecure_randbits(5)/g' src/test/*_tests.cpp
sed -i 's/insecure_randrange(256)/insecure_randbits(8)/g' src/test/*_tests.cpp
-END VERIFY SCRIPT-
2017-06-07 11:35:16 -07:00
Pieter Wuille 2ada678521 Use randbits instead of ad-hoc emulation in prevector tests 2017-06-07 11:35:16 -07:00
Pieter Wuille 5f0b04eedc Replace rand() & ((1 << N) - 1) with randbits(N) 2017-06-07 11:35:13 -07:00
Pieter Wuille 3ecabae363 Replace more rand() % NUM by randranges 2017-06-07 11:34:55 -07:00
Pavlos Antoniou e5c616888b Fix instantiation and array accesses in class base_uint<BITS>
The implementation of base_uint::operator++(int) and base_uint::operator--(int) is now safer.
Array pn is accessed via index i after bounds checking has been performed on the index, rather than before.
The logic of the while loops has also been made more clear.

A compile time assertion has been added in the class constructors to ensure that BITS is a positive multiple of 32.
2017-06-07 17:21:29 +00:00
Russell Yanofsky 24e44c354d Don't return stale data from CCoinsViewCache::Cursor()
CCoinsViewCache doesn't actually support cursor iteration returning the
current contents of the cache, so raise an error when the cursor method is
called instead of returning a cursor that iterates over stale data.

Also update the gettxoutsetinfo RPC which was relying on the old behavior to be
explicit about which view it is returning data about.
2017-06-07 13:00:11 -04:00
Matt Corallo eada04e778 Do not print soft-fork-script warning with -promiscuousmempool 2017-06-07 11:02:36 -04:00
Matt Corallo b5fea8d0cc Cache full script execution results in addition to signatures
This adds a new CuckooCache in validation, caching whether all of a
transaction's scripts were valid with a given set of script flags.

Unlike previous attempts at caching an entire transaction's
validity, which have nearly universally introduced consensus
failures, this only caches the validity of a transaction's
scriptSigs. As these are pure functions of the transaction and
data it commits to, this should be much safer.

This is somewhat duplicative with the sigcache, as entries in the
new cache will also have several entries in the sigcache. However,
the sigcache is kept both as ATMP relies on it and because it
prevents malleability-based DoS attacks on the new higher-level
cache. Instead, the -sigcachesize option is re-used - cutting the
sigcache size in half and using the newly freed memory for the
script execution cache.

Transactions which match the script execution cache never even have
entries in the script check thread's workqueue created.

Note that the cache is indexed only on the script execution flags
and the transaction's witness hash. While this is sufficient to
make the CScriptCheck() calls pure functions, this introduces
dependancies on the mempool calculating things such as the
PrecomputedTransactionData object, filling the CCoinsViewCache, etc
in the exact same way as ConnectBlock. I belive this is a reasonable
assumption, but should be noted carefully.

In a rather naive benchmark (reindex-chainstate up to block 284k
with cuckoocache always returning true for contains(),
-assumevalid=0 and a very large dbcache), this connected blocks
~1.7x faster.
2017-06-07 11:02:36 -04:00
Matt Corallo 6d22b2b17b Pull script verify flags calculation out of ConnectBlock 2017-06-07 11:02:36 -04:00
Wladimir J. van der Laan 46311e792f
Merge #9672: Opt-into-RBF for RPC & bitcoin-tx
9a5a1d7 RPC/rawtransaction: createrawtransaction: Check opt_into_rbf when provided with either value (Luke Dashjr)
23b0fe3 bitcoin-tx: rbfoptin: Avoid touching nSequence if the value is already opting in (Luke Dashjr)
b005bf2 Introduce MAX_BIP125_RBF_SEQUENCE constant (Luke Dashjr)
575cde4 [bitcoin-tx] add rbfoptin command (Jonas Schnelli)
5d26244 [Tests] extend the replace-by-fee test to cover RPC rawtx features (Jonas Schnelli)
36bcab2 RPC/Wallet: Add RBF support for fundrawtransaction (Luke Dashjr)
891c5ee Wallet: Refactor FundTransaction to accept parameters via CCoinControl (Luke Dashjr)
578ec80 RPC: rawtransaction: Add RBF support for createrawtransaction (Luke Dashjr)

Tree-SHA512: 446e37c617c188cc3b3fd1e2841c98eda6f4869e71cb3249c4a9e54002607d0f1e6bef92187f7894d4e0746ab449cfee89be9f6a1a8831e25c70cf912eac1570
2017-06-07 15:31:40 +02:00
practicalswift 246a02fb14 Use std::unordered_{map,set} (C++11) instead of boost::unordered_{map,set} 2017-06-07 15:04:54 +02:00
Pieter Wuille be3e042c20
Merge #10523: Perform member initialization in initialization lists where possible
656dbd871 Perform member initialization in initialization lists where possible (practicalswift)

Tree-SHA512: 048380f4da23ab1eaaf471801a01dbd76f2235afb686c1489b30a6bac109195134afc83414b8378d3482a9042d537ec62d30136dadb9347cf06b07fb5c693208
2017-06-06 17:00:19 -07:00
MarcoFalke 75e898c094
Merge #10331: Share config between util and functional tests
8ad5bde Merge bctest.py into bitcoin-util-test.py (John Newbery)
95836c5 Use shared config file for functional and util tests (John Newbery)
89fcd35 Use an .ini config file for environment vars in bitcoin-util-test.py (John Newbery)
e9265df Change help_text in bitcoin-util-test.py to a docstring. (John Newbery)
ce58e93 Change bitcoin-util-test.py to use Python3 (John Newbery)

Tree-SHA512: 66dab0b4a8546aee0dfaef134a165f1447aff4c0ec335754bbc7d9e55909721c62f09cdbf4b22d02ac1fcd5a9b66780f91e1cc4d8687fae7288cc9072a23a78f
2017-06-06 23:55:24 +02:00
MarcoFalke 2805d606bc
Merge #10522: [wallet] Remove unused variables
a8c09af Remove unused variables (practicalswift)

Tree-SHA512: 34807dc3a0471c83b086f430b66465602c8f6a3a158b54ace2ec8afb746f1f5907f7dfcde5a4bad4041df9721ec46b61681b2dbf89725c9c8c4c5ad0ca99f78f
2017-06-06 23:51:33 +02:00
MarcoFalke 32751807c9
Merge #10538: [trivial] Fix typo: "occurrences" (misspelled as "occurrances")
b083db6 [trivial] Fix typo: "occurrences" (misspelled as "occurrances") (practicalswift)

Tree-SHA512: 5141526dbbbbe797ef103fcbdc0a1318648214973214607e35cc0e99abfc4dd547e3ef15fe21976c53a78b03dff140fe76e5c92a0f7e7d2b08081215983a8616
2017-06-06 23:48:10 +02:00
Luke Dashjr c237bd750e wallet: Update formatting 2017-06-06 21:20:22 +00:00
Luke Dashjr 9cbe8c80ba wallet: Forbid -salvagewallet, -zapwallettxes, and -upgradewallet with multiple wallets 2017-06-06 21:20:22 +00:00
Luke Dashjr a2a5f3f0f0 wallet: Base backup filenames on original wallet filename 2017-06-06 21:20:22 +00:00
Luke Dashjr b823a4c9f6 wallet: Include actual backup filename in recovery warning message 2017-06-06 21:17:09 +00:00
Luke Dashjr 84dcb45017 Bugfix: wallet: Fix warningStr, errorStr argument order 2017-06-06 21:17:09 +00:00
Luke Dashjr 008c360083 Wallet: Move multiwallet sanity checks to CWallet::Verify, and do other checks on all wallets 2017-06-06 21:17:09 +00:00
Luke Dashjr 0f08575be2 Wallet: Support loading multiple wallets if -wallet used more than once 2017-06-06 21:17:09 +00:00
Luke Dashjr b124cf04ea Wallet: Replace pwalletMain with a vector of wallet pointers 2017-06-06 21:17:09 +00:00
practicalswift 3fb81a8480 Use list initialization (C++11) for maps/vectors instead of boost::assign::map_list_of/list_of 2017-06-06 21:29:16 +02:00
Matt Corallo 40796e1a9d Remove references to priority that snuck back in in 870824e9.
The "priority" field should be appropriately marked as a "dummy"
value and noted that it is deprecated and will likely be removed.
2017-06-06 15:13:37 -04:00
Mario Dian 24980a3e40 Make functions in validation.cpp static and pass chainparams
Fix bugs as per PR comment

Change bool static to static bool
2017-06-06 22:21:30 +08:00
Wladimir J. van der Laan 300f8e7a82
Merge #9909: tests: Add FindEarliestAtLeast test for edge cases
cf66f04 Add FindEarliestAtLeast test for edge cases (Russell Yanofsky)

Tree-SHA512: bed2e9b2eefe0014414f1be8f0ba236b1dcc6744a670ffa546100c62817dd06a117cc62cdff80c4988d2b374cae9a57f2bb135fc582ffb51ca2d34ab07bb3fe0
2017-06-06 15:51:45 +02:00
Wladimir J. van der Laan 980deaf0b1
Merge #10252: RPC/Mining: Restore API compatibility for prioritisetransaction
870824e RPC/Mining: Restore API compatibility for prioritisetransaction (Luke Dashjr)

Tree-SHA512: eb507500dc5ba8d17521f34f3d6eae45aa9259c38d15a75dc3e3ad45774ffb53db943be1720a97e6cd5f08e7832801e27ffb636da081a58955018b6f8f9d8fba
2017-06-06 15:49:38 +02:00