Commit graph

9169 commits

Author SHA1 Message Date
practicalswift a3ca43bb32 [trivial] Fix a typo (introduced two days ago) in the default fee warning 2017-03-16 09:05:30 +01:00
NicolasDorier cfce581d11 [LevelDB] Plug leveldb logs to bitcoin logs 2017-03-16 02:14:27 +00:00
Russell Yanofsky 9e6817ed11 Add new test_bitcoin-qt static library dependencies
Avoids following error when qt is statically linked into the test binary, as on
travis:

This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".
2017-03-15 13:02:02 -04:00
Russell Yanofsky 2754ef1c4a Add simple qt wallet test sending a transaction 2017-03-15 12:02:02 -05:00
Russell Yanofsky b61b34c89d Add braces to if statements in Qt test_main 2017-03-15 13:02:02 -04:00
Patrick Strateman fb6f90a4ce Initialize nRelockTime 2017-03-14 15:48:08 -07:00
Wladimir J. van der Laan ce01e6226c
Merge #9481: [Qt] Show more significant warning if we fall back to the default fee
7abe7bb Qt/Send: Give fallback fee a reasonable indent (Luke Dashjr)
3e4d7bf Qt/Send: Figure a decent warning colour from theme (Luke Dashjr)
c5adf8f [Qt] Show more significant warning if we fall back to the default fee (Jonas Schnelli)

Tree-SHA512: 9e85b5b398d7a49aaf6c42578d63750b1b7aa9cc9e84d008fe21d6c53f1ffe2fb69286a1a764e634ebca3286564615578eea0a1bc883e4b332be8306d9883d14
2017-03-14 13:06:44 +01:00
Wladimir J. van der Laan 416809c11b
Merge #9955: Don't require segwit in getblocktemplate for segwit signalling or mining
c85ffe6 Test transaction selection when gbt called without segwit support (Suhas Daftuar)
abe7b3d Don't require segwit in getblocktemplate for segwit signalling or mining (Suhas Daftuar)

Tree-SHA512: 172496b6d7cdf1879de1266748f2b4ed9fd2ba9ff4a1fd964d74d73c674c16d74bf01a3ba42bf25f2d69f348217c0bbf3412ac64821f222efc9de25a287a5240
2017-03-14 12:55:52 +01:00
Wladimir J. van der Laan 2c781fb920
Merge #9497: CCheckQueue Unit Tests
96c7f2c Add CheckQueue Tests (Jeremy Rubin)
e207342 Fix CCheckQueue IsIdle (potential) race condition and remove dangerous constructors. (Jeremy Rubin)

Tree-SHA512: 5989743ad0f8b08998335e7ca9256e168fa319053f91b9dece9dbb134885bef7753b567b591acc7135785f23d19799ed7e6375917f59fe0178d389e961633d62
2017-03-14 12:23:41 +01:00
Suhas Daftuar abe7b3d3ab Don't require segwit in getblocktemplate for segwit signalling or mining
Segwit's version bit will be signalled for all invocations of CreateNewBlock,
and not specifying segwit only will cause CreateNewBlock to skip transactions
with witness from being selected.
2017-03-14 06:43:37 -04:00
Wladimir J. van der Laan 67ed40ed82
Merge #9505: Prevector Quick Destruct
45a5aaf Only call clear on prevector if it isn't trivially destructible and don't loop in clear (Jeremy Rubin)
aaa02e7 Add prevector destructor benchmark (Jeremy Rubin)

Tree-SHA512: 52bc8163b65b71310252f2d578349d0ddc364a6c23795c5e06e101f5449f04c96cbdca41c0cffb1974b984b8e33006471137d92b8dd4a81a98e922610a94132a
2017-03-14 10:43:10 +01:00
Wladimir J. van der Laan 1b046603b3
Merge #8665: Assert all the things!
4d51e9b Assert ConnectBlock block and pIndex are the same block (NicolasDorier)
972714c pow: GetNextWorkRequired never called with NULL pindexLast (Daniel Cousens)
cc44c8f ContextualCheckBlockHeader should never have pindexPrev to NULL (NicolasDorier)

Tree-SHA512: 7cc568bf9417267c335f21ec3d1505b26e56e5b3d5f4d3dbb555279489800aaa65a3bcd7bc376e274dd102912aec16ddbb18de2e2060b2667b41eb979cd9321e
2017-03-14 10:38:27 +01:00
Wladimir J. van der Laan 8040ae6fc5
Merge #9963: util: Properly handle errors during log message formatting
b651270 util: Throw tinyformat::format_error on formatting error (Wladimir J. van der Laan)
3b092bd util: Properly handle errors during log message formatting (Wladimir J. van der Laan)

Tree-SHA512: 85e3b7afec2255fc88034187f1abd6060e9421de17ed4e3d918416f393429a99cc2c974b362099aaaff6970549df47664bea4c857c4e46acc0789663201dc541
2017-03-13 14:43:19 +01:00
Wladimir J. van der Laan afcd7c0e52
Merge #9830: Add safe flag to listunspent result
dcf2112 Add safe flag to listunspent result (NicolasDorier)
af61d9f Add COutput::fSafe member for safe handling of unconfirmed outputs (Russell Yanofsky)

Tree-SHA512: 311edb6fa8075b3ede5b24cb8c6e5d133ccd8ac9ecafea07b604ffa812ee4f071337e31695e662d8573590a0460af20aaaeb39d49c9ea87924449ea50bdfb0b3
2017-03-13 07:01:29 +01:00
Wladimir J. van der Laan f8a709161f
Merge #9953: Fix shutdown hang with >= 8 -addnodes set
819b513 Add missing braces in semaphore posts in net (Matt Corallo)
e007b24 Fix shutdown hang with >= 8 -addnodes set (Matt Corallo)

Tree-SHA512: f2d7562bd5d333cd0e80562eb3b1fe329fc10ee713996e053d2ed669db6d9eb39550e0a6c6ab768cd070bfe92a5ea85e0f752470206706de196bd4a689b9bc07
2017-03-13 06:57:24 +01:00
Wladimir J. van der Laan b651270cd6 util: Throw tinyformat::format_error on formatting error
Throw tinyformat::format_error on formatting error instead of the
`std::runtime_error`.
2017-03-13 06:51:15 +01:00
Wladimir J. van der Laan 3b092bd9b6 util: Properly handle errors during log message formatting
Instead of having an exception propagate into the program when an
error happens while formatting a log message, just print a message to
the log.

Addresses #9423.
2017-03-12 07:58:06 +01:00
Russell Yanofsky cc9503cec9 Make qt test compatible with TestChain100Setup framework
Reset global state after rpc tests, and remove unnecessary ECC initialization
to prevent assert error if it is initialized twice.
2017-03-10 15:52:29 -05:00
Russell Yanofsky 91e303595b Make test_bitcoin.cpp compatible with Qt Test framework
Move Boost.Test main function and global overrides to a new test_bitcoin_main.cpp file.
2017-03-10 15:47:41 -05:00
NicolasDorier dcf2112de6 Add safe flag to listunspent result 2017-03-10 05:11:10 +00:00
Russell Yanofsky af61d9f78b Add COutput::fSafe member for safe handling of unconfirmed outputs
This exposes a value computed in CWallet::AvailableCoins so it can used for
other things, like inclusion in listunspent output.
2017-03-10 05:11:10 +00:00
MarcoFalke 5703dff093
Merge #9962: [trivial] Fix typo in rpc/protocol.h
9ea2490 [trival] Fix typo introduced into rpc/protocol.h in commit 338bf06 (practicalswift)

Tree-SHA512: bfa60dc9f40db867b09e60dbe803db79c86ff939048c91e551c0794a91428bde3aa42c4aabf915c640cd15565005608da10dae051942e806fdf5d28e9704d765
2017-03-09 12:32:46 +01:00
Wladimir J. van der Laan e3e7db829e
Merge #9538: [util] Remove redundant call to get() on smart pointer (thread_specific_ptr)
53a2ba3 [util] Remove redundant call to get() on smart pointer (thread_specific_ptr) (practicalswift)

Tree-SHA512: ec8ace4218ae0657d1aaf8ba7682b0cdd140fe0844173058d3cbf4575dee8d9ad5f241e5bacf1e9e4ad3f7dd282f56a8cb0f306de2093f2c0f6333daedd58261
2017-03-09 10:33:28 +01:00
Wladimir J. van der Laan c71f0ca5f8
Merge #9960: Trivial: Add const modifier to GetHDChain and IsHDEnabled
3cef950 Trivial: Add const modifier to GetHDChain and IsHDEnabled (NicolasDorier)

