Commit graph

9185 commits

Author SHA1 Message Date
John Newbery f5efe82a83 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.

Github-Pull: #9853
Rebased-From: dab804c18a
2017-06-05 19:01:16 +00:00
John Newbery 4943d7a9fe 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.

Github-Pull: #9853
Rebased-From: a012087667
2017-06-05 19:01:16 +00:00
John Newbery 18c109ddb1 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.

Github-Pull: #9853
Rebased-From: 960bc7f778
2017-06-05 19:01:16 +00:00
John Newbery fe51c8924e 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.

Github-Pull: #9853
Rebased-From: c1190963b3
2017-06-05 19:01:16 +00:00
John Newbery 3ad00b4b32 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.

Github-Pull: #9853
Rebased-From: 6d07c62322
2017-06-05 19:01:16 +00:00
practicalswift ef810c4cd4 [trivial] Fix a typo (introduced two days ago) in the default fee warning
Github-Pull: #10008
Rebased-From: a3ca43bb32
2017-06-03 21:19:05 +00:00
Wladimir J. van der Laan 4a41de4585
build: bump version to 0.14.2 2017-06-02 07:39:56 +02:00
Cory Fields 9e3ad50078
net: only enforce the services required to connect
also once half of all outgoing nodes have our preferred flags, require only
minimal flags from the rest.

Github-Pull: #10441
Rebased-From: b6fbfc2282
2017-06-01 13:26:12 +02:00
Gregory Sanders 18476423fb
[Wallet] unset change position when there is no change on exact match 2017-05-31 10:57:16 +02:00
Cory Fields ae479bc45b
build: fix bitcoin-config.h regeneration after touching build files
This was a long-standing and annoying problem.

If autogen.sh was not manually run after touching configure.ac,
bitcoin-config.h would not be properly regenerated. This causes very subtle
problems when configure appears to enable a new value, but it does not end up
reflected in the build.
2017-05-31 10:54:19 +02:00
Jonas Schnelli 4bc99c3b28
Add missing <atomic> header in clientmodel.h 2017-05-31 10:53:47 +02:00
Jonas Schnelli 222f3775cf
Set both time/height header caches at the same time 2017-05-31 10:53:47 +02:00
Jonas Schnelli 7da133772d
Declare headers height/time cache mutable, re-set the methods const 2017-05-31 10:53:47 +02:00
Jonas Schnelli 9ac40e853c
Update the remaining blocks left in modaloverlay at init. 2017-05-31 10:53:47 +02:00
Jonas Schnelli 1e936d7e87
Reduce cs_main locks during modal overlay by adding an atomic cache 2017-05-31 10:53:46 +02:00
Matt Corallo 0aee4a132b
Check interruptNet during dnsseed lookups 2017-05-31 10:52:56 +02:00
Russell Yanofsky 321419bc06
Fix importwallet edge case rescan bug
Start importwallet rescans at the first block with timestamp greater or equal
to the wallet birthday instead of the last block with timestamp less or equal.
This fixes an edge case bug where importwallet could fail to start the rescan
early enough if there are blocks with decreasing timestamps or multiple blocks
with the same timestamp.

Github-Pull: #10410
Rebased-From: 2a8e35a11d
2017-05-23 17:09:42 +02:00
Alex Morcos 37a8fc54d4
Populate services in GetLocalAddress
Previously if we didn't have any local addresses, GetLocalAddress would return
0.0.0.0 and then we'd swap in a peer's notion of our address in AdvertiseLocal,
but then nServices would never get set.

Github-Pull: #10424
Rebased-From: 307013469f
2017-05-22 12:56:13 +02:00
Warren Togami 51c787dfb4
Clarify importprivkey help text with example of blank label without rescan
Occasionally I waste a lot of time not remembering that the second parameter to importprivkey must be blank if you intend to stop rescan with "false" as the third parameter.

Github-Pull: #10207
Rebased-From: c9e31c36ff
2017-04-20 08:18:50 +02:00
Suhas Daftuar d28d583820 Bugfix: PrioritiseTransaction updates the mempool tx counter
The mempool's nTransactionsUpdated is used by getblocktemplate
to trigger new invocations of CreateNewBlock().

Github-Pull: #10196
Rebased-From: 909306cde3770ed7019e7b635e24cedbd9de66ce
2017-04-19 20:10:02 +00:00
Wladimir J. van der Laan 348a71701d
qt: translations update pre-rc2 2017-04-14 12:25:51 +02:00
Cory Fields 30fa231011
net: define NodeId as an int64_t
This should make occurances of NodeId wrapping essentially impossible for
real-world usage.

Github-Pull: #10176
Rebased-From: c851be4b25
2017-04-14 10:35:49 +02:00
John Newbery 3c796026e5
[rpc] rename disconnectnode argument
Github-Pull: #10204
Rebased-From: 883154cbcb
2017-04-14 10:19:06 +02:00
Wladimir J. van der Laan 47d24c85b7
Bump version to 0.14.1 2017-04-05 09:12:36 +02:00
Suhas Daftuar ea060c7495
Bugfix: ancestor modifed fees were incorrect for descendants
If prioritisetransaction was called for a tx with in-mempool
descendants, the modified ancestor fee values for those descendants was
incorrect.

Github-Pull: #10144
Rebased-From: 9bef02e365
2017-04-05 08:37:12 +02:00
Alex Morcos 0e5133cb2e
Make threshold for flushing more conservative.
Always leave a reasonable buffer of 50MB for usage from newly connected block (once over 50%) and increase the high water mark buffer to 200MB.

Github-Pull: #10133
Rebased-From: 1b55e07b7a
2017-04-05 08:23:02 +02:00
Alex Morcos d6867689d1
Lower default memory footprint slightly
Github-Pull: #10133
Rebased-From: f33afd3b2b
2017-04-05 08:23:01 +02:00
Alex Morcos ab864d3e49
Make pcoinsTip memory calculations consistent
Since we are more accurately measuring pcoinsTip peak usage at twice the current in dynamic usage, it makes sense to double the default (this will lead to the same effective usage and peak usage as previously).
We should also double the buffer used to avoid flushing if above 90% but still sufficient space remaining.

Github-Pull: #10133
Rebased-From: 5b95a190e8
2017-04-05 08:23:01 +02:00
Gregory Maxwell a44a6a15f9
Check transaction count early in submitblock.
There is no point in even hashing a submitted block which doesn't have
 a coinbase transaction.

This also results in more useful error reporting on corrupted input.

Thanks to rawodb for the bug report.

Github-Pull: #10146
Rebased-From: 4f15ea102d
2017-04-04 09:01:03 +02:00
Gregory Maxwell 2fea10ad03
Make GetWitnessCommitmentIndex callable on blocks without a coinbase txn.
This isn't actually needed anywhere, but it's less brittle.

Github-Pull: #10146
Rebased-From: ada0caa165
2017-04-04 09:01:03 +02:00
practicalswift f15268db3b
[rpc] Remove auth cookie on shutdown
Accidentally removed in 40b556d374

