Commit graph

10003 commits

Author SHA1 Message Date
Andrew Chow 1c9b818756 getinfo deprecation warning 2017-07-18 12:34:37 -07:00
Andrew Chow 6b4f231f5f Move transaction combining from signrawtransaction to new RPC
Create a combinerawtransaction RPC which accepts a json array of hex raw
transactions to combine them into one transaction. Signrawtransaction is changed
to no longer combine transactions and only accept one transaction at a time.
2017-07-18 10:59:06 -07:00
Wladimir J. van der Laan 9e8d6a3fb4
Merge #10784: Do not allow users to get keys from keypool without reserving them
cf82a9e Do not allow users to get keys from keypool without reserving them (Matt Corallo)

Pull request description:

  fundrawtransaction allows users to add a change output and then
  not have it removed from keypool. While it would be nice to have
  users follow the normal CreateTransaction/CommitTransaction process
  we use internally, there isnt much benefit in exposing this option,
  especially with HD wallets, while there is ample room for users to
  misunderstand or misuse this option.

  This partially reverts #9377. Would be nice to get this for 15 since its kinda crazy we have this option to begin with IMO, will need release notes as an RPC option is now ignored.

Tree-SHA512: 72b5ee9c4a229b84d799dfb00c56fe80d8bba914ce81a433c3f5ab325bf9bf2b839ee658c261734f0ee183ab19435039481014d09c41dbe155e6323e63beb01d
2017-07-18 17:31:06 +02:00
Matt Corallo cf82a9e704 Do not allow users to get keys from keypool without reserving them
fundrawtransaction allows users to add a change output and then
not have it removed from keypool. While it would be nice to have
users follow the normal CreateTransaction/CommitTransaction process
we use internally, there isnt much benefit in exposing this option,
especially with HD wallets, while there is ample room for users to
misunderstand or misuse this option.

This could be particularly nasty in some use-cases (especially
pre-HD-split) - eg a user might fundrawtransaction, then call
getnewaddress, hand out the address for someone to pay them, then
sendrawtransaction. This may result in the user thinking they have
received payment, even though it was really just their own change!

This could obviously result in needless key-reuse.
2017-07-18 11:20:47 -04:00
Wladimir J. van der Laan bde4f937ae
Merge #10849: Multiwallet: simplest endpoint support
6b9faf7 [QA] add basic multiwallet test (Jonas Schnelli)
979d0b8 [tests] [wallet] Add wallet endpoint support to authproxy (John Newbery)
76603b1 Select wallet based on the given endpoint (Jonas Schnelli)
32c9710 Fix test_bitcoin circular dependency issue (Jonas Schnelli)
31e0720 Add wallet endpoint support to bitcoin-cli (-usewallet) (Jonas Schnelli)
dd2185c Register wallet endpoint (Jonas Schnelli)

Pull request description:

  Alternative for #10829 and #10650.
  It adds the most simplest form of wallet based endpoint support (`/wallet/<filename>`).
  No v1 and no node/wallet endpoint split.

Tree-SHA512: 23de1fd2f9b48d94682928b582fb6909e16ca507c2ee19e1f989d5a4f3aa706194c4b1fe8854d1d79ba531b7092434239776cae1ae715ff536e829424f59f9be
2017-07-18 17:18:49 +02:00
practicalswift e0d459264f Avoid redundant redeclaration of GetWarnings(const string&)
std::string GetWarnings(const std::string& strFor) is declared in
warnings.h and defined in warnings.cpp.
2017-07-18 15:54:38 +02:00
practicalswift 5a6671c4ca Fix typo: "conditon" → "condition"
Typo introduced in commit 439c4e8ad5.
2017-07-18 14:02:42 +02:00
practicalswift 35aff43217 Remove unused variable int64_t nEnd
Last use of nEnd removed in commit 1fc8c3de0c.
2017-07-18 14:02:15 +02:00
Wladimir J. van der Laan 7b6e8bc442
Merge #10795: No longer ever reuse keypool indexes
1fc8c3d No longer ever reuse keypool indexes (Matt Corallo)