Tree-SHA512: 73126689e179d70e6823950b51aae4da0a1e348436bc72338814f3afeec27868bb479d9e8261f86e4fe851e84492778a30c5f1fe76c9d7dd91796d0e38baeaf0
2017-03-09 10:27:31 +01:00
practicalswift 53a2ba351a [util] Remove redundant call to get() on smart pointer (thread_specific_ptr) 2017-03-09 10:22:35 +01:00
practicalswift 9ea249014a [trival] Fix typo introduced into rpc/protocol.h in commit 338bf06
The typo was introduced in commit 338bf065a4, which was merged yesterday.

Changes summarized to facilitate reviewing:
* exampled → example
2017-03-09 10:16:16 +01:00
Wladimir J. van der Laan b403ec5c0f
Merge #9916: Fix msvc compiler error C4146 (minus operator applied to unsigned type)
8e0720b Fix msvc compiler error C4146 (unary minus operator applied to unsigned type) (kobake)
292112f Fix msvc compiler error C4146 (minus operator applied to unsigned type) (kobake)

Tree-SHA512: 25f408daf7bf9ffe4b8b4bd62f6f6d326219189a9faf8f8c0a135c5a0cb0511af765aa2b6087a091c8863c701289bda49a2379b00cd9b10854d316a5c3fc3f8e
2017-03-09 10:02:55 +01:00
Wladimir J. van der Laan 02bd6e9bc6
Merge #9853: Fix error codes from various RPCs
adaa281 Update release notes to include RPC error code changes. (John Newbery)
338bf06 Add commenting around JSON error codes (John Newbery)
dab804c Return correct error codes in fundrawtransaction(). (John Newbery)
a012087 Return correct error codes in setban(). (John Newbery)
960bc7f Return correct error codes in removeprunedfunds(). (John Newbery)
c119096 Return correct error codes in blockchain.cpp. (John Newbery)
6d07c62 Return correct error codes in bumpfee(). (John Newbery)

Tree-SHA512: 4bb39ad221cd8c83d98ac5d7ad642f3a8c265522720dc86b2eebc70e74439a85b06d6ddcd6a874e879d986511de3ab0878bb7fe58b50cb0546b78913632ea809
2017-03-09 10:02:17 +01:00
Wladimir J. van der Laan 6805c4112c
Merge #9575: Remove unused, non-working RPC PostCommand signal
54fae05 Remove unreachable code (g_rpcSignals.PostCommand) (practicalswift)

Tree-SHA512: b416d63ffa1c35fa0434b6bc0a930ae1b04919a12114ef65154ce4621aa43d744eb4fc515f48eac2e96c0f528cedb4cdbe2349952d215c2c74e900a63e155e0a
2017-03-09 10:01:03 +01:00
practicalswift 54fae05dad Remove unreachable code (g_rpcSignals.PostCommand) 2017-03-09 09:47:04 +01:00
Wladimir J. van der Laan 8152d3fe57
Merge #9476: [refactor] Remove using namespace <xxx> from rpc/ & script/ sources
8cbfc4e Refactor: Remove using namespace <xxx> from script/ (Karl-Johan Alm)
f3c264e Refactor: Remove using namespace <xxx> from rpc/ (Karl-Johan Alm)

Tree-SHA512: 407e80eeda0b8e1df22c5fcba33572e117542fde83c67357f6c2d98fa60bcc7b21bb88ad9a1ee59062fbec17fadaa4836b69e8e6d18188b4027b794357634467
2017-03-09 08:15:44 +01:00
NicolasDorier 3cef95058c Trivial: Add const modifier to GetHDChain and IsHDEnabled 2017-03-09 11:32:02 +09:00
Matt Corallo 819b513a54 Add missing braces in semaphore posts in net 2017-03-08 14:55:28 -05:00
Matt Corallo e007b243c4 Fix shutdown hang with >= 8 -addnodes set
We previously would block waiting for a CSemaphoreGrant in
ThreadOpenAddedConnections, when we did not need to. This would
block as the posts in CConnman shutdown were both to the wrong
semaphore and in the wrong location.
2017-03-08 14:41:57 -05:00
John Newbery 338bf065a4 Add commenting around JSON error codes
RPC_INVALID_REQUEST and RPC_METHOD_NOT_FOUND are mapped internally to
HTTP error codes and should not be used for application-layer errors.
This commit adds commenting around those definitions to warn not to use
them for application errors.
2017-03-08 14:22:55 -05:00
Karl-Johan Alm a57845c20e
Refactor: Remove using namespace <xxx> from util* 2017-03-08 08:47:02 -08:00
Karl-Johan Alm 8a5228197c
Refactor: Remove using namespace <xxx> from wallet/ 2017-03-08 08:46:59 -08:00
Karl-Johan Alm 8cbfc4e472
Refactor: Remove using namespace <xxx> from script/ 2017-03-08 08:08:17 -08:00
Karl-Johan Alm f3c264e9a6
Refactor: Remove using namespace <xxx> from rpc/ 2017-03-08 08:07:55 -08:00
practicalswift 218d915445 [bench] Avoid function call arguments which are pointers to uninitialized values 2017-03-08 16:40:12 +01:00
MarcoFalke 8bfa13b15b
Merge #9936: [trivial] Fix three typos introduced into walletdb.h in commit 7184e25
fdab309 [trivial] Fix typos introduced in 7184e25c80 (practicalswift)

Tree-SHA512: 091666f996267fc5d9f911e6ff25051df5c198851a9c2a6cae73692ffacc64f4275932260487aa48a224ca7f80c58f79933065c72d42aeccae540293c67bcee9
2017-03-08 14:15:47 +01:00
kobake 8e0720bdb9 Fix msvc compiler error C4146 (unary minus operator applied to unsigned type)
On msvc14, int literal '-2147483648' is invalid, because '2147483648' is unsigned type and cant't apply minus operator to unsigned type.
To define the int literal correctly, use '-2147483647 - 1' formula that is also used to define INT_MIN in limits.h.
2017-03-08 15:43:40 +09:00
John Newbery 6c1fb73dd1 Improve logging in bctest.py if there is a formatting mismatch 2017-03-07 18:07:08 -05:00
John Newbery dab804c18a Return correct error codes in fundrawtransaction().
The fundrawtransaction() RPC was returning misleading or incorrect error
codes (for example RPC_INTERNAL_ERROR when funding the transaction
failed). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
errors, only for genuine internal errors such as corrupted data.

That error code has been replaced with RPC_WALLET_ERROR.

This commit also updates the test cases to explicitly test the error code.
2017-03-07 16:45:09 -05:00
John Newbery a012087667 Return correct error codes in setban().
The setban() RPC was returning misleading or incorrect error
codes (for example RPC_CLIENT_NODE_ALREADY_ADDED when an invalid IP
address was entered). This commit fixes those error codes:

- RPC_CLIENT_INVALID_IP_OR_SUBNET should be returned if the client
  enters an invalid IP address or subnet.

This commit also updates the test cases to explicitly test the error code.

This commit also adds a testcase for trying to setban on an invalid subnet.
2017-03-07 16:45:09 -05:00
John Newbery 960bc7f778 Return correct error codes in removeprunedfunds().
The removeprunedfunds() RPC was returning misleading or incorrect error
codes (for example RPC_INTERNAL_ERROR when the transaction was
not found in the wallet). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
errors, only for genuine internal errors such as corrupted data.

This error code has been replaced with RPC_WALLET_ERROR.

This commit also updates the test cases to explicitly test the error code.
2017-03-07 16:45:09 -05:00
John Newbery c1190963b3 Return correct error codes in blockchain.cpp.
RPCs in blockchain.cpp were returning misleading or incorrect error
codes (for example getblock() returning RPC_INTERNAL_ERROR when the
block had been pruned). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
  errors, only for genuine internal errors such as corrupted data.
- RPC_METHOD_NOT_FOUND should not be returned in response to a
  JSON request for an existing method.