Github-Pull: #10139
Rebased-From: 4b87973c32
2017-04-03 08:54:53 +02:00
Pieter Wuille 0b5e162b84
Compensate for memory peak at flush time
Github-Pull: #10126
Rebased-From: 7228ce853d
2017-03-31 12:07:18 +02:00
Wladimir J. van der Laan fa6b5fc1cc
Merge #10127: [0.14 backport] Mining: Prevent slowdown in CreateNewBlock on large mempools
a296c60 Update benchmarking with package statistics (Suhas Daftuar)
10028fb Add benchmarking for CreateNewBlock (Suhas Daftuar)
b5c3440 Mining: return early when block is almost full (Suhas Daftuar)

Tree-SHA512: 7c39d03a778abe00412743958981a1a55d22fc1843c9a3aef7a56506622e6f5d6b8962c586a339b6031e1ee4815d6981351cf527e8fbe5b265824c81d6c7199d
2017-03-31 12:06:56 +02:00
Wladimir J. van der Laan e4c9a90fe9
util: Work around (virtual) memory exhaustion on 32-bit w/ glibc
glibc-specific: On 32-bit systems set the number of arenas to 1. By
default, since glibc 2.10, the C library will create up to two heap
arenas per core. This is known to cause excessive virtual address space
usage in our usage. Work around it by setting the maximum number of
arenas to 1.

Github-Pull: #10120
Rebased-From: 625488ace5
2017-03-31 11:48:59 +02:00
John Newbery f59e3dfc59
Add tests for bitcoin-tx input checking
Github-Pull: #10130
Rebased-From: 19ecd1e2e1
2017-03-31 11:47:50 +02:00
John Newbery ecc523288c
Check stderr when testing bitcoin-tx
Github-Pull: #10130
Rebased-From: 21704f6334
2017-03-31 11:47:50 +02:00
Awemany 04c21afcdf
bitcoin-tx: Fix missing range check
The number of arguments is not checked MutateTxAddOutAddr(..), meaning
that

> ./bitcoin-tx -create outaddr=

accessed the vStrInputParts vector beyond its bounds.

This also includes work by jnewbery to check the inputs for
MutateTxAddPubKey()

Github-Pull: #10130
Rebased-From: eb66bf9bdd
2017-03-31 11:47:50 +02:00
Suhas Daftuar a296c6009f Update benchmarking with package statistics
Github-Pull: #9959
Rebased-From: 011124a2b2
2017-03-30 15:18:02 -04:00
Suhas Daftuar 10028fb555 Add benchmarking for CreateNewBlock
Github-Pull: #9959
Rebased-From: 42cd8c890f
2017-03-30 15:06:14 -04:00
Suhas Daftuar b5c3440b05 Mining: return early when block is almost full
Github-Pull: #9959
Rebased-From: eed816af6c
2017-03-30 15:05:33 -04:00
MarcoFalke 142fbb2fec rpc: Rename first named arg of createrawtransaction
Github-Pull: #10084
Rebased-From: fa55853219
2017-03-27 23:44:08 +02:00
Suhas Daftuar fc3d7db580 Optimize GetWitnessHash() for non-segwit transactions
Github-Pull: #9912
Rebased-From: 02c57b521a
2017-03-27 23:44:08 +02:00
Andrew Chow ddc2dd1612 Ensure an item exists on the rpcconsole stack before adding
Ensures that there is an item on the rpcconsole stack before adding something to the current stack so that a segmentation fault does not occur.

Github-Pull: #10060
Rebased-From: 4df76e270c
2017-03-27 23:08:24 +02:00
James Evans 4d8e66017f Trivial: Fix typo in help getrawtransaction RPC
Github-Pull: #10037
Rebased-From: 05a9f22358
2017-03-27 23:07:56 +02:00
Wladimir J. van der Laan ccb47bf830
Merge #10006: [0.14 backport] Don't require segwit in getblocktemplate for segwit signalling or mining
2cd2cd5 Test transaction selection when gbt called without segwit support (Suhas Daftuar)
569596c Don't require segwit in getblocktemplate for segwit signalling or mining (Suhas Daftuar)

Tree-SHA512: bf2672287713e5adc7e851791207e17490679f941d0b9ed38467ffede3aa3000d229151b8ae54323fc8037e0a8569b2fd910ec19f034fb85d9142289648793c3
2017-03-18 11:39:04 +01:00
Matt Corallo 4e2502bb51 Add missing braces in semaphore posts in net
Github-Pull: #9953
Rebased-From: 819b513a54
2017-03-17 14:56:57 -07:00
Matt Corallo d2548a4f97 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.

Github-Pull: #9953
Rebased-From: e007b243c4
2017-03-17 14:55:43 -07:00
Suhas Daftuar 569596cc51 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.

Github-Pull: #9955
Rebased-From: abe7b3d3ab
2017-03-16 10:43:54 -04:00
Russell Yanofsky ad24256a65
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"

Github-Pull: #9829
Rebased-From: 306bd72157
2017-02-28 13:53:28 +01:00
Wladimir J. van der Laan 8d2d08efaa
qt: pre-rc3 translations update 2017-02-28 12:49:29 +01:00
Pieter Wuille 1825a03f81
Avoid VLA in hash.h
Github-Pull: #9791
Rebased-From: 5c8fd50811
2017-02-28 12:48:19 +01:00
Marijn Stollenga 289204fbe0
Change bitcoin address in RPC helpaddress to an invalid address, so people don't accidentally send coins there (like I did).
Github-Pull: #9865
Rebased-From: 83ac719d34
2017-02-28 12:01:06 +01:00
Russell Yanofsky 08e0690f3f
Update sendfrom RPC help to correct coin selection misconception
Github-Pull: #9840
Rebased-From: f81f0d0030
2017-02-28 11:41:58 +01:00
Cory Fields 775cf54d0e
prevector: assert successful allocation
Github-Pull: #9856
Rebased-From: d4ee7baef7
2017-02-28 11:40:50 +01:00
Cory Fields 69832aaad5
don't throw std::bad_alloc when out of memory. Instead, terminate immediately
Github-Pull: #9856
Rebased-From: c5f008a416
2017-02-28 11:40:50 +01:00
Wladimir J. van der Laan 50953c2aad
tests: Fix dangling pwalletMain pointer in wallet tests
Github-Pull: #9875
Rebased-From: 75a109338f
2017-02-28 11:40:50 +01:00
Wladimir J. van der Laan 847e3753a6
qt: pre-rc2 translations update 2017-02-23 20:31:57 +01:00
Cory Fields 05e906dbc6
build: add --enable-werror option
This turns some compiler warnings into errors. Useful for c-i.

Github-Pull: #9789
Rebased-From: 205830a37b
2017-02-23 10:49:07 +01:00
John Newbery 9d3f9d2a59
[Trivial] Remove incorrect help message from gettxoutproof()
Github-Pull: #9711
Rebased-From: 9949ebfa6a
2017-02-22 13:03:55 +01:00
Russell Yanofsky 9072395e5f
Return errors from importmulti if complete rescans are not successful
Github-Pull: #9773
Rebased-From: e2e2f4c856
2017-02-22 12:45:43 +01:00
Jonas Schnelli 7d75a5a93c
Fix segfault crash when shutdown the GUI in disablewallet mode
Github-Pull: #9817
Rebased-From: 312c4f1057
2017-02-21 15:14:17 +01:00
kirit93 e22c0671c7
Fix for issue #9775. Added check for open() returning a NULL pointer.
Github-Pull: #9798
Rebased-From: 40f11f8872
2017-02-21 14:33:34 +01:00
Pavel Janík 3972a8efb2
Read/write mempool.dat as a binary.
mempool.dat is a binary file and thus it should be read/written as such.