Pull request description:

  This fixes an issue where you could reserve a keypool entry, then
  top up the keypool, writing out a new key at the given index, then
  return they key from the pool. This isnt likely to cause issues,
  but given there is no reason to ever re-use keypool indexes
  (they're 64 bits...), best to avoid it alltogether.

  Builds on #10235, should probably get a 15 tag.

Tree-SHA512: c13a18a90f1076fb74307f2d64e9d80149811524c6bda259698ff2c65adaf8c6c3f2a3a07a5f4bf03251bc942ba8f5fd33a4427aa4256748c40b062991682caf
2017-07-18 09:30:33 +02:00
Wladimir J. van der Laan 81560b07ce
Merge #10855: random: only use getentropy on openbsd
077d01f random: only use getentropy on openbsd (Cory Fields)

Pull request description:

  Follow-up from #10335. I can confirm that this fixes my issue when building against a new glibc + old linux headers for back-compat.

Tree-SHA512: a0fcf26995fbd3636f970e729a172c6e1d7c0de371e703f0653cd9776600f438ec43acd2b1eb92f2678a011968da8fbbeef8a54599434851f4c6ffe78291c172
2017-07-18 08:29:35 +02:00
Pieter Wuille 75b5643c47
Merge #10707: Better API for estimatesmartfee RPC
06bcdb8da Convert named argument from nblocks to conf_target (Alex Morcos)
439c4e8ad Improve api to estimatesmartfee (Alex Morcos)

Pull request description:

  Through 0.14 branch, the estimatesmartfee API was tagged "WARNING: This interface is unstable and may disappear or change!" and this warning is removed for 0.15, so any wanted API updates should happen now.

  The changes here are to make the additional parameter for conservative estimates a more general estimate_mode string , to omit the feerate and include an error string instead of returning -1 on error, and to do better parameter checking initially.

  ~It is only the last 2 commits, but it's built on #10706 and #10543~.

  See https://github.com/bitcoin/bitcoin/pull/10707#issuecomment-314869251 for renaming of nblocks argument to conf_target.  Will need to be included before string freeze.

  PR description edited for clarity

Tree-SHA512: 6d8ebee8bb410e2950ffd59663eebfed8d1611d995dc935bb91e430d9da7e2f306796f45631458376027d26341c660f09e825e61748103d2f2736ec6dc3df3ae
2017-07-17 16:54:20 -07:00
Pieter Wuille fee0d803fb
Merge #9980: Fix mem access violation merkleblock
8276e70de Adding assert to avoid a memory access violation inside of PartialMerkleTree::CalcHash() (Chris Stewart)

Pull request description:

  Fixing a possible memory access violation in CPartialMerkleTree::CalcHash().

  This can happen if we some how a merkle tree with zero txids. I don't think this can happen in practice as we only send merkle block messages on the p2p network as of now -- we cannot receive them.

  This was found with #8469, specifically using this [generator](https://github.com/Christewart/bitcoin/blob/rapidcheck/src/test/gen/merkleblock_gen.h#L52-L77) which will cause a memory access violation on [this test case](https://github.com/Christewart/bitcoin/blob/rapidcheck/src/test/merkleblock_properties.cpp#L48).

Tree-SHA512: b95904ec45ea3f082c7722161d93ee06b24c706fbffa909a6e995ed14788aed2830f91b626da6f0347660c45874a0735dab61c9440b59c949c690af4165c83fb
2017-07-17 15:12:39 -07:00
Matt Corallo 99c7fc39a5 Prevent user from specifying conflicting parameters to fundrawtx
estimate_mode/conf_target both are overridden by feeRate, so should
not be specified together with feeRate.
2017-07-17 13:47:45 -04:00
Alex Morcos f4d00e63f7 Add a discard_rate
Any change output which would be dust at the discard_rate you are
willing to discard completely and add to fee (as well as continuing to
pay the fee that would have been needed for creating the change).
2017-07-17 13:40:30 -04:00
Cory Fields 077d01f2fc random: only use getentropy on openbsd 2017-07-17 13:14:53 -04:00
Gregory Maxwell 095b917464 Avoid using sizes on non-fixed-width types to derive protocol constants.
Thanks to awemany for pointing this out.
2017-07-17 17:00:00 +00:00
Matt Corallo 1fc8c3de0c No longer ever reuse keypool indexes
This fixes an issue where you could reserve a keypool entry, then
top up the keypool, writing out a new key at the given index, then
return they key from the pool. This isnt likely to cause issues,
but given there is no reason to ever re-use keypool indexes
(they're 64 bits...), best to avoid it alltogether.
2017-07-17 12:12:48 -04:00
Jonas Schnelli 76603b1325
Select wallet based on the given endpoint 2017-07-17 17:42:21 +02:00
Jonas Schnelli 32c9710c50
Fix test_bitcoin circular dependency issue 2017-07-17 17:42:21 +02:00
Jonas Schnelli 31e07203bd
Add wallet endpoint support to bitcoin-cli (-usewallet) 2017-07-17 17:42:09 +02:00
Wladimir J. van der Laan 0b019357ff
Merge #10831: Batch flushing operations to the walletdb during top up and increase keypool size.
b0e8e2d Print one log message per keypool top-up, not one per key. (Gregory Maxwell)
41dc163 Increase wallet default keypool size to 1000. (Gregory Maxwell)
30d8f3a Pushdown walletdb though CWallet::AddKeyPubKey to avoid flushes. (Gregory Maxwell)
3a53f19 Pushdown walletdb object through GenerateNewKey/DeriveNewChildKey. (Gregory Maxwell)

Pull request description:

  This carries the walletdb object from top-up through GenerateNewKey/DeriveNewChildKey/CWallet::AddKeyPubKey, which allows us to avoid the flush on destruction until the top up finishes instead of flushing the wallet for every key.

  This speeds up adding keys by well over 10x on my laptop (actually something like 17x), I wouldn't be surprised if it were an even bigger speedup on spinning rust.

  Then it increases the keypool size to 1000. I would have preferred to use 10,000 but in the case where the user creates a new wallet and then turns on encryption it seems kind of dumb to have >400KB of marked-used born unencrypted keys just laying around.

  (Thanks to Matt for cluesticking me on how to bypass the crypter spaghetti)

Tree-SHA512: 868303de38fce4c3f67d7fe133f765f15435c94b39d252d7450b5fee5c607a3cc2f5e531861a69d8c8877bf130e0ff4c539f97500a6bc0ff6d67e4a42c9385c7
2017-07-17 17:16:12 +02:00
Wladimir J. van der Laan 89bb0365b9
Merge #10832: init: Factor out AppInitLockDataDirectory and fix startup core dump issue
dba485d init: Factor out AppInitLockDataDirectory (Wladimir J. van der Laan)

Pull request description:

  Alternative to #10818, alternative solution to #10815.

  After this change: All the AppInit steps before and inclusive AppInitLockDataDirectory must not have Shutdown() called in case of failure. Only when AppInitMain fails, Shutdown should be called.

  Changes the GUI and bitcoind code to consistently do this.

Tree-SHA512: 393e1a0ae05eb8e791025069e3ac4f6f3cdeb459ec63feda85d01cf6696ab3fed7632b6a0ac3641b8c7015af51d46756b5bba77f5e5f0c446f0c2dea58bbc92e
2017-07-17 17:13:11 +02:00
Alex Morcos 06bcdb8da6 Convert named argument from nblocks to conf_target
in estimatesmartfee and estimaterawfee.  Also reuse existing bounds checking.
2017-07-17 10:52:14 -04:00
Alex Morcos 439c4e8ad5 Improve api to estimatesmartfee
Change parameter for conservative estimates to be an estimate_mode string.
Change to never return a -1 for failure but to instead omit the feerate and
return an error string.  Throw JSONRPC error on invalid nblocks parameter.
2017-07-17 10:52:14 -04:00
Gregory Maxwell b0e8e2de84 Print one log message per keypool top-up, not one per key. 2017-07-17 13:46:15 +00:00
Gregory Maxwell 41dc163587 Increase wallet default keypool size to 1000. 2017-07-17 13:46:14 +00:00
Gregory Maxwell 30d8f3a18e Pushdown walletdb though CWallet::AddKeyPubKey to avoid flushes.
This prevents the wallet from being flushed between each and
 every key during top-up.  This results in a >10x speed-up
 for the top-up.
2017-07-17 13:46:07 +00:00
MarcoFalke 2b0179d8a9
Merge #10834: Remove declaration of unused method: void UpdatedTransaction(const uint256 &)
e061d8d Remove declaration of unused function: void UpdatedTransaction(const uint256 &) (practicalswift)

Pull request description:

  Remove declaration of unused method: `void UpdatedTransaction(const uint256 &)`

  Removed in 9fececb2cb.

Tree-SHA512: a328e00ccecc2a31cda7e204ab8c29ea34811afc2090f3dfd88d6d58543761dba8a289585d30b98e05236c67b1a04844e556a3b05d6e8e706233bc502f31af1d
2017-07-17 15:03:33 +02:00
Wladimir J. van der Laan dba485d651
init: Factor out AppInitLockDataDirectory
Alternative to #10818, alternative solution to #10815.

After this change: All the AppInit steps before and inclusive
AppInitLockDataDirectory must not have Shutdown() called in case of
failure. Only when AppInitMain fails, Shutdown should be called.

Changes the GUI and bitcoind code to consistently do this.
2017-07-17 14:56:52 +02:00
Gregory Sanders 4dc1915bce check for null values in rpc args and handle appropriately 2017-07-17 08:53:18 -04:00
Gregory Sanders 999ef2073a importmulti options are optional 2017-07-17 08:53:06 -04:00
Gregory Sanders a70d025366 fixup some rpc param counting for rpc help 2017-07-17 08:53:06 -04:00
Wladimir J. van der Laan 8bc6d1f179
Merge #10837: Fix resource leak on error in GetDevURandom
a8ae0b2 Fix resource leak (Dag Robole)

Pull request description:

  Fixes a potential file handle leak when size of entropy is invalid

Tree-SHA512: 692d24daaf370bba1f842925b037275126f9494f54769650bcf5829c794a0fb8561a86f42347bdf088a484e4f107bce7fa14cd7bdbfb4ecfbeb51968953da3ae
2017-07-17 13:14:09 +02:00
Alex Morcos b1385852ef Remove factor of 3 from definition of dust.
This redefines dust to be the value of an output such that it would
cost that value in fees to (create and) spend the output at the dust
relay rate.  The previous definition was that it would cost 1/3 of the
value.  The default dust relay rate is correspondingly increased to
3000 sat/kB so the actual default dust output value of 546 satoshis
for a non-segwit output remains unchanged.  This commit is a refactor
only unless a dustrelayfee is passed on the commandline in which case
that number now needs to be increased by a factor of 3 to get the same
behavior.  -dustrelayfee is a hidden command line option.

Note: It's not exactly a refactor due to edge case changes in rounding
as evidenced by the required change to the unit test.
2017-07-17 07:10:03 -04:00
Jonas Schnelli dd2185c291
Register wallet endpoint 2017-07-17 11:56:00 +02:00
Wladimir J. van der Laan 6859ad2936
Merge #10706: Improve wallet fee logic and fix GUI bugs
11590d3 Properly bound check conf_target in wallet RPC calls (Alex Morcos)
fd29d3d Remove checking of mempool min fee from estimateSmartFee. (Alex Morcos)
2fffaa9 Make QT fee displays use GetMinimumFee instead of estimateSmartFee (Alex Morcos)
1983ca6 Use CoinControl to pass custom fee setting from QT. (Alex Morcos)
03ee701 Refactor to use CoinControl in GetMinimumFee and FeeBumper (Alex Morcos)
ecd81df Make CoinControl a required argument to CreateTransaction (Alex Morcos)

Pull request description:

  This builds on #10589  (first 5 commits from that PR, last 5 commits are new)

  The first couple commits refactor to use the CCoinControl class to pass fee calculation parameters around.

  This allows for fixing the buggy interaction in QT between the global payTxFee which can be modified by the RPC call settxfee or temporarily modified by the QT custom fee settings.  Before these changes the GUI could sometimes send a transaction with a recently set payTxFee and not respect the settings displayed in the GUI.   After these changes, using the GUI does not involve the global transaction confirm target or payTxFee.

  The prospective fee displays in the smart fee slider and the coin control dialog are changed to use the fee calculation from GetMinimumFee, this simplifies the code and makes them slightly more correct in edge cases.

  Maxing the fee calculation with the mempool min fee is move from estimateSmartFee to GetMinimumFee.

  This fixes a long standing bug, and should be tagged for 0.15 as it is holding up finalizing the estimatesmartfee RPC API before release.

Tree-SHA512: 4d36a1bd5934aa62f3806d380fcafbef73e9fe5bdf190fc5259a3e3a13349e5ce796e50e7068c46dc630ccf56d061bce5804f0bfe2e082bb01ca725b63efd4c1
2017-07-17 09:25:33 +02:00
MarcoFalke bf0a08be28
Merge #10330: [wallet] fix zapwallettxes interaction with persistent mempool
4c3b538 [logs] fix zapwallettxes startup logs (John Newbery)
e7a2181 [wallet] fix zapwallettxes interaction with persistent mempool (John Newbery)
ff7365e [tests] fix flake8 warnings in zapwallettxes.py (John Newbery)

Pull request description:

  zapwallettxes previously did not interact well with persistent mempool.
  zapwallettxes would cause wallet transactions to be zapped, but they
  would then be reloaded from the mempool on startup. This commit softsets
  persistmempool to false if zapwallettxes is enabled so transactions are
  actually zapped.

  This PR also fixes the zapwallettxes.py functional test, which did not properly test this feature. The test line:

  ```py
       assert_raises(JSONRPCException, self.nodes[0].gettransaction, [txid3])
       #there must be a expection because the unconfirmed wallettx0 must be gone by now
  ```
  is not actually testing the presence of the transaction since the RPC is being called incorrectly (with an array instead of a string). The `assert_raises()` passes since an assert is raised, but it's not the one the test writer had in mind!

  Fixes #9710 .

Tree-SHA512: e3236efc7a2fd2b3bf1d9e2e8a7726d470c57f5d95cf41b7bde264edc8817bd36a6f3feff52f8de8db0ef64b7247c88b24e7ff7cefaa706cba86fe4e2135a508
2017-07-17 04:23:52 +02:00
MarcoFalke 3895e25a77
Merge #10842: Fix incorrect Doxygen tag (@ince → @since). Doxygen parameter name matching.
2c2e90d Fix incorrect Doxygen tag (@ince → @since). Make Doxygen parameter names match actual parameter names. (practicalswift)

Pull request description:

  Doxygen fixes:
  * Fix incorrect Doxygen tag (`@ince` → `@since`).
  * Make Doxygen parameter names match actual parameter names.

Tree-SHA512: cb1d37a7d15a90d24affaf5c2bcf462663f0b0c13868bb25401e5d8cb303fcb41e53fdeee8012b2271a509112ef98fc0c070b4194f42cd55361f7e6bc7996342
2017-07-16 23:41:58 +02:00
MarcoFalke 1fc783fc08
Merge #10739: test: Move variable state down where it is used
5618b7d Do not shadow upper local variable `state`. (Pavel Janík)

Pull request description:

  Tests added in #10192 emit few shadowing warnings:

  ```
  test/txvalidationcache_tests.cpp:268:26: warning: declaration shadows a local variable [-Wshadow]
  test/txvalidationcache_tests.cpp:296:26: warning: declaration shadows a local variable [-Wshadow]
  test/txvalidationcache_tests.cpp:357:26: warning: declaration shadows a local variable [-Wshadow]
  ```

  Remove shadowing declarations and reuse the upper local declaration as in other already present test cases.

Tree-SHA512: 1e3c52cf963f8f33e729900c8ecdcd5cc6fe28caa441ba53c4636df9cc3d1a351ca231966d36384589f1340ae8ddd447424c2ee3e8527d334d0412f0d1a10c8f
2017-07-16 22:47:33 +02:00
practicalswift 2c2e90d1d4 Fix incorrect Doxygen tag (@ince → @since). Make Doxygen parameter names match actual parameter names. 2017-07-16 21:22:05 +02:00
Pieter Wuille 565494619d
Merge #10735: Avoid static analyzer warnings regarding uninitialized arguments
6835cb0ab Avoid static analyzer warnings regarding uninitialized arguments (practicalswift)

Pull request description:

  Avoid static analyzer warnings regarding _"Function call argument is a pointer to uninitialized value"_ in cases where we are intentionally using such arguments.

  This is achieved by using `f(b.begin(), b.end())` (`std::array<char, N>`) instead of `f(b, b + N)` (`char b[N]`).

  Rationale:
  * Reduce false positives by guiding static analyzers regarding our intentions.

  Before this commit:

  ```shell
  $ clang-tidy-3.5 -checks=* src/bench/base58.cpp
  bench/base58.cpp:23:9: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage]
          EncodeBase58(b, b + 32);
          ^
  $ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp
  bench/verify_script.cpp:59:5: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage]
      key.Set(vchKey, vchKey + 32, false);
      ^
  $
  ```

  After this commit:

  ```shell
  $ clang-tidy-3.5 -checks=* src/bench/base58.cpp
  $ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp
  $
  ```

Tree-SHA512: 5814a320ca8b959d0954bb64393424bcad73f942d2e988de1cd6788f39153b93900325532f2e340de02d740a3953385d212ae08e7ec72bb4c394a40475f251df
2017-07-16 12:15:11 -07:00
Pieter Wuille ad6fce67b9
Merge #10844: Use range based for loop
d0413c670 Use range based for loop (René Nyffenegger)

Pull request description:

  Instead of iterating over 0 .. 1 and then deciding on an actual desired
  value, use a range based for loop for the desired value.

Tree-SHA512: 0a7a4a80516c9f16cf97fa7d257088b8386360e19b93c4deac3d745b6270ea452c513821686d7d14a159a235763e034f9b14eef222ca15f7eb71c37bd1c2c380
2017-07-16 12:03:30 -07:00
Pieter Wuille 99c7db8731
Merge #10840: Remove duplicate include
c53369cc2 Remove duplicate include (practicalswift)

Pull request description:

  Remove duplicate include.

  Introduced in 5c643241e5.

Tree-SHA512: c273cb60824b3a2b2bdebdc4fc84b309d66042d616ccfc9a7b1ee55380af0ab7d1ae059391b3b46063847087a1985e2491d4ce203a31a2b1c586e8fd531d9336
2017-07-16 12:00:19 -07:00
Pieter Wuille ef37f2033c
Merge #10820: Use cpuid intrinsics instead of asm code
674848fe1 Clarify entropy source (Pieter Wuille)
a9e82f651 Use cpuid intrinsics instead of asm code (Pieter Wuille)

Pull request description:

  Less platform-specific code is better.

Tree-SHA512: 14f1b9accd9882859acdf516d2ada7ccb0ad92a3b3edf95b9cb8a8e514d4b1748d4555bcfb560779792c4f664f920d681ae42e9cebd0e6410f13f94c3a8729a0
2017-07-16 11:50:49 -07:00
René Nyffenegger d0413c670b Use range based for loop
Instead of iterating over 0 .. 1 and then deciding on an actual desired
value, use a range based for loop for the desired value.
2017-07-16 17:03:33 +02:00
practicalswift c53369cc24 Remove duplicate include 2017-07-16 02:25:25 +02:00
Gregory Maxwell 3a53f19718 Pushdown walletdb object through GenerateNewKey/DeriveNewChildKey.
This is needed but not sufficient for batching the wallet flushing
 when topping up the keypool.
2017-07-16 00:11:31 +00:00
Pieter Wuille 5cfdda2503
Merge #10235: Track keypool entries as internal vs external in memory
d40a72ccb Clarify *(--.end()) iterator semantics in CWallet::TopUpKeyPool (Matt Corallo)
28301b978 Meet code style on lines changed in the previous commit (Matt Corallo)
4a3fc3562 Track keypool entries as internal vs external in memory (Matt Corallo)

Pull request description:

  This is an alternative version of #10184. As @jonasschnelli points out there, the performance regressions are pretty minimal, but given that this is a pretty simple, mechanical change, its probably worth doing.

Tree-SHA512: e83f9ebf2998f8164d1b2eebe5e6dcdeadea8c30b7612861f830758c08bf4093cd6a67b3bcfa9cfcb139e5e0b106fc8898a975fc69f334981aefc756568ab613
2017-07-15 14:02:05 -07:00
Pieter Wuille c5904e8714
Merge #10812: [utils] Allow bitcoin-cli's -rpcconnect option to be used with square brackets
5c643241e [utils] allow square brackets for ipv6 addresses in bitcoin-cli (John Newbery)
fe4fabaf1 [refactor] move SplitHostPort() into utilstrencodings (John Newbery)

Pull request description:

  bitcoin-cli's `-rpcconnect` can accept ipv6 addresses (as long as the libevent version is new enough), but fails to parse ipv6 with square brackets. This PR makes `bitcoin-cli` parse ipv6 in square brackets correctly.

  `bitcoin-cli -rpcconnect=[::1] <command>`

  should now be equivalent to

  `bitcoin-cli -rpcconnect=::1 <command>`

  This is useful so the `bitcoin-cli` option can now be in the same format as the `bitcoind` option.

  Doesn't include tests. I have a branch that fully tests `bitcoin-cli`, but that's queued behind several intermediate PRs.

  - first commit moves `SplitHostPort()` from libbitcoin_common into libbitcoin_util
  - second commit adds proper ipv6 parsing to bitcoin-cli

Tree-SHA512: 249d409f10360c989474283341f458cc97364a56a7d004ae6d5f13d8bffe3a51b5dc2484d42218848e2d42cd9c0b13a1b92e94ea19b209f7e91c875c208d8409
2017-07-15 13:26:49 -07:00
Dag Robole a8ae0b252a Fix resource leak 2017-07-15 21:34:52 +02:00
John Newbery 4c3b538c61 [logs] fix zapwallettxes startup logs 2017-07-15 15:31:26 -04:00
Pieter Wuille 10b22e3141
Merge #10760: Avoid dereference-of-casted-pointer
0aadc11fd Avoid dereference-of-casted-pointer (Pieter Wuille)

Pull request description:

  And prefer a static_cast to the intended reference type.

Tree-SHA512: e83b20023a4dca6029b46f7040a8a6fd54e1b42112ec0c87c3c3b567ed641de97a9e2335b57a2efb075491f641e5b977bc226a474276bea0c3c3c71d8d6ac54d
2017-07-15 12:22:50 -07:00
John Newbery e7a2181b49 [wallet] fix zapwallettxes interaction with persistent mempool
zapwallettxes previously did not interact well with persistent mempool.
zapwallettxes would cause wallet transactions to be zapped, but they
would then be reloaded from the mempool on startup. This commit softsets
persistmempool to false if zapwallettxes is enabled so transactions are
actually zapped.
2017-07-15 15:15:25 -04:00
Pieter Wuille afd2fca911
Merge #10807: getbalance example covers at least 6 confirms
228987d84 getbalance example covers at least 6 confirms (Gregory Sanders)

Tree-SHA512: 328d60b007ee75d809f4d28a7d9e5537d3c1446bd30c4c2ae57c690b8e83f6287cbcd3d8c955e8ba07ab62e27f9d27497c55219ff14fd5af7759dec465673fa2
2017-07-15 11:12:24 -07:00
practicalswift e061d8d7ab Remove declaration of unused function: void UpdatedTransaction(const uint256 &) 2017-07-15 20:04:04 +02:00
practicalswift 0189d8ed19 Fix typos 2017-07-15 14:28:40 +02:00
practicalswift 6835cb0ab2 Avoid static analyzer warnings regarding uninitialized arguments
Avoid static analyzer warnings regarding "Function call argument
is a pointer to uninitialized value" in cases where we are
intentionally using such arguments.

This is achieved by using ...

`f(b.begin(), b.end())` (`std::array<char, N>`)

... instead of ...

`f(b, b + N)` (`char b[N]`)

Rationale:
* Reduce false positives by guiding static analyzers regarding our
  intentions.

Before this commit:

```
$ clang-tidy-3.5 -checks=* src/bench/base58.cpp
bench/base58.cpp:23:9: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage]
        EncodeBase58(b, b + 32);
        ^
$ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp
bench/verify_script.cpp:59:5: warning: Function call argument is a pointer to uninitialized value [clang-analyzer-core.CallAndMessage]
    key.Set(vchKey, vchKey + 32, false);
    ^
$
```

After this commit:

```
$ clang-tidy-3.5 -checks=* src/bench/base58.cpp
$ clang-tidy-3.5 -checks=* src/bench/verify_script.cpp
$
```
2017-07-15 14:26:50 +02:00
Alex Morcos 11590d39b9 Properly bound check conf_target in wallet RPC calls 2017-07-14 23:41:40 -04:00
Alex Morcos fd29d3df29 Remove checking of mempool min fee from estimateSmartFee.
This check has been moved to the wallet logic GetMinimumFee. The rpc call to
estimatesmartfee will now no longer return a result maxed with the mempool min
fee, but automated fee calculations from the wallet will produce the same result
as before and coincontrol and sendcoins dialogs in the GUI will correctly
display the right prospective fee.

changes to policy/fees.cpp include a big whitespace indentation change.
2017-07-14 23:41:40 -04:00
Alex Morcos 2fffaa9738 Make QT fee displays use GetMinimumFee instead of estimateSmartFee
Remove helper function (CalculateEstimateType) for determining whether
estimates should be conservative or not, now that this is only called
once from GetMinimumFee and incorporate the logic directly there.
2017-07-14 23:41:37 -04:00
Alex Morcos 1983ca6cb3 Use CoinControl to pass custom fee setting from QT.
This fixes buggy behavior where we were temporarily setting and unsetting the
global payTxFee when trying to send a transaction with a custom fee from the
GUI. The previous behavior was inconsistent depending on the order of using the
RPC call settxfee and clicking various radio buttons in the sendcoinsdialog.
The new behavior is that transactions sent with the GUI will always use either
the smartfee slider value or the custom fee set on the GUI and they will not
affect the global defaults which are only for RPC and initial GUI values.
2017-07-14 23:40:33 -04:00
Alex Morcos 03ee701161 Refactor to use CoinControl in GetMinimumFee and FeeBumper
Improve parameter precedence in coin_control
2017-07-14 23:10:58 -04:00
Alex Morcos ecd81dfa3c Make CoinControl a required argument to CreateTransaction 2017-07-14 23:07:18 -04:00
Pieter Wuille 8fdd23a224
Merge #10769: [Qt] replace fee slider with a Dropdown, extend conf. targets
2aef1f182 [Qt] migrate old fee slider value to new dropbown Always round up (conservative) (Jonas Schnelli)
bc1be90e3 [Qt] replace fee slider with a Dropdown, extend conf. targets (Jonas Schnelli)

Tree-SHA512: 53796cf0b434dd3db5d4680dbeb6231a7df8f15d88187178fd4db8917cd7fc60091ce2c1589fd93668fc94bb13f989aba5b7ef3792fa95ee1f9f21a15709e2d3
2017-07-14 19:24:09 -07:00
Pieter Wuille 1c011ff430
Merge #10816: Properly forbid -salvagewallet and -zapwallettxes for multi wallet.
dd97a529a Properly forbid -salvagewallet and -zapwallettxes for multi wallet. (Alex Morcos)

Tree-SHA512: dcde8f854ae957b4d3af4bcf1b811e0b6e9b93602764f86499e46a28d304cd4ee93ba058c03f6ca74ccb60e1310c83e53b698c64d93e5503115377655b80d44d
2017-07-14 19:07:42 -07:00
Matt Corallo d40a72ccbb Clarify *(--.end()) iterator semantics in CWallet::TopUpKeyPool 2017-07-14 21:25:24 -04:00
Matt Corallo 28301b9780 Meet code style on lines changed in the previous commit 2017-07-14 21:25:24 -04:00
Matt Corallo 4a3fc35629 Track keypool entries as internal vs external in memory
This resolves a super minor performance regressions in several
keypool-handling functions
2017-07-14 21:25:21 -04:00
Pieter Wuille ec8a50b8d7
Merge #10808: Avoid some new gcc warnings in 15
c73b8be24 Explicitly initialize prevector::_union to avoid new warning (Matt Corallo)
1016dacfa Fix signed/unsigned comparison warning introduced in c8e29d7ff0. (Matt Corallo)

Tree-SHA512: d1574b0fdc9bfddc3517c382d34418b1d8ed80c81d2f6fd19378c064af8d7704fb84ef8b740ff97f7ec7609bd6de76348921fcc227e1ce97127947a0d22c7887
2017-07-14 18:07:59 -07:00
Matt Corallo c73b8be244 Explicitly initialize prevector::_union to avoid new warning
Warning from gcc 7.1 is ./prevector.h:450:25: warning:
'*((void*)(&<anonymous>)+8).prevector<28, unsigned char>::_union.prevector<28, unsigned char>::direct_or_indirect::<anonymous>.prevector<28, unsigned char>::direct_or_indirect::<unnamed struct>::indirect'
may be used uninitialized in this function [-Wmaybe-uninitialized]
2017-07-14 20:52:38 -04:00
Pieter Wuille f90603ac6d
Merge #10618: Remove confusing MAX_BLOCK_BASE_SIZE.
3babbcb48 Remove confusing MAX_BLOCK_BASE_SIZE. (Gregory Maxwell)

Tree-SHA512: 361293fc4e1e379cd5a0908ed0866a00e1c7a771bdf02fded158fca21b492a29c7a67fea0d13dc40b2a04204c89823bf1836fe5b63a17c9747751b9c845a3527
2017-07-14 17:49:48 -07:00
Pieter Wuille b7d6623c76
Merge #10819: Fix uninitialized atomic variables
465279114 Fix uninitialized atomic variables (João Barbosa)

Tree-SHA512: 5dd8924bc8743a094abdbc2464b835a0e7fd4948c102ea7c2251c6330bea5615c4459ba322a656fd6ac5f8d695b69d3709d225ddccef226cf8afc7de5e3d3019
2017-07-14 14:54:07 -07:00
Gregory Maxwell 3babbcb487 Remove confusing MAX_BLOCK_BASE_SIZE.
Some people keep thinking that MAX_BLOCK_BASE_SIZE is a separate
 size limit from the weight limit when it fact it is superfluous,
 and used in early tests before the witness data has been
 validated or just to compute worst case sizes.  The size checks
 that use it would not behave any differently consensus wise
 if they were eliminated completely.

Its correct value is not independently settable but is a function
 of the weight limit and weight formula.

This patch just eliminates it and uses the scale factor as
 required to compute the worse case constants.

It also moves the weight factor out of primitives into consensus,
 which is a more logical place for it.
2017-07-14 19:24:17 +00:00
Pieter Wuille 674848fe1c Clarify entropy source 2017-07-14 12:17:33 -07:00
Pieter Wuille 66270a416e
Merge #10557: Make check to distinguish between orphan txs and old txs more efficient.
18bacec6c Make check to distinguish between orphan txs and old txs more efficient. (Alex Morcos)

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

Pull request description:

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

  Addresses #10670.

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

Pull request description:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Tree-SHA512: 0c6c3c79c64fcb21e17ab60290c5c96d4fac11624c49f841a4201eec21cb480314c52a07d1e3abd4f9c764785cc57bfd178511f495aa0469addb204e96214fe4
2017-06-29 20:19:21 +02:00