Those error codes have been replaced with RPC_MISC_ERROR or
RPC_INVALID_PARAMETER as appropriate.
2017-03-07 16:45:09 -05:00
John Newbery 6d07c62322 Return correct error codes in bumpfee().
The bumpfee() RPC was returning misleading or incorrect error codes
(for example RPC_INVALID_ADDRESS_OR_KEY when the transaction was not
BIP125 replacable). This commit fixes those error codes:

- RPC_INVALID_ADDRESS_OR_KEY if an invalid address was provided:
    - Invalid change address given
- RPC_INVALID_PARAMETER if a single (non-address/key) parameter is incorrect
    - confTarget and totalFee options should not both be set.
    - Invalid confTarget
    - Insufficient totalFee (cannot be less than required fee)
- RPC_WALLET_ERROR for any other error
    - Transaction has descendants in the wallet
    - Transaction has descendants in the mempool
    - Transaction has been mined, or is conflicted with a mined transaction
    - Transaction is not BIP 125 replaceable
    - Transaction has already been bumped
    - Transaction contains inputs that don't belong to the wallet
    - Transaction has multiple change outputs
    - Transaction does not have a change output
    - Fee is higher than maxTxFee
    - New fee rate is less than the minimum fee rate
    - Change output is too small.

This commit also updates the test cases to explicitly test the error code.
2017-03-07 16:45:09 -05:00
Wladimir J. van der Laan 47510ad3dd
Merge #9548: Remove min reasonable fee
ad82cb0 Remove unnecessary min fee argument in CTxMemPool constructor (Alex Morcos)
2a7b56c CBlockPolicyEstimator now uses hard coded minimum bucket feerate (Alex Morcos)
ac9d3d2 Change fee estimation bucket limit variable names (Alex Morcos)

Tree-SHA512: 6e3bc7df3497ed60c7620845d222063e33a0238020f5c3316e61e0eff758078588ea8dd51196ceb59aa561ba106f8cdae62cebe521adb3247108bb49f15252d6
2017-03-07 19:49:00 +01:00
Wladimir J. van der Laan 30ff3a2fc9
Merge #9602: Remove coin age priority and free transactions - implementation
b421e6d Update example bitcoin.conf (Alex Morcos)
7d4e950 Allow setting minrelaytxfee to 0 (Alex Morcos)
359e8a0 [cleanup] Remove coin age priority completely. (Alex Morcos)
f9b9371 [rpc] Remove priorityDelta from prioritisetransaction (Alex Morcos)
49be7e1 [rpc] Remove priority information from mempool RPC calls (Alex Morcos)
0315888 [test] Remove priority from tests (Alex Morcos)
f838005 No longer allow "free" transactions (Alex Morcos)
ad727f4 [rpc] sendrawtransaction no longer bypasses minRelayTxFee (Alex Morcos)
fe282ac [cleanup] Remove estimatePriority and estimateSmartPriority (Alex Morcos)
400b151 [debug] Change -printpriority option (Alex Morcos)
272b25a [mining] Remove -blockprioritysize. (Alex Morcos)
12839cd [rpc] Remove estimatepriority and estimatesmartpriority. (Alex Morcos)
ddf58c7 wallet: Remove sendfree (MarcoFalke)

Tree-SHA512: a9a4499405923ce794ef18f9e334dbbd59dfc73a3dc2df6f85cc9c62af6f353ec2eed9c2d5e58e904f918d0d7ab738f403dd4939d9bc2276136864fe63710782
2017-03-07 19:30:23 +01:00
Wladimir J. van der Laan 3178b2c740
Merge #9369: Factor out CWallet::nTimeSmart computation into a method.
630fc54 Clean up braces in CWallet::ComputeTimeSmart (Russell Yanofsky)
6c996c2 Add documentation describing CWallet::nTimeSmart. (Russell Yanofsky)
1f98abe Factor out CWallet::nTimeSmart computation into a method. (Russell Yanofsky)
c6b82d1 Add tests for CWalletTx::nTimeSmart (Russell Yanofsky)

Tree-SHA512: 457a30251e572cf20dac0198af1a94128d269b1e0ce6605a213d56fc14d85c84a0a494e3dcbb18c201c4f39e6f7b000bd9cb6f283930d8452e4bb93ba406f8d4
2017-03-07 17:11:59 +01:00
Wladimir J. van der Laan 6015df5b85
Merge #9912: Optimize GetWitnessHash() for non-segwit transactions
02c57b5 Optimize GetWitnessHash() for non-segwit transactions (Suhas Daftuar)

Tree-SHA512: 405d07c11930f3432ae25b11232466a30ba2339be98e0fb5149934d792e014f504fedbe62b9c8e5febbbdad459bd1573ea896e527b9aa591926bbc774b895e6a
2017-03-07 11:03:32 +01:00
Wladimir J. van der Laan 779f2f9747
Merge #9605: Use CScheduler for wallet flushing, remove ThreadFlushWalletDB
0235be1 Rename FlushWalletDB -> CompactWalletDB, add function description (Matt Corallo)
735d9b5 Use CScheduler for wallet flushing, remove ThreadFlushWalletDB (Matt Corallo)
73296f5 CScheduler boost->std::function, use millisecs for times, not secs (Matt Corallo)

Tree-SHA512: c04f97beab65706c444c126be229d02887df9b0972d8fb15ca1f779ef0e628cf7ecef2bf533c650d9b44645b63e01de22f17266a05907e778938d64cc6e19de6
2017-03-07 11:00:55 +01:00
practicalswift fdab309670 [trivial] Fix typos introduced in 7184e25c80 2017-03-07 09:16:46 +01:00
MarcoFalke 19be26afe3
Merge #9555: [test] Avoid reading a potentially uninitialized variable in tx_invalid-test (transaction_tests.cpp)
8455e36 [test] Avoid reading a potentially uninitialized variable in tx_invalid-test (practicalswift)

Tree-SHA512: 1064cdd5c9e4612a05397a5880535d93dbb18dec4897b4bbda9e6ad78d30f4c72303e4d23159398f1b33545ff5819e739e374d7cde757e402b26c355268a2319
2017-03-07 01:22:12 +01:00
Matt Corallo 0235be1e7a Rename FlushWalletDB -> CompactWalletDB, add function description 2017-03-06 18:35:20 -05:00
Matt Corallo 735d9b5362 Use CScheduler for wallet flushing, remove ThreadFlushWalletDB 2017-03-06 18:35:19 -05:00
Matt Corallo 73296f54d6 CScheduler boost->std::function, use millisecs for times, not secs 2017-03-06 18:33:50 -05:00
kobake 292112f87e Fix msvc compiler error C4146 (minus operator applied to unsigned type)
On msvc14, the compiler error C4146 (unary minus operator applied to unsigned type, result still unsigned) had been occured.
Use '0 - x' styled formula instead of '-x' so as to fix the error.
2017-03-07 02:42:44 +09:00
Wladimir J. van der Laan 72fb5158b1
Merge #9906: Disallow copy constructor CReserveKeys
188f89c Disallow copy of CReserveKeys (Gregory Sanders)

Tree-SHA512: e55ce10bf7f2dc91de9797e60ab7767fb51f25255995d62ddf358c52b7aaa23c26fbfb522e1610ff950b86804ddbc38dc0d7708bfab2c4d33ad99a275d8c77db
2017-03-06 18:33:24 +01:00
Gregory Sanders 188f89c3bb Disallow copy of CReserveKeys 2017-03-06 09:26:10 -05:00
Jonas Schnelli 7184e25c80
[Wallet] refactor CWallet/CWalletDB/CDB
Try to hide CDB/bitdb behinde CWalletDB.
Prepare for full wallet database abstraction.
2017-03-06 11:30:24 +01:00
Wladimir J. van der Laan fa625b078b
Merge #9333: Document CWalletTx::mapValue entries and remove erase of nonexistent "version" entry.
87ed396 [trivial] Add comment documenting bumpfee mapValues (Russell Yanofsky)
a1fe944 Remove reference to nonexistent "version" wallet transaction mapvalue field (Russell Yanofsky)
654e044 [trivial] Add comment documenting CWalletTx::mapValue (Russell Yanofsky)

Tree-SHA512: 1fd1860e345c59b13634db2007fff4ba30aaf1f177fdd765f47bf9257fac117cdcd5d491424416da304c08e85effbb27f3424f072f7c9587ef39cb98531b932a
2017-03-06 10:18:19 +01:00
Wladimir J. van der Laan d32581cc29
Merge #9547: bench: Assert that division by zero is unreachable
db07f91 Assert that what might look like a possible division by zero is actually unreachable (practicalswift)