Fixes #9810.

Github-Pull: #9813
Rebased-From: 171fc91f06
2017-02-21 12:35:38 +01:00
Luke Dashjr 6552729f38
Bugfix: RPC/Mining: GBT should return 1 MB sizelimit before segwit activates
Github-Pull: #9619
Rebased-From: 9fc7f0bce9
2017-02-20 17:32:59 +01:00
Russell Yanofsky 40c754cb38
[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.

Github-Pull: #9760
Rebased-From: ec1267f13b
2017-02-20 17:30:26 +01:00
Cory Fields 2afefeade6
boost: remove iostreams includes
They're unused and produce nasty deprecation warnings

Github-Pull: #9786
Rebased-From: 3301587dc5
2017-02-17 21:50:30 +01:00
Pieter Wuille 973e345f7f
Move BIP70_MAX_PAYMENTREQUEST_SIZE to header
Github-Pull: #9785
Rebased-From: c801c82e25
2017-02-17 21:50:22 +01:00
Pieter Wuille f873564231
Make KEY_SIZE a compile-time constant
Github-Pull: #9785
Rebased-From: 914fad155d
2017-02-17 21:50:14 +01:00
Wladimir J. van der Laan f68e4414d7
qt: pre-rc1 translations update 2017-02-17 17:43:06 +01:00
Wladimir J. van der Laan bc69f34b35
build: bump version to 0.14.0 2017-02-17 17:24:00 +01: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
Wladimir J. van der Laan 476cc47da0
Merge #9758: Selectively suppress deprecation warnings
4b6cccc Selectively suppress deprecation warnings (Jonas Schnelli)
2017-02-15 15:08:59 +01:00
Suhas Daftuar ba803efb68 Harden against mistakes handling invalid blocks
Fixes a bug in AcceptBlock() in invoking CheckBlock() with incorrect
arguments, and restores a call to CheckBlock() from ProcessNewBlock()
as belt-and-suspenders.

Updates the (overspecified) tests to match behavior.
2017-02-15 08:17:57 -05:00
Wladimir J. van der Laan 6c5427d24c wallet: Prevent "overrides a member function but is not marked 'override'" warnings
Because it is used inconsistently at least version 5.4.0 of g++ to
complains about methods that don't use override. There is two ways to go
about this: remove override from the methods having it, or add it to the
methods missing it. I chose the second.
2017-02-15 11:31:28 +01:00
Wladimir J. van der Laan d8e8b06bd0
Merge #9108: Use importmulti timestamp when importing watch only keys (on top of #9682)
a80f98b Use importmulti timestamp when importing watch only keys (Russell Yanofsky)
a58370e Dedup nTimeFirstKey update logic (Russell Yanofsky)
2017-02-15 11:13:48 +01:00
Wladimir J. van der Laan 4c69d683f2
Merge #9553: Use z = std::max(x - y, 0) instead of z = x - y; if (z < 0) z = 0;
a47da4b Use z = std::max(x - y, 0); instead of z = x - y; if (z < 0) z = 0; (practicalswift)
2017-02-15 09:27:47 +01:00
Jonas Schnelli a441db01b5
Merge #9755: Bugfix: Qt/Options: Restore persistent "restart required" notice
0b4f273 Bugfix: Qt/Options: Restore persistent "restart required" notice (Luke Dashjr)
2017-02-14 15:57:02 +01:00
Wladimir J. van der Laan e87ce95fbd
Merge #9720: net: fix banning and disallow sending messages before receiving verack
d943491 qa: add a test to detect leaky p2p messages (Cory Fields)
8650bbb qa: Expose on-connection to mininode listeners (Matt Corallo)
5b5e4f8 qa: mininode learns when a socket connects, not its first action (Matt Corallo)
cbfc5a6 net: require a verack before responding to anything else (Cory Fields)
8502e7a net: parse reject earlier (Cory Fields)
c45b9fb net: correctly ban before the handshake is complete (Cory Fields)
2017-02-14 14:42:29 +01:00
Wladimir J. van der Laan b08656e343
Merge #9715: Disconnect peers which we do not receive VERACKs from within 60 sec
66f861a Add a test for P2P inactivity timeouts (Matt Corallo)
b436f92 qa: Expose on-connection to mininode listeners (Matt Corallo)
8aaba7a qa: mininode learns when a socket connects, not its first action (Matt Corallo)
2cbd119 Disconnect peers which we do not receive VERACKs from within 60 sec (Matt Corallo)
2017-02-14 14:35:15 +01:00
Wladimir J. van der Laan edc9e63c57
Merge #9682: Require timestamps for importmulti keys
266a811 Use MTP for importmulti "now" timestamps (Russell Yanofsky)
3cf9917 Add test to check new importmulti "now" value (Russell Yanofsky)
442887f Require timestamps for importmulti keys (Russell Yanofsky)
2017-02-14 14:32:22 +01:00
Jonas Schnelli 4b6ccccc16
Selectively suppress deprecation warnings 2017-02-14 13:50:57 +01:00
Wladimir J. van der Laan ec66d06e6e
Merge #9735: devtools: Handle Qt formatting characters edge-case in update-translations.py
7179e7c qt: Periodic translations update (Wladimir J. van der Laan)
5e903a5 devtools: Handle Qt formatting characters edge-case in update-translations.py (Wladimir J. van der Laan)
2017-02-14 12:21:34 +01:00
Cory Fields cbfc5a6728 net: require a verack before responding to anything else
7a8c251901 made this logic hard to follow. After that change, messages would
not be sent to a peer via SendMessages() before the handshake was complete, but
messages could still be sent as a response to an incoming message.

For example, if a peer had not yet sent a verack, we wouldn't notify it about
new blocks, but we would respond to a PING with a PONG.

This change makes the behavior straightforward: until we've received a verack,
never send any message other than version/verack/reject.

The behavior until a VERACK is received has always been undefined, this change
just tightens our policy.

This also makes testing much easier, because we can now connect but not send
version/verack, and anything sent to us is an error.
2017-02-13 18:55:35 -05:00
Cory Fields 8502e7acbe net: parse reject earlier
Prior to this change, all messages were ignored until a VERSION message was
received, as well as possibly incurring a ban score.

Since REJECT messages can be sent at any time (including as a response to a bad
VERSION message), make sure to always parse them.

Moving this parsing up keeps it from being caught in the
if (pfrom->nVersion == 0) check below.
2017-02-13 18:55:35 -05:00
Cory Fields c45b9fb54c net: correctly ban before the handshake is complete
7a8c251901 made a change to avoid getting into SendMessages() until the
version handshake (VERSION + VERACK) is complete. That was done to avoid
leaking out messages to nodes who could connect, but never bothered sending
us their version/verack.

Unfortunately, the ban tally and possible disconnect are done as part of
SendMessages(). So after 7a8c251901, if a peer managed to do something
bannable before completing the handshake (say send 100 non-version messages
before their version), they wouldn't actually end up getting
disconnected/banned. That's fixed here by checking the banscore as part of
ProcessMessages() in addition to SendMessages().
2017-02-13 18:55:34 -05:00
Russell Yanofsky 9acf25cc01 Return error when importmulti called with invalid address.
Lack of error checking noticed by Alex Morcos <morcos@chaincode.com>
2017-02-13 17:54:51 -05:00
Luke Dashjr 0b4f273e9c Bugfix: Qt/Options: Restore persistent "restart required" notice 2017-02-13 22:50:16 +00:00
Wladimir J. van der Laan d978c41e1e
Merge #9736: Pre-0.14.0 hardcoded seeds update
a60677e Pre-0.14.0 hardcoded seeds update (Wladimir J. van der Laan)
bfa9393 contrib/seeds: Update PATTERN_AGENT (Wladimir J. van der Laan)
4dfac2c Update seeds tooling to Python 3 (Wladimir J. van der Laan)
2017-02-11 08:46:10 +01:00
Russell Yanofsky a80f98b1c7 Use importmulti timestamp when importing watch only keys
When importing a watch-only address over importmulti with a specific timestamp,
the wallet's nTimeFirstKey is currently set to 1. After this change, the
provided timestamp will be used and stored as metadata associated with
watch-only key. This can improve wallet performance because it can avoid the
need to scan the entire blockchain for watch only addresses when timestamps are
provided.

Also adds timestamp to validateaddress return value (needed for tests).

Fixes #9034.
2017-02-10 16:11:19 -05:00
Russell Yanofsky a58370e6a2 Dedup nTimeFirstKey update logic
Also make nTimeFirstKey member variable private.

This is just a cleanup change, it doesn't change behavior in any significant
way.
2017-02-10 15:49:00 -05:00
Russell Yanofsky 266a8114cb Use MTP for importmulti "now" timestamps 2017-02-10 15:40:28 -05:00
Russell Yanofsky 3cf991756c Add test to check new importmulti "now" value
Easiest way to test this was to expose the timestamp via the validateaddress
RPC (which was already looking up and returning key metadata).
2017-02-10 15:40:28 -05:00
Russell Yanofsky 442887f27f Require timestamps for importmulti keys
Additionally, accept a "now" timestamp, to allow avoiding rescans for keys
which are known never to have been used.

Note that the behavior when "now" is specified is slightly different than the
previous behavior when no timestamp was specified at all. Previously, when no
timestamp was specified, it would avoid rescanning during the importmulti call,
but set the key's nCreateTime value to 1, which would not prevent future block
reads in later ScanForWalletTransactions calls. With this change, passing a
"now" timestamp will set the key's nCreateTime to the current block time
instead of 1.

Fixes #9491
2017-02-10 15:40:28 -05:00
Matt Corallo db2dc7a58c Move CNode::addrLocal access behind locked accessors 2017-02-10 11:32:41 -05:00
Matt Corallo 036073bf87 Move CNode::addrName accesses behind locked accessors 2017-02-10 11:32:41 -05:00
Matt Corallo d8f2b8a8c0 Make nTimeBestReceived atomic 2017-02-10 11:32:41 -05:00
Matt Corallo 22b4966a29 Move [clean|str]SubVer writes/copyStats into a lock 2017-02-10 11:32:41 -05:00
Matt Corallo 0f31872615 Make nServices atomic 2017-02-10 11:32:41 -05:00
Matt Corallo 96f42d8a12 Make nStartingHeight atomic 2017-02-10 11:32:40 -05:00
Matt Corallo 512731bed0 Access fRelayTxes with cs_filter lock in copyStats 2017-02-10 11:32:40 -05:00
Matt Corallo ae683c1b19 Avoid copying CNodeStats to make helgrind OK with buggy std::string 2017-02-10 11:32:40 -05:00
Matt Corallo 644f1234e2 Make nTimeConnected const in CNode 2017-02-10 11:32:40 -05:00
Cory Fields 321d0fc6b6 net: fix a few races. Credit @TheBlueMatt
These are (afaik) all long-standing races or concurrent accesses. Going
forward, we can clean these up so that they're not all individual atomic
accesses.

- Reintroduce cs_vRecv to guard receive-specific vars
- Lock vRecv/vSend for CNodeStats
- Make some vars atomic.
- Only set the connection time in CNode's constructor so that it doesn't change
2017-02-10 11:32:39 -05:00
Wladimir J. van der Laan 2447c1024e
Merge #9698: net: fix socket close race
9a0b784 net: add a lock around hSocket (Cory Fields)
45e2e08 net: rearrange so that socket accesses can be grouped together (Cory Fields)
2017-02-10 12:42:53 +01:00
Wladimir J. van der Laan a60677e394 Pre-0.14.0 hardcoded seeds update 2017-02-10 11:04:34 +01:00
Wladimir J. van der Laan 7179e7ca0d qt: Periodic translations update 2017-02-10 08:56:36 +00:00
Jonas Schnelli ca9955e706
Remove bitseed.xf2.org form the dns seed list 2017-02-09 11:28:01 +01:00
Wladimir J. van der Laan 36f9d3ae6d
Merge #9718: Qt/Intro: Various fixes
a9baa6d Bugfix: Qt/Intro: Pruned nodes never require *more* space (Luke Dashjr)
93ffba7 Bugfix: Qt/Intro: Chain state needs to be stored even with the full blockchain (Luke Dashjr)
c8cee26 Qt/Intro: Update block chain size (Luke Dashjr)
2017-02-09 07:30:10 +01:00
Luke Dashjr a9baa6d742 Bugfix: Qt/Intro: Pruned nodes never require *more* space 2017-02-08 19:16:00 +00:00
Luke Dashjr 93ffba7163 Bugfix: Qt/Intro: Chain state needs to be stored even with the full blockchain 2017-02-08 18:51:05 +00:00
Luke Dashjr c8cee26100 Qt/Intro: Update block chain size 2017-02-08 18:51:05 +00:00
Wladimir J. van der Laan dd163f5788
Merge #9674: Always enforce strict lock ordering (try or not)
618ee92 Further-enforce lockordering by enforcing directly after TRY_LOCKs (Matt Corallo)
2a962d4 Fixup style a bit by moving { to the same line as if statements (Matt Corallo)
8465631 Always enforce lock strict lock ordering (try or not) (Matt Corallo)
fd13eca Lock cs_vSend and cs_inventory in a consistent order even in TRY (Matt Corallo)
2017-02-08 14:46:43 +01:00
Matt Corallo 2cbd1196b7 Disconnect peers which we do not receive VERACKs from within 60 sec 2017-02-07 17:44:46 -05:00
Matt Corallo 618ee9249b Further-enforce lockordering by enforcing directly after TRY_LOCKs 2017-02-07 14:15:28 -05:00
Wladimir J. van der Laan 29c53289a9 bench: Fix initialization order in registration
The initialization order of global data structures in different
implementation units is undefined. Making use of this is essentially
gambling on what the linker does, the so-called [Static initialization
order fiasco](https://isocpp.org/wiki/faq/ctors#static-init-order).

In this case it apparently worked on Linux but failed on OpenBSD and
FreeBSD.

To create it on first use, make the registration structure local to
a function.

Fixes #8910.
2017-02-07 19:07:29 +01:00
practicalswift a47da4b6fe Use z = std::max(x - y, 0); instead of z = x - y; if (z < 0) z = 0; 2017-02-07 15:46:38 +01:00
Wladimir J. van der Laan b709fe7ffc
Merge #9532: Remove unused variables
90fd29b Remove unused int64_t nSinceLastSeen (practicalswift)
ac4a095 Remove unused Python variables (practicalswift)
2017-02-07 15:28:50 +01:00
Wladimir J. van der Laan 729de15b63
Merge #9604: [Trivial] add comment about setting peer as HB peer.
dd5b011 [Trivial] add comment about setting peer as HB peer. (John Newbery)
2017-02-07 13:03:57 +01:00
Cory Fields 9a0b784dea net: add a lock around hSocket 2017-02-06 14:48:50 -05:00
Cory Fields 45e2e08561 net: rearrange so that socket accesses can be grouped together 2017-02-06 14:48:50 -05:00
Wladimir J. van der Laan 02464da5e4
Merge #9227: Make nWalletDBUpdated atomic to avoid a potential race.
d63ff62 Make nWalletDBUpdated atomic to avoid a potential race. (Patrick Strateman)
2017-02-06 16:14:17 +01:00
Wladimir J. van der Laan 870cd2b58a
Merge #9378: [trivial] Add documentation for CWalletTx::fFromMe member.
39c77b0 Add documentation for CWalletTx::fFromMe member. (Russell Yanofsky)
2017-02-06 14:58:02 +01:00
Wladimir J. van der Laan 40f7e27d25
Merge #9650: Better handle invalid parameters to signrawtransaction
6dbfe08 [qa] test signrawtransaction merge with missing inputs (Matt Corallo)
ec4f7e4 [qa] Add second input to signrawtransaction test case (Matt Corallo)
691710a [qa] Test that decoderawtransaction throws with extra data appended (Matt Corallo)
922bea9 Better handle invalid parameters to signrawtransaction (Matt Corallo)
7ea0ad5 Fail in DecodeHexTx if there is extra data at the end (Matt Corallo)
2017-02-06 14:51:00 +01:00
Wladimir J. van der Laan 09e0c28f85
Merge #9659: Net: Turn some methods and params/variables const
0729102 Net: pass interruptMsgProc as const where possible (Jorge Timón)
fc7f2ff Net: Make CNetMsgMaker more const (Jorge Timón)
d45955f Net: CConnman: Make some methods const (Jorge Timón)
2017-02-06 14:34:53 +01:00
Wladimir J. van der Laan 986ba005ed
Merge #9651: Fix typos
5f62e3e Fix typos (practicalswift)
2017-02-06 14:20:05 +01:00
Wladimir J. van der Laan 8d6447ecf7
Merge #9673: Set correct metadata on bumpfee wallet transactions
4ec057d [wallet] Set correct metadata on bumpfee wallet transactions (Russell Yanofsky)
2017-02-06 12:48:55 +01:00
Wladimir J. van der Laan fc67cd22f8
Merge #9691: Init ECC context for test_bitcoin_fuzzy.
ac719c9 Init ECC context for test_bitcoin_fuzzy. (Gregory Maxwell)
2017-02-06 09:22:14 +01:00
Pieter Wuille 923dc447ea
Merge #9578: Add missing mempool lock for CalculateMemPoolAncestors
003cd60 Add missing mempool lock for CalculateMemPoolAncestors (Matt Corallo)
2017-02-05 12:08:08 -08:00
Gregory Maxwell ac719c936d Init ECC context for test_bitcoin_fuzzy.
This avoids calling things like pubkey_parse with a null context argument.
2017-02-05 17:37:13 +00:00
Matt Corallo 2a962d4540 Fixup style a bit by moving { to the same line as if statements 2017-02-04 16:44:05 -05:00
Wladimir J. van der Laan 7821db30e1
Merge #9671: Fix super-unlikely race introduced in 236618061a
885cfdd Fix super-unlikely race introduced in 236618061a (Matt Corallo)
2017-02-04 11:39:17 +01:00
Wladimir J. van der Laan 496691741d
Merge #9609: net: fix remaining net assertions
08bb6f4 net: log an error rather than asserting if send version is misused (Cory Fields)
7a8c251 net: Disallow sending messages until the version handshake is complete (Cory Fields)
12752af net: don't run callbacks on nodes that haven't completed the version handshake (Cory Fields)
2046617 net: deserialize the entire version message locally (Cory Fields)
80ff034 Dont deserialize nVersion into CNode, should fix #9212 (Matt Corallo)
2017-02-04 11:38:02 +01:00
Matt Corallo 7b2d96b634 Access WorkQueue::running only within the cs lock.
This removes a "race" between Interrupt() and Run(), though it
should not effect any of our supported platforms.
2017-02-03 13:50:17 -05:00
Matt Corallo 8465631845 Always enforce lock strict lock ordering (try or not) 2017-02-02 22:31:27 -05:00
Matt Corallo fd13eca147 Lock cs_vSend and cs_inventory in a consistent order even in TRY 2017-02-02 20:03:46 -05:00
Russell Yanofsky 4ec057dfa7 [wallet] Set correct metadata on bumpfee wallet transactions
Preserve comment, order form, and account strings from the original wallet
transaction. Also set fTimeReceivedIsTxTime and fFromMe fields for consistency
with CWallet::CreateTransaction. The latter two fields don't influence current
wallet behavior, but do record that the transaction originated in the wallet
instead of coming from the network or sendrawtransaction.
2017-02-02 17:34:22 -05:00
Matt Corallo 922bea90c2 Better handle invalid parameters to signrawtransaction
This silently skips trying to merge signatures from inputs which
do not exist from transactions provided to signrawtransaction,
instead of hitting an assert.
2017-02-02 17:32:27 -05:00
Matt Corallo 7ea0ad539f Fail in DecodeHexTx if there is extra data at the end 2017-02-02 17:32:27 -05:00
Cory Fields 08bb6f4ed4 net: log an error rather than asserting if send version is misused
Also cleaned up the comments and moved from the header to the .cpp so that
logging headers aren't needed from net.h
2017-02-02 16:14:16 -05:00
Cory Fields 7a8c251901 net: Disallow sending messages until the version handshake is complete
This is a change in behavior, though it's much more sane now than before.
2017-02-02 16:14:16 -05:00
Cory Fields 12752af0cc net: don't run callbacks on nodes that haven't completed the version handshake
Since ForEach* are can be used to send messages to  all nodes, the caller may
end up sending a message before the version handshake is complete. To limit
this, filter out these nodes. While we're at it, may as well filter out
disconnected nodes as well.

Delete unused methods rather than updating them.
2017-02-02 16:14:16 -05:00
Cory Fields 2046617b5e net: deserialize the entire version message locally
This avoids having some vars set if the version negotiation fails.

Also copy it all into CNode at the same site. nVersion and
fSuccessfullyConnected are set last, as they are the gates for the other vars.
Make them atomic for that reason.
2017-02-02 16:13:52 -05:00
Matt Corallo 80ff0344ae Dont deserialize nVersion into CNode, should fix #9212 2017-02-02 13:56:05 -05:00
Matt Corallo 885cfdd217 Fix super-unlikely race introduced in 236618061a
Once the CNode has been added to vNodes, it is possible that it is
disconnected+deleted in the socket handler thread. However, after
that we now call InitializeNode, which accesses the pnode.

helgrind managed to tickle this case (somehow), but I suspect it
requires in immensely braindead scheduler.
2017-02-02 13:51:57 -05:00
Wladimir J. van der Laan 4e19efba03
Merge #9556: Remove redundant semicolons
8fc6989 Remove redundant semicolons (practicalswift)
2017-02-02 11:57:40 +01:00
Wladimir J. van der Laan e30d9287fd
Merge #9663: [RPC] clarify listunspent amount description
3eba88d clarify listunspent amount description (Gregory Sanders)
2017-02-02 10:13:21 +01:00
Gregory Sanders 3eba88d44c clarify listunspent amount description 2017-02-01 12:18:31 -05:00
Wladimir J. van der Laan 77bd8c4cab
Merge #9625: Increase minimum debug.log size to 10MB after shrink.
29fb311 Increase minimum debug.log size to 10MB after shrink. (Alex Morcos)
2017-02-01 11:41:00 +01:00
Suhas Daftuar 9522b53a91 rpc: bumpfee: handle errors more gracefully 2017-01-31 20:03:45 -05:00
Suhas Daftuar f62659448c rpc: bumpfee: use correct maximum signed tx size for fee calculation
More accurate than simply adding one byte per input, and properly handles the
case where the original transaction happened to have very small signatures
2017-01-31 20:03:45 -05:00
Jorge Timón 0729102f99
Net: pass interruptMsgProc as const where possible 2017-01-31 23:45:47 +01:00
Jorge Timón fc7f2ffad4
Net: Make CNetMsgMaker more const 2017-01-31 23:29:28 +01:00
Jorge Timón d45955fa09
Net: CConnman: Make some methods const 2017-01-31 23:20:26 +01:00
Suhas Daftuar d625b907a1 wallet: Refactor dummy signature signing for reusability 2017-01-30 11:47:10 -05:00
Wladimir J. van der Laan e99f0d7ad4
Merge #9647: Skip RAII event tests if libevent is built without event_set_mem_functions
95f97f4 Skip RAII event tests if libevent is built without event_set_mem_functions (Luke Dashjr)
2017-01-30 13:56:24 +01:00
MarcoFalke 53ab12d931
Merge #9649: [doc] Remove unused clang format dev script
fa5137c [doc] Remove unused clang format dev script (MarcoFalke)
2017-01-30 13:50:01 +01:00
Wladimir J. van der Laan 71fc17f667
qt: periodic translations update 2017-01-30 13:33:00 +01:00
MarcoFalke 668de70be0
Merge #9644: [refactor] Remove using namespace <xxx> from src/
b7b48c8 Refactor: Remove using namespace <xxx> from src/*.cpp. (Karl-Johan Alm)
2017-01-30 13:13:20 +01:00
Wladimir J. van der Laan 36966a1c0e
Merge #9626: Clean up a few CConnman cs_vNodes/CNode things
2366180 Do not add to vNodes until fOneShot/fFeeler/fAddNode have been set (Matt Corallo)
3c37dc4 Ensure cs_vNodes is held when using the return value from FindNode (Matt Corallo)
5be0190 Delete some unused (and broken) functions in CConnman (Matt Corallo)
2017-01-30 12:48:43 +01:00
Wladimir J. van der Laan d2c9e4d422
Merge #9615: Wallet incremental fee
4b189c1 Change bumpfee result value from 'oldfee' to 'origfee'. (Alex Morcos)
0c0c63f Introduce WALLET_INCREMENTAL_RELAY_FEE (Alex Morcos)
e8021ec Use CWallet::GetMinimumFee in bumpfee (Alex Morcos)
ae9719a Refactor GetMinimumFee to give option of providing targetFee (Alex Morcos)
fe8e8ef [rpc] Add incremental relay fee to getnetworkinfo (Alex Morcos)
6b331e6 Fix to have miner test aware of new separate block min tx fee (Alex Morcos)
de6400d Fix missing use of dustRelayFee (Alex Morcos)
5b15870 Use incrementalRelayFee for BIP 125 replacement (Alex Morcos)
2017-01-30 10:38:56 +01:00
practicalswift 5f62e3eb63 Fix typos 2017-01-29 18:19:55 +01:00
MarcoFalke fa5137c11d [doc] Remove unused clang format dev script
Also, update the clang format file to reflect the current coding
style mentioned in the developer notes.
2017-01-28 16:57:08 +01:00
Luke Dashjr 95f97f4b94 Skip RAII event tests if libevent is built without event_set_mem_functions 2017-01-28 08:04:57 +00:00
practicalswift cc16d99f1d [trivial] Fix typos in comments 2017-01-27 21:22:35 +01:00
Karl-Johan Alm b7b48c8bbd Refactor: Remove using namespace <xxx> from src/*.cpp. 2017-01-27 18:13:20 +09:00
Alex Morcos 4b189c1340 Change bumpfee result value from 'oldfee' to 'origfee'.
The result value indicates the actual fee on the transaction that was replaced. But there is an error message which uses the description 'oldfee' to refer to the original fee rate applied to the new transaction's estimated max size.  It was confusing that two different uses of 'oldfee' had two different numeric values.
2017-01-26 12:03:47 -05:00
Alex Morcos 0c0c63f70a Introduce WALLET_INCREMENTAL_RELAY_FEE
Have wallet's default bump value be higher than the default incrementalRelayFee to future proof against changes to incremental relay fee.  Only applies when not setting the fee rate directly.
2017-01-26 12:03:47 -05:00
Alex Morcos e8021ec919 Use CWallet::GetMinimumFee in bumpfee
Use the wallet's fee calculation logic to properly clamp fee against minimums and maximums when calculating the fee for a bumpfee transaction.  Unless totalFee is explictly given, in which case, manually check against min, but do nothing to adjust given fee.

In all cases do a final check against maxTxFee (after adding any incremental amount).
2017-01-26 09:43:00 -05:00
Jonas Schnelli 04b877361b
[Qt] fix transaction details output-index to reflect vout index 2017-01-26 13:22:36 +01:00
Wladimir J. van der Laan 9b4d2673b7
Merge #9519: Exclude RBF replacement txs from fee estimation
de1ae32 Exclude RBF txs from fee estimation (Alex Morcos)
2017-01-26 10:53:14 +01:00
Wladimir J. van der Laan fd7021142a
Merge #9594: Send final alert message to older peers after connecting.
8ff8d21 Send final alert message to older peers after connecting. (Gregory Maxwell)
2017-01-26 10:31:55 +01:00
Wladimir J. van der Laan 10dc58a2aa
Merge #9587: Do not shadow local variable named tx.
44f2baa Do not shadow local variable named `tx`. (Pavel Janík)
2017-01-26 10:15:21 +01:00
Wladimir J. van der Laan 07421cf2a7
Merge #9613: [wallet] Clarify getbalance help string to explain interaction with bumpfee
5a00659 [wallet] Clarify getbalance help string to explain interaction with bumpfee (Russell Yanofsky)
2017-01-26 10:14:13 +01:00
Wladimir J. van der Laan 3f9f9629cc
Merge #9606: net: Consistently use GetTimeMicros() for inactivity checks
99464bc net: Consistently use GetTimeMicros() for inactivity checks (Suhas Daftuar)
2017-01-26 09:57:45 +01:00
Alex Morcos ae9719ab87 Refactor GetMinimumFee to give option of providing targetFee 2017-01-25 22:24:40 -05:00
Matt Corallo 236618061a Do not add to vNodes until fOneShot/fFeeler/fAddNode have been set 2017-01-25 18:59:16 -05:00
Suhas Daftuar 99464bc38e net: Consistently use GetTimeMicros() for inactivity checks
The use of mocktime in test logic means that comparisons between
GetTime() and GetTimeMicros()/1000000 are unreliable since the former
can use mocktime values while the latter always gets the system clock;
this changes the networking code's inactivity checks to consistently
use the system clock for inactivity comparisons.

Also remove some hacks from setmocktime() that are no longer needed,
now that we're using the system clock for nLastSend and nLastRecv.
2017-01-25 09:48:14 -05:00
Alex Morcos 29fb311858 Increase minimum debug.log size to 10MB after shrink. 2017-01-24 20:28:00 -05:00
Matt Corallo 3c37dc40d3 Ensure cs_vNodes is held when using the return value from FindNode 2017-01-24 17:01:45 -05:00
Matt Corallo 5be01906e5 Delete some unused (and broken) functions in CConnman 2017-01-24 17:01:43 -05:00
John Newbery ac9a84679a [Trivial] fix logging typo in FlushStateToDisk() 2017-01-24 12:08:07 -05:00
Wladimir J. van der Laan 1ac878ace6
Merge #9617: [Trivial] Update license year range to 2017
be31a2b [Trivial] Update license year range to 2017 (Lauda)
2017-01-24 13:27:07 +01:00
Wladimir J. van der Laan 4a1dc35ca5
Merge #9371: Notify on removal
094e4b3 Better document usage of SyncTransaction (Alex Morcos)
4afbde6 Introduce MemPoolConflictRemovalTracker (Alex Morcos)
ff25c32 mempool: add notification for added/removed entries (Wladimir J. van der Laan)
2017-01-24 10:08:01 +01:00
Jonas Schnelli 50864529b6
Merge #9588: qt: Use nPowTargetSpacing constant
fa4d478 qt: Use nPowTargetSpacing constant (MarcoFalke)
2017-01-24 09:24:41 +01:00
Lauda be31a2b363 [Trivial] Update license year range to 2017
The same as #7363.
2017-01-23 23:46:06 +01:00
Alex Morcos 094e4b3383 Better document usage of SyncTransaction 2017-01-23 15:43:22 -05:00
Alex Morcos 4afbde6028 Introduce MemPoolConflictRemovalTracker
Analogue to ConnectTrace that tracks transactions that have been removed from the mempool due to conflicts and then passes them through SyncTransaction at the end of its scope.
2017-01-23 15:43:22 -05:00
Wladimir J. van der Laan ff25c32392 mempool: add notification for added/removed entries
Add notification signals to make it possible to subscribe to mempool
changes:

- NotifyEntryAdded(CTransactionRef)>
- NotifyEntryRemoved(CTransactionRef, MemPoolRemovalReason)>

Also add a mempool removal reason enumeration, which is passed to the
removed notification based on why the transaction was removed from
the mempool.
2017-01-23 15:43:22 -05:00
Pieter Wuille 71148b8947
Merge #9596: [bugfix] save feeDelta instead of priorityDelta in DumpMempool
bd92f24 [bugfix] save feeDelta instead of priorityDelta in DumpMempool (Alex Morcos)
2017-01-23 10:42:36 -08:00
Wladimir J. van der Laan 727a798360
Merge #9516: Bug-fix: listsinceblock: use fork point as reference for blocks in reorg'd chains
7ba0a00 Testing: listsinceblock should not use orphan block height. (Karl-Johan Alm)
ee5c1ce Bug-fix: listsinceblock: use closest common ancestor when a block hash was provided for a chain that was not the main chain. (Karl-Johan Alm)
2017-01-23 16:16:37 +01:00
Russell Yanofsky 5a00659b58 [wallet] Clarify getbalance help string to explain interaction with bumpfee
Documentation change only, no change in behavior.
2017-01-23 09:54:11 -05:00
Wladimir J. van der Laan 7884956414
Merge #9511: Don't overwrite validation state with corruption check
116419e Don't overwrite validation state with corruption check (Alex Morcos)
2017-01-23 13:18:16 +01:00
Wladimir J. van der Laan eafba4e273
Merge #9583: Move wallet callbacks into cs_main (this effectively reverts #7946)
9899893 Move wallet callbacks into cs_main (this effectively reverts #7946) (Matt Corallo)
2017-01-23 07:43:47 +01:00
MarcoFalke ff58b1c3bd
Merge #9610: [Trivial] Grammar and typo correction (laudaa)
5c66d41 [Trivial] Grammar and typo correction (Lauda)
2017-01-22 13:28:43 +01:00
Lauda 5c66d41b7f [Trivial] Grammar and typo correction
Minor corrections in src\test\* .
2017-01-22 13:18:51 +01:00
MarcoFalke 0b96abc35f
Merge #9554: [test] Avoid potential NULL pointer dereference in addrman_tests.cpp
afab9f4 [test] Avoid potential NULL pointer dereference in addrman_tests.cpp (practicalswift)
2017-01-22 13:17:41 +01:00
Jeremy Rubin e2073424fd Fix CCheckQueue IsIdle (potential) race condition and remove dangerous constructors. 2017-01-20 18:18:59 -05:00
Matt Corallo 003cd60cc3 Add missing mempool lock for CalculateMemPoolAncestors 2017-01-20 18:11:24 -05:00
John Newbery dd5b0114cf [Trivial] add comment about setting peer as HB peer.
This adds a comment to the new logic for setting HB peers based
on block validation (and aligns the code below to reflect the comment).
It's not obvious why we're checking mapBlocksInFlight. Add a comment to
explain.
2017-01-20 15:05:12 -05:00
Alex Morcos de1ae324bf Exclude RBF txs from fee estimation 2017-01-20 15:04:16 -05:00
Wladimir J. van der Laan af01cd3a3d
qt: Periodic translation update 2017-01-20 14:45:12 +01:00
Wladimir J. van der Laan b8d1b81077
trivial: squash missing field 'argNames' initializer warning in qt tests
The additional initializer is for the named arguments, which are unused
in the test (and unfilled global fields will be initialized to 0
anyhow), so this is a no-op apart from the warning.
2017-01-20 14:39:50 +01:00
Wladimir J. van der Laan fb75cd04bb
Merge #9377: fundrawtransaction: Keep change-output keys by default, make it optional
c9f3062 Add fundrawtransactions new reserveChangeKey option to the release notes (Jonas Schnelli)
9eb325d [QA] Add test for fundrawtransactions new reserveChangeKey option (Jonas Schnelli)
9aa4e6a [Wallet] Add an option to keep the change address key, true by default (Jonas Schnelli)
2017-01-20 14:32:42 +01:00
Alex Morcos fe8e8efcf9 [rpc] Add incremental relay fee to getnetworkinfo 2017-01-20 07:40:36 -05:00
Pavel Janík 44f2baac48 Do not shadow local variable named tx. 2017-01-20 10:55:47 +01:00
Gregory Maxwell 8ff8d219c3 Send final alert message to older peers after connecting.
The old Bitcoin alert system has long since been retired.
( See also: https://bitcoin.org/en/alert/2016-11-01-alert-retirement )

This change causes each node to send any old peers that
 it connects with a copy of the final alert.

The alert it hardcode cancels all other alerts including
 other final alerts.
2017-01-20 07:33:58 +00:00
Alex Morcos bd92f2481c [bugfix] save feeDelta instead of priorityDelta in DumpMempool 2017-01-19 23:45:02 -05:00
Alex Morcos 6b331e6cf9 Fix to have miner test aware of new separate block min tx fee 2017-01-19 21:35:39 -05:00
Alex Morcos de6400de5d Fix missing use of dustRelayFee 2017-01-19 20:31:29 -05:00
Alex Morcos 5b158707f2 Use incrementalRelayFee for BIP 125 replacement 2017-01-19 20:31:29 -05:00
MarcoFalke fa4d47814f qt: Use nPowTargetSpacing constant 2017-01-19 20:47:04 +01:00
Jonas Schnelli 9aa4e6a6c2
[Wallet] Add an option to keep the change address key, true by default 2017-01-19 20:38:37 +01:00
Wladimir J. van der Laan 82274c02ed
Merge #9535: Split CNode::cs_vSend: message processing and message sending
376b3c2 Make the cs_sendProcessing a LOCK instead of a TRY_LOCK (Matt Corallo)
d7c58ad Split CNode::cs_vSend: message processing and message sending (Matt Corallo)
2017-01-19 20:20:04 +01:00
Jonas Schnelli b25068697f
Merge #9461: [Qt] Improve progress display during headers-sync and peer-finding
40ec7c7 [Qt] Improve progress display during headers-sync and peer-finding (Jonas Schnelli)
2017-01-19 20:09:49 +01:00
Wladimir J. van der Laan 2ef52d3cf1
Merge #8456: [RPC] Simplified bumpfee command.
cc0243a [RPC] bumpfee (mrbandrews)
52dde66 [wallet] Add include_unsafe argument to listunspent RPC (Russell Yanofsky)
766e8a4 [wallet] Add IsAllFromMe: true if all inputs are from wallet (Suhas Daftuar)
2017-01-19 19:59:24 +01:00
Matt Corallo 989989354b Move wallet callbacks into cs_main (this effectively reverts #7946) 2017-01-19 11:31:05 -05:00
mrbandrews cc0243ad32 [RPC] bumpfee
This command allows a user to increase the fee on a wallet transaction T, creating a "bumper" transaction B.
T must signal that it is BIP-125 replaceable.
T's change output is decremented to pay the additional fee.  (B will not add inputs to T.)
T cannot have any descendant transactions.
Once B bumps T, neither T nor B's outputs can be spent until either T or (more likely) B is mined.

Includes code by @jonasschnelli and @ryanofsky
2017-01-19 11:29:29 -05:00
Russell Yanofsky 52dde66770 [wallet] Add include_unsafe argument to listunspent RPC 2017-01-19 11:29:29 -05:00
Wladimir J. van der Laan 054d664215
Merge #9498: Basic CCheckQueue Benchmarks
aad4cb5 Address ryanofsky feedback on CCheckQueue benchmarks. Eliminated magic numbers, fixed scoping of vectors (and memory movement component of benchmark). (Jeremy Rubin)
9f03110 Add Basic CheckQueue Benchmark (Jeremy Rubin)
2017-01-19 15:29:09 +01:00
Jonas Schnelli 40ec7c7b0d
[Qt] Improve progress display during headers-sync and peer-finding 2017-01-19 09:10:04 +01:00
Wladimir J. van der Laan 9c9af5ab2d
Merge #9499: Use recent-rejects, orphans, and recently-replaced txn for compact-block-reconstruction
c594580 Add braces around AddToCompactExtraTransactions (Matt Corallo)
1ccfe9b Clarify comment about mempool/extra conflicts (Matt Corallo)
fac4c78 Make PartiallyDownloadedBlock::InitData's second param const (Matt Corallo)
b55b416 Add extra_count lower bound to compact reconstruction debug print (Matt Corallo)
863edb4 Consider all (<100k memusage) txn for compact-block-extra-txn cache (Matt Corallo)
7f8c8ca Consider all orphan txn for compact-block-extra-txn cache (Matt Corallo)
93380c5 Use replaced transactions in compact block reconstruction (Matt Corallo)
1531652 Keep shared_ptrs to recently-replaced txn for compact blocks (Matt Corallo)
edded80 Make ATMP optionally return the CTransactionRefs it replaced (Matt Corallo)
c735540 Move ORPHAN constants from validation.h to net_processing.h (Matt Corallo)
2017-01-19 09:03:46 +01:00
Wladimir J. van der Laan 6012967c47
Merge #9512: Fix various things -fsanitize complains about
82e8baa Avoid boost dynamic_bitset in rest_getutxos (Pieter Wuille)
99f001e Fix memory leak in multiUserAuthorized (Pieter Wuille)
5a0b7e4 Fix memory leak in net_tests (Pieter Wuille)
6b03bfb Fix memory leak in wallet tests (Pieter Wuille)
f94f3e0 Avoid integer overflows in scriptnum tests (Pieter Wuille)
843c560 Avoid unaligned access in crypto i/o (Pieter Wuille)
2017-01-18 20:05:30 +01:00
MarcoFalke b0b57a1730
Merge #9508: Remove unused Python imports
95bab82 Remove unused Python imports (practicalswift)
2017-01-18 10:48:52 +01:00
Karl-Johan Alm ee5c1ce5a6 Bug-fix: listsinceblock: use closest common ancestor when a block hash was provided for a chain that was not the main chain. 2017-01-18 12:07:13 +09:00
Matt Corallo c5945804ca Add braces around AddToCompactExtraTransactions 2017-01-16 23:00:58 -05:00
Matt Corallo 1ccfe9b1c9 Clarify comment about mempool/extra conflicts 2017-01-16 22:58:06 -05:00
Pieter Wuille 6696b4635c
Merge #9561: Wake message handling thread when we receive a new block
241d893 Wake message handling thread when we receive a new block (Matt Corallo)
f13914a Make WakeMessageHandler public (Matt Corallo)
2017-01-16 19:54:52 -08:00
Pieter Wuille 812714fd80
Merge #9484: Introduce assumevalid setting to skip validation presumed valid scripts.
7b5e3fe Add assumevalid testcase (John Newbery)
e440ac7 Introduce assumevalid setting to skip presumed valid scripts. (Gregory Maxwell)
2017-01-16 14:07:30 -08:00
Wladimir J. van der Laan b0819c7e9b
qt: periodic translations update 2017-01-16 20:59:50 +01:00
Wladimir J. van der Laan dd98f04538
Merge #9380: Separate different uses of minimum fees
eb30d1a Introduce -dustrelayfee (Alex Morcos)
7b1add3 Introduce -incrementalrelayfee (Alex Morcos)
daec955 Introduce -blockmintxfee (Alex Morcos)
2017-01-16 19:33:08 +01:00
Alex Morcos eb30d1a5b2 Introduce -dustrelayfee 2017-01-16 08:40:40 -05:00
Alex Morcos 7b1add3c28 Introduce -incrementalrelayfee 2017-01-16 08:39:03 -05:00
Pieter Wuille 8a445c5651
Merge #9400: Set peers as HB peers upon full block validation
d4781ac Set peers as HB peers upon full block validation (Gregory Sanders)
2017-01-15 09:44:33 -08:00