Tree-SHA512: f1652eb37196a5b72f356503a1fbb44fb98aa8a94954ad1765f86d81ebf41a2337d4eb58c4f19937fda3752f5d2d642756e44afdbd438015b87ac20801246bff
2017-03-06 10:08:14 +01:00
Wladimir J. van der Laan 5a6af31722
Merge #9908: Define 7200 second timestamp window constant
e57a1fd Define 7200 second timestamp window constant (Russell Yanofsky)

Tree-SHA512: 449d20e4fd23905cd96be36f717c55a0a2360aba1002aaf55a3699cce4a41f6e94acc2fbe511a93c5cbe8f8e68386995a76cad67620ebb66ba9283e6080ab567
2017-03-06 10:02:05 +01:00
Wladimir J. van der Laan 56ab672b59
Merge #9576: [wallet] Remove redundant initialization
343ba8f [wallet] Remove redundant initialization (practicalswift)

Tree-SHA512: 54b94d7703b1735cb1ae0bd7eba61ca9d2f18e20b70e46c94aa3b0653495dce4fdea00cf953ec08215b96b5792eabb8b38c3f9b3cd36e52b82fcb2f1fd8a3540
2017-03-06 09:40:06 +01:00
Wladimir J. van der Laan a4d1c9f041 compat: use unsigned int instead of u_int
`u_int` is not available on some platforms (not sure what standard it's
supposed to be part of), we don't use it anywhere else, and it doesn't
hurt to simply write `unsigned int` out here.
2017-03-05 09:51:21 +00:00
Wladimir J. van der Laan 25da1ee36c build: cleanup: define MSG_DONTWAIT/MSG_NO_SIGNAL locally
Define MSG_DONTWAIT and MSG_NO_SIGNAL in the implementation files that
use them (`net.cpp` and `netbase.cpp`), instead of compat.h which is
included all over the place.

This avoids putting them in the global namespace, as defining them as 0
is a hack that works for our specific usage, but it is not a general
solution.

Also makes sure they are defined only once so the `!defined(MSG_x)` guard can go.
2017-03-05 09:47:29 +00:00
Wladimir J. van der Laan c459d509b7 build: Probe MSG_DONTWAIT in the same way as MSG_NOSIGNAL
Instead of the WIN32-specific workaround, detect lack of `MSG_DONTWAIT`
in the build system. This allows other platforms without `MSG_DONTWAIT`
to work too.
2017-03-05 09:29:37 +00:00
Alex Morcos 7d4e9509ad Allow setting minrelaytxfee to 0
Setting minrelaytxfee to 0 will allow all transactions regardless of fee to enter your mempool until it reaches its size limit.  However now that mempool limiting is governed by a separate incrementalrelay fee, it is an unnecessary restriction to prevent a minrelaytxfee of 0.
2017-03-03 16:50:20 -05:00
Alex Morcos 359e8a03d1 [cleanup] Remove coin age priority completely.
Remove GetPriority and ComputePriority.  Remove internal machinery for tracking priority in CTxMemPoolEntry.
2017-03-03 16:50:20 -05:00
Alex Morcos f9b9371c60 [rpc] Remove priorityDelta from prioritisetransaction
This a breaking API change to the prioritisetransaction RPC call which previously required exactly three arguments and now requires exactly two (hash and feeDelta).  The function prioritiseTransaction is also updated.
2017-03-03 16:50:19 -05:00
Alex Morcos 49be7e1bef [rpc] Remove priority information from mempool RPC calls
"startingpriority" and "currentpriority" are no longer returned in the JSON information about a mempool entry.  This affects getmempoolancestors, getmempooldescendants, getmempooolentry, and getrawmempool.
2017-03-03 16:50:19 -05:00
Alex Morcos 0315888d0d [test] Remove priority from tests
Remove all coin age priority functionality from unit tests and RPC tests.
2017-03-03 16:50:19 -05:00
Alex Morcos f838005444 No longer allow "free" transactions
Remove -limitfreerelay and always enforce minRelayTxFee in the mempool (except from disconnected blocks)

Remove -relaypriority, the option was only used for the ability to allow free transactions to be relayed regardless of their priority.  Both notions no longer apply.
2017-03-03 16:50:19 -05:00
Russell Yanofsky e57a1fd899 Define 7200 second timestamp window constant 2017-03-03 13:51:41 -05:00
Suhas Daftuar 02c57b521a Optimize GetWitnessHash() for non-segwit transactions 2017-03-03 13:33:42 -05:00
Russell Yanofsky 7759aa23d1 Save watch only key timestamps when reimporting keys
Previously if an existing watch only key was reimported with a new timestamp,
the new timestamp would not be saved in the key metadata, and would not be used
to update the wallet nTimeFirstKey value (which could cause rescanning to start
at the wrong point and miss transactions).

Issue was pointed out by Jonas Schnelli <dev@jonasschnelli.ch> in
https://github.com/bitcoin/bitcoin/pull/9108#issuecomment-279715550
2017-03-03 11:22:44 -05:00
Russell Yanofsky 630fc549e2 Clean up braces in CWallet::ComputeTimeSmart 2017-03-03 11:22:44 -05:00
Wladimir J. van der Laan 53c300fb52
Merge #9910: Docs: correct and elaborate -rpcbind doc
e5b449c Docs: correct and elaborate -rpcbind doc (Ian Kelling)

Tree-SHA512: e1cdaa32f7248f304d463e3f37d7d5da23ee0e506bd453420b87f4cc9c704cc30214e41c9266294890d65f2ee270f9355f38b542e8c01452637bdbba8273c755
2017-03-03 17:22:44 +01:00
Russell Yanofsky 6c996c2df7 Add documentation describing CWallet::nTimeSmart.
Most of the text comes from the 2012 Luke Dashjr <luke-jr+git@utopios.org>
c3f95ef commit message.
2017-03-03 11:22:44 -05:00
Russell Yanofsky 1f98abe47b Factor out CWallet::nTimeSmart computation into a method.
No change in behavior, this change just pulls some code out of
CWallet::AddToWallet that was making it very long into a separate method.
2017-03-03 11:22:44 -05:00
Russell Yanofsky c6b82d1db5 Add tests for CWalletTx::nTimeSmart 2017-03-03 11:22:44 -05:00
Wladimir J. van der Laan 90cb2a218e
Merge #9774: Enable host lookups for -proxy and -onion parameters
f36bdf0 Enable host lookups for -proxy and -onion parameters (Johnathan Corgan)

Tree-SHA512: 40f5ef3954721333e58d34653874d9f6ac5426c817762d132838f3b6f968ca5ca05aa56d02fd742cb5a8dc040f1a28dad6d54f667342eceba62fb2af18b58fc0
2017-03-03 16:22:22 +01:00
Wladimir J. van der Laan 67c5cc1917
Merge #9828: Avoid -Wshadow warnings in wallet_tests
09fe346 Avoid -Wshadow warnings in wallet_tests (Russell Yanofsky)

Tree-SHA512: 03a026787438efc9eba94299c2dd7de07a71ec7363b058b4f086d5ff0be844660fff2ef4f40e43d91313ea53de25f3de3c677b080b564d37f0693057498d3233
2017-03-03 16:08:50 +01:00
Wladimir J. van der Laan 75d012e8c7
Merge #8808: Do not shadow variables (gcc set)
ad1ae7a Check and enable -Wshadow by default. (Pavel Janík)
9de90bb Do not shadow variables (gcc set) (Pavel Janík)

Tree-SHA512: 9517feb423dc8ddd63896016b25324673bfbe0bffa97f22996f59d7a3fcbdc2ebf2e43ac02bc067546f54e293e9b2f2514be145f867321e9031f895c063d9fb8
2017-03-03 15:48:53 +01:00
Wladimir J. van der Laan ba80a684cf
Merge #9903: Docs: add details to -rpcclienttimeout doc
90a1d9a Docs: add details to -rpcclienttimeout doc (Ian Kelling)

Tree-SHA512: 7f9524f279a54b4d902674740d92624785abd54865aba82f7261151ceda50b5d51bf4d91c4fc0360168e190f8df890cc141bea5e1a9f4f2e62b8f9effda212cc
2017-03-03 14:57:02 +01:00
Wladimir J. van der Laan eb281842b7
Merge #8775: RPC refactoring: Access wallet using new GetWalletForJSONRPCRequest
d678771 Wallet: Sanitise -wallet parameter (Luke Dashjr)
9756be3 Wallet/RPC: Use filename rather than CWallet pointer, for lockwallet RPCRunLater job name (Luke Dashjr)
86be48a More tightly couple EnsureWalletIsAvailable with GetWalletForJSONRPCRequest where appropriate (Luke Dashjr)
a435632 Move wallet RPC declarations to rpcwallet.h (Luke Dashjr)
ad15734 RPC: Pass on JSONRPCRequest metadata (URI/user/etc) for "help" method (Luke Dashjr)
bf8a04a Reformat touched lines with C++11 (Luke Dashjr)
2e518e3 Move nWalletUnlockTime to CWallet::nRelockTime, and name timed task unique per CWallet (Luke Dashjr)
d77ad6d RPC: Do all wallet access through new GetWalletForJSONRPCRequest (Luke Dashjr)
eca550f RPC/Wallet: Pass CWallet as pointer to helper functions (Luke Dashjr)

Tree-SHA512: bfd592da841693390e16f83b451503eb5cedb71208089aa32b3fc45e973555584a3ed7696dd239f6409324464d565dacf0f3d0e36e8e13ae6a7843848465f960
2017-03-03 13:38:42 +01:00
Ian Kelling e5b449c3e8 Docs: correct and elaborate -rpcbind doc
The default was incorrect unless -rpcallowip was also specified.
2017-03-03 04:14:10 -08:00
Wladimir J. van der Laan 58861ad91b
Merge #9904: test: Fail if InitBlockIndex fails
6485466 test: Report InitBlockIndex result (Wladimir J. van der Laan)

Tree-SHA512: 8e1408aa8d56ec1873190f886af24aa68b0555ec4996b2b8a5a39a51ded58c8fba5843c07881ed33ab6dcb00e62c2322bcf2a6fb8f1083f77e0d93e7295ab938
2017-03-03 07:16:32 +01:00
MarcoFalke f7ec7cfd38
Merge #9359: Add test for CWalletTx::GetImmatureCredit() returning stale values.
7ed143c Add test for CWalletTx::GetImmatureCredit() returning stale values. (Russell Yanofsky)

Tree-SHA512: c95088ed6dfc5a0774ddaa2fe14ac0a9ebd830922a4d77100ec3d51fdeb6df40ad97de4f2ea970ed0f4122dcc0022ee1d43ab3c7188becd7f90c1c6af0ed39b7
2017-03-02 22:30:15 +01:00
Wladimir J. van der Laan 64854666f5 test: Report InitBlockIndex result
If InitBlockIndex fails, then it will segfault later. Same for the later
ActivateBestChain. BOOST_REQUIRE the result, so that an error will be
reported and the test case aborted.
2017-03-02 14:54:47 +01:00
Ian Kelling 90a1d9a55d Docs: add details to -rpcclienttimeout doc 2017-03-02 04:42:37 -08:00
Wladimir J. van der Laan 65d90f585a
Merge #9143: Refactor ZapWalletTxes to avoid layer violations
0165a56 Refactor ZapWalletTxes to avoid layer vialotions (Jonas Schnelli)

Tree-SHA512: 51e3abbb866185817d14d685a65cb1070a7a60aa3db692670f3a5fdd328aad59afa765c5a6b13d9e8f6d219e735487f8c87998f2fb38fdd911c1fe19bea373b9
2017-03-02 11:32:34 +01:00
Wladimir J. van der Laan 0496e15aef
Merge #9894: remove 'label' filter for rpc command help
6665977 remove 'label' filter for rpc command help (Gregory Sanders)

Tree-SHA512: 0676c55b2893a469cd6785963affbb04126b9a32c130f1bb22dfd233ede6998f695187264e897ced4e0dac48451d9ae0311ebb4f7442096cad632fd22f75080e
2017-03-02 10:07:31 +01:00
Jonas Schnelli b00ba6251f
Merge #9834: qt: clean up initialize/shutdown signals
5b528d7 qt: clean up initialize/shutdown signals (Marko Bencun)

Tree-SHA512: 4a8326ba05a1cc037203a7abe01d4e77b6ff83e62ec14f09834ada4b35a23ffb1f28b5587aa2e02601f0f6c7d62c5647a7f10320239b4bac132791be29930ddb
2017-03-02 09:37:40 +01:00
Gregory Sanders 666597798c remove 'label' filter for rpc command help 2017-03-01 09:15:39 -08:00
Wladimir J. van der Laan d19d45a1e6
Merge #9821: util: Specific GetOSRandom for Linux/FreeBSD/OpenBSD
7e6dcd9 random: Add fallback if getrandom syscall not available (Wladimir J. van der Laan)
7cad849 sanity: Move OS random to sanity check function (Wladimir J. van der Laan)
aa09ccb squashme: comment that NUM_OS_RANDOM_BYTES should not be changed lightly (Wladimir J. van der Laan)
224e6eb util: Specific GetOSRandom for Linux/FreeBSD/OpenBSD (Wladimir J. van der Laan)

Tree-SHA512: 9fd408b1316c69de86674f342339b2f89192fd317c8c036b5df4320f828fa263c7966146bfc1904c51137ee4a26e4cb0f560b2cd05e18cde4d808b9b92ad15c4
2017-03-01 12:41:53 +01:00
Wladimir J. van der Laan cbdb4732f1
Merge #9868: Abstract out the command line options for block assembly
277b472 Run miner_tests with fixed options (Pieter Wuille)
48faf0b Abstract out BlockAssembler options (Pieter Wuille)

Tree-SHA512: 8e910904864c8653fb0358d820a4181d0496bdcbc3454c17a742af7505bfb59f7078c6d0faa9c753bdaf23b6d93d228a09913cc867fbddccd515483ebe7bfad0
2017-03-01 12:38:04 +01:00
Wladimir J. van der Laan 22f609f25a
Merge #9861: Trivial: Debug log ambiguity fix for peer addrs
6d37ee8 Trivial: Debug log ambiguity fix for peer addrs (keystrike)

Tree-SHA512: 9605f12bffd067427a206655c29b0b42689e9b28c313d1f6d6b0ef71351277b98b40f2e2a2ec0ac83c095a9f6f54e7a87762da400a56d2a833f8c2d14e5ac8d5
2017-03-01 11:16:59 +01:00
Russell Yanofsky 7ed143c10e Add test for CWalletTx::GetImmatureCredit() returning stale values.
Add test for cached immature credit flag not being cleared in
CWalletTx::MarkDirty() bug, which was fixed in
https://github.com/bitcoin/bitcoin/pull/8717, commit a560378.
2017-03-01 05:11:46 -05:00
keystrike 6d37ee8314 Trivial: Debug log ambiguity fix for peer addrs
This line can be misinterpreted as loading wallet addresses which is confusing, especially when the wallet is disabled.
2017-02-28 22:14:24 -03:00
practicalswift 343ba8fef5 [wallet] Remove redundant initialization
Prior to this commit pindexRescan was initialized to a chainActive.Tip().
However, the value of pindexRescan set at time of initialization was never
read before pindexRescan was being set to either chainActive.Genesis()
(case 1), FindForkInGlobalIndex(chainActive, locator) (case 2) or
chainActive.Genesis() (case 3). Thus, the initialization was redundant.

This commit a.) removes the redundant initialization and b.) simplifies
this logic so that pindexRescan is initialized to chainActive.Genesis()
(case 1 and 3), and set to FindForkInGlobalIndex(chainActive, locator)
(case 2) as needed.
2017-02-28 16:54:43 +01:00
Wladimir J. van der Laan 7e2a2212ec
Merge #9829: Fix importmulti returning rescan errors for wrong keys
306bd72 Fix importmulti returning rescan errors for wrong keys (Russell Yanofsky)

Tree-SHA512: ae9998236cbd3ff749d6b5c716bd76c9cec386b0708583e4912e4e05bf4584545258e1d0543aa5445024d2b5decf859a64f40c6503029773366a0f9a9ddf9b88
2017-02-28 13:52:50 +01:00
Wladimir J. van der Laan b7547fa93e
Merge #9822: Remove block file location upgrade code
4b183d3 Remove block file location upgrade code (Marko Bencun)

Tree-SHA512: fac1fce95341e0df645c08c7e794195b22b54df08826aa8728f2f97aede1e42f724f8133781b97f836d4a392d044d08c846bce471a6b478582014f8be501a712
2017-02-28 12:31:33 +01:00
Wladimir J. van der Laan c322fa472e
Merge #9732: [Trivial] Remove nonsense #undef foreach
467df39 Remove nonsense #undef foreach (John Newbery)

Tree-SHA512: b8c3c6654eb8a9e5008a1923bee46f7ef9f8216c8f4f1b4662d82c26410ca8d8afe41e24e48a3e2e8b2a25c81c33795a4073dabfe357caf0aa820519d4fffc71
2017-02-28 12:29:43 +01:00
Wladimir J. van der Laan f5ef8e9dd2
Merge #9867: Replace remaining sprintf with snprintf
19cafc6 test: Replace remaining sprintf with snprintf (Wladimir J. van der Laan)
0a17714 uint256: replace sprintf with HexStr and reverse-iterator (Wladimir J. van der Laan)

Tree-SHA512: 2ba1dd4d25e1cbfff4d67b2f483448aa7c34ab5c799cddd48ba5826e5fa6df425abe35e244aaf4c52db9fccfb4d2a25a14bb4597bf9d1fce95991f270da6bb26
2017-02-28 12:02:44 +01:00
Wladimir J. van der Laan 30bdcfca2b
Merge #9865: Change bitcoin address in RPC help message
83ac719 Change bitcoin address in RPC helpaddress to an invalid address, so people don't accidentally send coins there (like I did). (Marijn Stollenga)

Tree-SHA512: ca1163466a149d567b97efbfcfa8fdfe2d474245b4dd5a1a92555b4e87f8e99df5fee4cd79ef1ce6a98db2337846af78f37c2e6b31d02008b11fa0e151ce6590
2017-02-28 11:59:34 +01:00
Wladimir J. van der Laan 65fdc37ac3
Merge #9856: Terminate immediately when allocation fails
d4ee7ba prevector: assert successful allocation (Cory Fields)
c5f008a don't throw std::bad_alloc when out of memory. Instead, terminate immediately (Cory Fields)

Tree-SHA512: 699ce8df5b1775a99c71d3cfc952b45da1c0091e1a4b6adfac52d5be6144c3d98f88ac3af90e5c73fff2f74666a499feb4a34434683ce5979814e869c0aeddc3
2017-02-28 11:37:36 +01:00
MarcoFalke 88c2ae3ed2
Merge #9350: [Trivial] Adding label for amount inside of tx_valid/tx_invalid.json
988ce2d Adding 'amount' label to tx_valid/tx_invalid.json files (Chris Stewart)

Tree-SHA512: 11c216c6565ecaa5ff4eb6122f87d3b28f89db52d1e473c0678f61c240e133698adb05e717bfb9d3db36409dfb230b902dca4029a58633be36c9f85e0db3d973
2017-02-27 22:33:55 +01:00
Luke Dashjr d678771c66 Wallet: Sanitise -wallet parameter 2017-02-27 20:45:18 +00:00
Luke Dashjr 9756be382e Wallet/RPC: Use filename rather than CWallet pointer, for lockwallet RPCRunLater job name
The job name is logged, and could pose as an information leak to someone attacking the process, helping them counteract ASLR protections
2017-02-27 20:45:18 +00:00
Luke Dashjr 86be48a77c More tightly couple EnsureWalletIsAvailable with GetWalletForJSONRPCRequest where appropriate 2017-02-27 20:45:18 +00:00
Luke Dashjr a4356328e0 Move wallet RPC declarations to rpcwallet.h 2017-02-27 20:45:18 +00:00
Luke Dashjr ad1573472e RPC: Pass on JSONRPCRequest metadata (URI/user/etc) for "help" method 2017-02-27 20:45:18 +00:00
Luke Dashjr bf8a04a165 Reformat touched lines with C++11 2017-02-27 20:45:18 +00:00
Luke Dashjr 2e518e313b Move nWalletUnlockTime to CWallet::nRelockTime, and name timed task unique per CWallet 2017-02-27 20:45:17 +00:00
Luke Dashjr d77ad6d416 RPC: Do all wallet access through new GetWalletForJSONRPCRequest 2017-02-27 20:45:17 +00:00
Luke Dashjr eca550f250 RPC/Wallet: Pass CWallet as pointer to helper functions 2017-02-27 20:45:17 +00:00
Cory Fields d4ee7baef7 prevector: assert successful allocation 2017-02-27 14:52:15 -05:00
Alex Morcos ad727f4eaf [rpc] sendrawtransaction no longer bypasses minRelayTxFee
The prioritisetransaction API can always be used if a transaction needs to be submitted that bypasses minRelayTxFee.
2017-02-27 11:23:51 -05:00
Alex Morcos fe282acd76 [cleanup] Remove estimatePriority and estimateSmartPriority
Unused everywhere now except one test.
2017-02-27 11:23:51 -05:00
Alex Morcos 400b15147c [debug] Change -printpriority option
-printpriority output is now changed to only show the fee rate and hash of transactions included in a block by the mining code.
2017-02-27 11:23:50 -05:00
Alex Morcos 272b25a6a9 [mining] Remove -blockprioritysize.
Remove ability of mining code to fill part of a block with transactions sorted by coin age.
2017-02-27 11:23:50 -05:00
Alex Morcos 12839cdd56 [rpc] Remove estimatepriority and estimatesmartpriority.
The RPC calls were already deprecated.
2017-02-27 11:23:50 -05:00
MarcoFalke ddf58c7573 wallet: Remove sendfree
This removes the option from the wallet to not pay a fee on "small"
transactions which spend "old" inputs.

This code is no longer worth keeping around, as almost all miners
prefer not to include transactions which pay no fee at all.
2017-02-27 11:23:50 -05:00
Russell Yanofsky 306bd72157 Fix importmulti returning rescan errors for wrong keys
Bug was a missing ++i line in a new range for loop added in commit e2e2f4c
"Return errors from importmulti if complete rescans are not successful"
2017-02-27 07:38:51 -05:00
Wladimir J. van der Laan 75a109338f tests: Fix dangling pwalletMain pointer in wallet tests 2017-02-27 13:15:39 +01:00
Wladimir J. van der Laan 19cafc6239 test: Replace remaining sprintf with snprintf
Use of `sprintf` is seen as a red flag as many of its uses are insecure.
OpenBSD warns about it while compiling, and some modern platforms, e.g.
[cloudlibc from cloudabi](https://github.com/NuxiNL/cloudlibc) don't
even provide it anymore.

Although our uses of these functions are secure, it can't hurt to
replace them anyway. There are only 3 occurences left, all in the
tests.
2017-02-27 10:03:20 +01:00
Wladimir J. van der Laan 0a177148e7 uint256: replace sprintf with HexStr and reverse-iterator
Instead of calling sprintf for every byte, format the hex bytes
ourselves by help of HexStr and a reverse_iterator.
2017-02-27 10:02:45 +01:00
Pieter Wuille 277b472fb2 Run miner_tests with fixed options 2017-02-26 16:13:51 -08:00
Pieter Wuille 48faf0bf63 Abstract out BlockAssembler options 2017-02-26 16:13:17 -08:00
Marijn Stollenga 83ac719d34 Change bitcoin address in RPC helpaddress to an invalid address, so people don't accidentally send coins there (like I did). 2017-02-26 14:01:05 +01:00
Wladimir J. van der Laan 6206252e50
Merge #9847: Extra test vector for BIP32
30aedcb BIP32 extra test vector (Pieter Wuille)
2017-02-25 10:43:29 +01:00
Cory Fields c5f008a416 don't throw std::bad_alloc when out of memory. Instead, terminate immediately 2017-02-25 01:09:11 -05:00
Wladimir J. van der Laan f19afdbfb4
Merge #9612: [trivial] Rephrase the definition of difficulty.
dc222f8 Trivial: Rephrase the definition of difficulty in the code. (Karl-Johan Alm)
2017-02-24 12:48:56 +01:00
Wladimir J. van der Laan dd6e0d6301
Merge #9833: Trivial: fix comments referencing AppInit2
ef9f495 Trivial: fix comments referencing AppInit2 (Marko Bencun)
2017-02-24 10:53:32 +01:00
Wladimir J. van der Laan 00285cece8
Merge #9840: Update sendfrom RPC help to correct coin selection misconception
f81f0d0 Update sendfrom RPC help to correct coin selection misconception (Russell Yanofsky)
2017-02-24 10:22:04 +01:00
Karl-Johan Alm dc222f8f63
Trivial: Rephrase the definition of difficulty in the code. 2017-02-23 22:06:37 -08:00
Pieter Wuille 30aedcbdb4 BIP32 extra test vector 2017-02-23 17:59:52 -08:00
Marko Bencun ef9f495e93 Trivial: fix comments referencing AppInit2
It was refactored into multiple functions in
0cc8b6bc44.
2017-02-24 09:19:29 +09:00
Russell Yanofsky f81f0d0030 Update sendfrom RPC help to correct coin selection misconception 2017-02-23 13:44:12 -05:00
Wladimir J. van der Laan e68c266f3d
Merge #9789: build: add --enable-werror and warn on vla's
205830a build: add --enable-werror option (Cory Fields)
b602fe0 build: warn about variable length arrays (Cory Fields)
2017-02-23 10:48:46 +01:00
Marko Bencun 5b528d746c qt: clean up initialize/shutdown signals
- Change initializeResult(int) to initializeResult(bool) to avoid
   implicit type conversion.
 - Use EXIT_FAILURE and EXIT_SUCCESS instead of magic numbers.
 - Remove the argument from shutdownResult(int); it was called with a
   constant argument.
2017-02-23 17:21:39 +09:00
Cory Fields 205830a37b build: add --enable-werror option
This turns some compiler warnings into errors. Useful for c-i.
2017-02-23 01:06:04 -05:00
Russell Yanofsky 09fe346a4f Avoid -Wshadow warnings in wallet_tests
Warnings introduced by commit e2e2f4c "Return errors from importmulti if
complete rescans are not successful" and reported by Pavel Janík
<Pavel@Janik.cz> in https://github.com/bitcoin/bitcoin/pull/9773 and
https://github.com/bitcoin/bitcoin/pull/9827

wallet/test/wallet_tests.cpp: In member function ‘void wallet_tests::rescan::test_method()’:
wallet/test/wallet_tests.cpp:377:17: warning: declaration of ‘wallet’ shadows a global declaration [-Wshadow]
         CWallet wallet;
2017-02-22 14:11:44 -05:00
Wladimir J. van der Laan bed5b30a56
Merge #9711: [Trivial] Remove incorrect help message from gettxoutproof()
9949ebf [Trivial] Remove incorrect help message from gettxoutproof() (John Newbery)
2017-02-22 13:03:42 +01:00
Wladimir J. van der Laan 1efc99c4dc
Merge #9819: Remove harmless read of unusued priority estimates
bc8fd12 Remove harmless read of unusued priority estimates (Alex Morcos)
2017-02-22 13:02:10 +01:00
Wladimir J. van der Laan ba7220b5e8
Merge #9773: Return errors from importmulti if complete rescans are not successful
e2e2f4c Return errors from importmulti if complete rescans are not successful (Russell Yanofsky)
2017-02-22 12:43:11 +01:00
Marko Bencun 4b183d33f3 Remove block file location upgrade code
An effort to reduce the size of AppInitMain().

The removed code upgrades the location of the block files when
upgrading to 0.8. 0.8 seems to be the oldest version still in use.
2017-02-22 20:32:47 +09:00
Wladimir J. van der Laan a8c5751038
Merge #9801: Removed redundant parameter from mempool.PrioritiseTransaction
eaea2bb Removed redundant parameter from mempool.PrioritiseTransaction (gubatron)
2017-02-22 12:18:38 +01:00
Wladimir J. van der Laan 5b583efaa7
Merge #9805: Add seed.btc.petertodd.org to mainnet DNS seeds
3b4dd2a Add seed.btc.petertodd.org to mainnet DNS seeds (Peter Todd)
2017-02-22 12:14:37 +01:00
Wladimir J. van der Laan 92dd6c8dfd
Merge #9815: Trivial: use EXIT_ codes instead of magic numbers
a87d02a use EXIT_ codes instead of magic numbers (Marko Bencun)
2017-02-22 11:48:45 +01:00
Wladimir J. van der Laan 7e6dcd9995 random: Add fallback if getrandom syscall not available
If the code was compiled with newer (>=3.17) kernel headers but executed
on a system without the system call, every use of random would crash the
program. Add a fallback for that case.
2017-02-22 08:51:26 +01:00
Wladimir J. van der Laan 7cad849299 sanity: Move OS random to sanity check function
Move the OS random test to a sanity check function that is called every
time bitcoind is initialized.

Keep `src/test/random_tests.cpp` for the case that later random tests
are added, and keep a rudimentary test that just calls the sanity check.
2017-02-22 08:02:50 +01:00
Wladimir J. van der Laan aa09ccbb74 squashme: comment that NUM_OS_RANDOM_BYTES should not be changed lightly 2017-02-22 07:38:42 +01:00
gubatron eaea2bbb41 Removed redundant parameter from mempool.PrioritiseTransaction
(Also made the `const uint256 hash` parameter a `const uint256& hash` as suggested by @sdaftuar)
2017-02-21 20:44:23 -07:00
Wladimir J. van der Laan 224e6eb089 util: Specific GetOSRandom for Linux/FreeBSD/OpenBSD
These are available in sandboxes without access to files or
devices. Also [they are safer and more straightforward](https://en.wikipedia.org/wiki/Entropy-supplying_system_calls)
to use than `/dev/urandom` as reading from a file has quite a few edge
cases:

- Linux: `getrandom(buf, buflen, 0)`. [getrandom(2)](http://man7.org/linux/man-pages/man2/getrandom.2.html)
  was introduced in version 3.17 of the Linux kernel.
- OpenBSD: `getentropy(buf, buflen)`. The [getentropy(2)](http://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man2/getentropy.2)
  function appeared in OpenBSD 5.6.
- FreeBSD and NetBSD: `sysctl(KERN_ARND)`. Not sure when this was added
  but it has existed for quite a while.

Alternatives:

- Linux has sysctl `CTL_KERN` / `KERN_RANDOM` / `RANDOM_UUID`
  which gives 16 bytes of randomness. This may be available
  on older kernels, however [sysctl is deprecated on Linux](https://lwn.net/Articles/605392/)
  and even removed in some distros so we shouldn't use it.

Add tests for `GetOSRand()`:

- Test that no error happens (otherwise `RandFailure()` which aborts)
- Test that all 32 bytes are overwritten (initialize with zeros, try multiple times)

Discussion:

- When to use these? Currently they are always used when available.
  Another option would be to use them only when `/dev/urandom` is not
  available. But this would mean these code paths receive less testing,
  and I'm not sure there is any reason to prefer `/dev/urandom`.

Closes: #9676
2017-02-21 20:57:34 +01:00
Alex Morcos bc8fd12289 Remove harmless read of unusued priority estimates 2017-02-21 11:12:44 -05:00
Wladimir J. van der Laan 5f0556d032
Merge #9727: Remove fallbacks for boost_filesystem < v3
056aba2 Remove fallbacks for boost_filesystem < v3 (Wladimir J. van der Laan)
2017-02-21 17:08:37 +01:00
Jonas Schnelli 312c4f1057
Fix segfault crash when shutdown the GUI in disablewallet mode 2017-02-21 14:37:20 +01:00
Wladimir J. van der Laan 8ad31f9aa3
Merge #9798: Fix Issue #9775 (Check returned value of fopen)
40f11f8 Fix for issue #9775. Added check for open() returning a NULL pointer. (kirit93)
2017-02-21 14:32:58 +01:00
Marko Bencun a87d02adad use EXIT_ codes instead of magic numbers
To be consistent with other exit() calls.
2017-02-21 17:17:24 +09:00
kirit93 40f11f8872 Fix for issue #9775. Added check for open() returning a NULL pointer. 2017-02-20 23:53:18 +05:30
Pavel Janík 171fc91f06 Read/write mempool.dat as a binary.
mempool.dat is a binary file and thus it should be read/written as such.

Fixes #9810.
2017-02-20 18:14:06 +01:00
Wladimir J. van der Laan 7639d38f14
Merge #9726: netbase: Do not print an error on connection timeouts through proxy
3ddfe29 netbase: Do not print an error on connection timeouts through proxy (Wladimir J. van der Laan)
13f6085 netbase: Make InterruptibleRecv return an error code instead of bool (Wladimir J. van der Laan)
2017-02-20 17:49:51 +01:00
Wladimir J. van der Laan aa791e2911
Merge #9619: Bugfix: RPC/Mining: GBT should return 1 MB sizelimit before segwit activates
279f944 QA: Test GBT size/weight limit values (Luke Dashjr)
9fc7f0b Bugfix: RPC/Mining: GBT should return 1 MB sizelimit before segwit activates (Luke Dashjr)
2017-02-20 17:32:02 +01:00
Wladimir J. van der Laan 2dad02232a
Merge #9760: [wallet] Remove importmulti always-true check
ec1267f [wallet] Remove importmulti always-true check (Russell Yanofsky)
2017-02-20 17:30:07 +01:00
Wladimir J. van der Laan 1a9fd5cb9d
Merge #9724: Qt/Intro: Add explanation of IBD process
f6d18f5 Qt/Intro: Explain a bit more what will happen first time (Luke Dashjr)
50c5657 Qt/Intro: Storage shouldn't grow significantly with pruning enabled (Luke Dashjr)
9adb694 Qt/Intro: Move sizeWarningLabel text into C++ code (Luke Dashjr)
2017-02-20 17:26:15 +01:00
Johnathan Corgan f36bdf02ce Enable host lookups for -proxy and -onion parameters
* Extends -dns parameter (via fNameLookup) to control these two new
  parameters in addition to -addnode, -connect, and -seednode

* Moves fNameLookup assignment earlier as needed

* Changes -proxy and -onion to use Lookup() instead of LookupNumeric()
2017-02-20 00:06:27 -06:00
Peter Todd 3b4dd2a676
Add seed.btc.petertodd.org to mainnet DNS seeds 2017-02-19 16:11:54 -05:00
Wladimir J. van der Laan 1f9e904f45
Merge #9791: Avoid VLA in hash.h
5c8fd50 Avoid VLA in hash.h (Pieter Wuille)
2017-02-19 13:28:30 +01:00
NicolasDorier 4d51e9be16 Assert ConnectBlock block and pIndex are the same block 2017-02-19 14:02:45 +09:00
MarcoFalke aa5fa642b0
Merge #9696: [trivial] Fix recently introduced typos in comments
0c9b9b7 [trivial] Fix recently introduced typos in comments (practicalswift)
2017-02-18 12:13:09 +01:00
Pieter Wuille 5c8fd50811 Avoid VLA in hash.h 2017-02-17 15:28:28 -08:00
Wladimir J. van der Laan 12f46fa7d8
Merge #9786: boost: remove iostreams includes
3301587 boost: remove iostreams includes (Cory Fields)
2017-02-17 21:48:37 +01:00
Cory Fields 3301587dc5 boost: remove iostreams includes
They're unused and produce nasty deprecation warnings
2017-02-17 15:06:09 -05:00
Pieter Wuille c801c82e25 Move BIP70_MAX_PAYMENTREQUEST_SIZE to header 2017-02-17 11:54:32 -08:00
Pieter Wuille 914fad155d Make KEY_SIZE a compile-time constant 2017-02-17 11:42:22 -08:00
Russell Yanofsky e2e2f4c856 Return errors from importmulti if complete rescans are not successful 2017-02-17 14:12:31 -05:00
Wladimir J. van der Laan f87e8f5392
build: bump version to 0.14.99
Now that 0.14 branch has been split off, master is 0.14.99 (pre-0.15).

Also clean out release notes.
2017-02-17 17:27:18 +01:00
Russell Yanofsky ec1267f13b [wallet] Remove importmulti always-true check
Remove "nLowestTimestamp <= chainActive.Tip()->GetBlockTimeMax()" check from
importmulti, which is always true because nLowestTimestamp is set to the
minimum of the most recent block time and all the imported key timestamps,
which is necessarily lower than the maximum block time.
2017-02-17 07:00:41 -05:00
Wladimir J. van der Laan 9828f9a996
Merge #9761: Use 2 hour grace period for key timestamps in importmulti rescans
e662af3 Use 2 hour grace period for key timestamps in importmulti rescans (Russell Yanofsky)
38d3e9e [qa] Extend import-rescan.py to test imports on pruned nodes. (Russell Yanofsky)
c28583d [qa] Extend import-rescan.py to test specific key timestamps (Russell Yanofsky)
8be0866 [qa] Simplify import-rescan.py (Russell Yanofsky)
2017-02-17 12:53:41 +01:00
Wladimir J. van der Laan ad168ef4e3
Merge #9778: Add two hour buffer to manual pruning
91fb506 Add two hour buffer to manual pruning (Alex Morcos)
2017-02-17 12:51:08 +01:00
Wladimir J. van der Laan 3c02b95740
Merge #9779: Update nMinimumChainWork and defaultAssumeValid.
3f78e46 Update nMinimumChainWork and defaultAssumeValid. (Gregory Maxwell)
2017-02-17 12:41:49 +01:00
Luke Dashjr 7abe7bbf61
Qt/Send: Give fallback fee a reasonable indent 2017-02-17 11:00:52 +01:00
Luke Dashjr 3e4d7bfcb7
Qt/Send: Figure a decent warning colour from theme 2017-02-17 11:00:46 +01:00
Wladimir J. van der Laan 8dee822177
Merge #9777: Handle unusual maxsigcachesize gracefully
55c403b Ensure `-maxsigcachesize` is in valid range (John Newbery)
2017-02-17 09:05:48 +01:00
John Newbery 55c403b8fe Ensure -maxsigcachesize is in valid range
- If the -maxsigcachesize parameter is set to zero, setup a minimum sized
sigcache (2 elements) rather than segfaulting.
- Handle maxsigcachesize being negative
- Handle maxsigcachesize being too large
2017-02-17 09:04:37 +01:00
Alex Morcos 91fb506e0a Add two hour buffer to manual pruning 2017-02-16 17:47:56 -05:00
Gregory Maxwell 3f78e460ba Update nMinimumChainWork and defaultAssumeValid. 2017-02-16 19:31:03 +00:00
Russell Yanofsky e662af3583 Use 2 hour grace period for key timestamps in importmulti rescans
Gregory Maxwell <greg@xiph.org> pointed out the lack of grace period in
https://github.com/bitcoin/bitcoin/pull/9490#issue-199407998.

The importwallet RPC which uses key timestamps in a similar way already has a 2
hour grace period.
2017-02-16 09:05:55 -05:00
Wladimir J. van der Laan 8743320d6c
Merge #9763: [Trivial] Update comments referencing main.cpp
00e623d [Trivial] Update comments referencing main.cpp (CryptAxe)
2017-02-16 14:01:14 +01:00
CryptAxe 00e623d0b8 [Trivial] Update comments referencing main.cpp 2017-02-16 13:52:38 +01:00
Wladimir J. van der Laan e43a58514d
Merge #9771: Add missing cs_wallet lock that triggers new lock held assertion
07afcd6 Add missing cs_wallet lock that triggers new lock held assertion (Russell Yanofsky)
2017-02-16 10:30:33 +01:00
Wladimir J. van der Laan f8af89a918
Merge #9764: wallet: Prevent "overrides a member function but is not marked 'override'" warnings
6c5427d wallet: Prevent "overrides a member function but is not marked 'override'" warnings (Wladimir J. van der Laan)
2017-02-16 10:24:24 +01:00
Wladimir J. van der Laan 1e92e041dd
Merge #9765: Harden against mistakes handling invalid blocks
ba803ef Harden against mistakes handling invalid blocks (Suhas Daftuar)
2017-02-16 10:23:41 +01:00
Jeremy Rubin 96c7f2c345 Add CheckQueue Tests 2017-02-16 01:37:53 -05:00
Russell Yanofsky 07afcd6379 Add missing cs_wallet lock that triggers new lock held assertion
A new AssertLockHeld(cs_wallet) call was added in commit a58370e
"Dedup nTimeFirstKey update logic" (part of PR #9108).

The lock held assertion will fail when loading prexisting wallets files from
before the #9108 merge that have watch-only keys.
2017-02-15 17:01:30 -05:00
Wladimir J. van der Laan 7a93af8340
Merge #9756: Return error when importmulti called with invalid address.
9acf25c Return error when importmulti called with invalid address. (Russell Yanofsky)
2017-02-15 16:29:16 +01:00