Commit graph

12297 commits

Author SHA1 Message Date
Pieter Wuille 81e1dd5ce1 Generalize PublicOnlySigningProvider into HidingSigningProvider 2018-08-13 08:46:23 -07:00
Pieter Wuille 84f1f1bfdf Make SigningProvider expose key origin information 2018-08-13 08:46:23 -07:00
Pieter Wuille 611ab307fb Introduce KeyOriginInfo for fingerprint + path 2018-08-13 08:46:23 -07:00
Pieter Wuille 8254e9950f Additional sanity checks in SignPSBTInput 2018-08-13 08:21:16 -07:00
Pieter Wuille c05712cb59 Only wipe wrong UTXO type data if overwritten by wallet 2018-08-13 08:21:16 -07:00
MarcoFalke f87d0a9d75
Merge #13534: Don't assert(foo()) where foo() has side effects
6ad0328f1c Don't assert(foo()) where foo has side effects (practicalswift)

Pull request description:

  Don't `assert(foo())` where `foo` has side effects.

  From `assert(3)`:

  > If the macro `NDEBUG` is defined at the moment `<assert.h>` was last included, the macro `assert()` generates no code, and hence does nothing at all.

  Bitcoin currently cannot be compiled without assertions, but we shouldn't rely on that.

Tree-SHA512: 28cff0c6d1c2fb612ca58c9c94142ed01c5cfd0a2fecb8e59cdb6c270374b215d952ed3491d921d84dc1b439fa49da4f0e75e080f6adcbc6b0e08be14e54c170
2018-08-13 10:02:50 -04:00
MarcoFalke 3bd25c010c
Merge #13899: build: Enable -Wredundant-decls where available. Remove redundant redeclarations.
d56b73f217 Remove redundant extern (practicalswift)
f04bb1361c Enable -Wredundant-decls (gcc) if available (practicalswift)
a9e90e5002 Remove redundant redeclaration of rescanblockchain(...) in same scope (practicalswift)

Pull request description:

  Remove redundant redeclaration of `rescanblockchain` and enable `-Wredundant-decls` (gcc) where available to avoid accidental redundant redeclarations.

  ```
   CXX      wallet/libbitcoin_wallet_a-rpcwallet.o
  wallet/rpcwallet.cpp:4764:17: warning: redundant redeclaration of ‘UniValue rescanblockchain(const JSONRPCRequest&)’ in same scope [-Wredundant-decls]
   extern UniValue rescanblockchain(const JSONRPCRequest& request);
                   ^~~~~~~~~~~~~~~~
  wallet/rpcwallet.cpp:3929:10: note: previous declaration of ‘UniValue rescanblockchain(const JSONRPCRequest&)’
   UniValue rescanblockchain(const JSONRPCRequest& request)
            ^~~~~~~~~~~~~~~~
  ```

Tree-SHA512: b9af95fa53f494c3f6702e485956b66b042d2ff7578b4a53bf28e91aa844cdcf5d7ac3e2e710948eed566007324e81317304b8eabf2d4ea284cd6acd77f8ffcd
2018-08-13 09:55:35 -04:00
MarcoFalke f083ec13c3
Merge #13938: refactoring: Cleanup StartRest()
2da54f5a66 Cleanup StartRest() (DesWurstes)

Pull request description:

Tree-SHA512: 7e907315009c0351b7a3347ec13b6727abd12fe722d51cc061cb635ea20f9a550af5f50dc364c4313501b0dfc3696bcfa26a2a5f0170a4b5808624e043085d29
2018-08-13 09:42:50 -04:00
Wladimir J. van der Laan 825fb02ef1 net: Update hardcoded seeds
Pre-0.17 branch hardcoded seeds update.
2018-08-13 13:57:15 +02:00
MarcoFalke 73a09b4458
Merge #13905: docs: fixed bitcoin-cli -help output for help2man
869193f5a6 docs: fixed bitcoin-cli -help output for help2man (Hennadii Stepanov)

Pull request description:

  Currently `bitcon-cli -help` output forces help2man to produce `.TP` and `.IP` commands instead of a single `.IP` command for `-stdinrpcpass`  option.
  Removing an extra space fixes this issue.

  This pull request is rebased from #13879

Tree-SHA512: 1c5b25ed2ef7b7de42bc6210165bdbabe63f045699487f2db4790e0d3176f6493dfd3e8e19f4ddc38b551539465d7b41aea570f20dccbc0609f00fdfee1b5180
2018-08-13 07:33:33 -04:00
MarcoFalke a9c56b6634
Merge #13918: rpc: Replace median fee rate with feerate percentiles in getblockstats
4b7091a842 Replace median fee rate with feerate percentiles (Marcin Jachymiak)

Pull request description:

  Currently,  the `medianfeerate` statistic is calculated from the feerate of the middle transaction of a list of transactions sorted by feerate.

  This PR instead uses the value of the 50th percentile weight unit in the block, and also calculates the feerate at the 10th, 25th, 75th, and 90th percentiles.  This more accurately corresponds with what is generally meant by median feerate.

Tree-SHA512: 59255e243df90d7afbe69839408c58c9723884b8ab82c66dc24a769e89c6d539db1905374a3f025ff28272fb25a0b90e92d8101103e39a6d9c0d60423a596714
2018-08-13 07:18:25 -04:00
Wladimir J. van der Laan 2115cba9c6
Merge #13666: Always create signatures with Low R values
e306be7429 Use 72 byte dummy signatures when watching only inputs may be used (Andrew Chow)
48b1473c89 Use 71 byte signature for DUMMY_SIGNATURE_CREATOR (Andrew Chow)
18dfea0dd0 Always create 70 byte signatures with low R values (Andrew Chow)

Pull request description:

  When creating signatures for transactions, always make one which has a 32 byte or smaller R and 32 byte or smaller S value. This results in signatures that are always less than 71 bytes (32 byte R + 32 byte S + 6 bytes DER + 1 byte sighash) with low R values. In most cases, the signature will be 71 bytes.

  Because R is not mutable in the same way that S is, a low R value can only be found by trying different nonces. RFC 6979 for deterministic nonce generation has the option to specify additional entropy, so we simply use that and add a uin32_t counter which we increment in order to try different nonces. Nonces are sill deterministically generated as the nonce used will the be the first one where the counter results in a nonce that results in a low R value. Because different nonces need to be tried, time to produce a signature does increase. On average, it takes twice as long to make a signature as two signatures need to be created, on average, to find one with a low R.

  Having a fixed size signature makes size calculations easier and also saves half a byte of transaction size, on average.

  DUMMY_SIGNATURE_CREATOR has been modified to produce 71 byte dummy signatures instead of 72 byte signatures.

Tree-SHA512: 3cd791505126ce92da7c631856a97ba0b59e87d9c132feff6e0eef1dc47768e81fbb38bfbe970371bedf9714b7f61a13a5fe9f30f962c81734092a4d19a4ef33
2018-08-13 12:07:20 +02:00
Wladimir J. van der Laan 13d51a2b61
Merge #13808: wallet: shuffle coins before grouping, where warranted
18f690ec2f wallet: shuffle coins before grouping, where warranted (Karl-Johan Alm)

Pull request description:

  Coins are randomly shuffled in coin selection to avoid unintentional privacy leaks regarding the user's coin set. For the case where a user has a lot of coins with the same destination, these will be grouped into groups of 10 *before* the shuffling.

  It is unclear whether this has any implications at all, but this PR plugs the potential issue, if there ever is one, by shuffling the coins before they are grouped.

  Issue brought up in https://github.com/bitcoin/bitcoin/pull/12257#discussion_r204554549

Tree-SHA512: fb50ed4b5fc03ab4853d45b76e1c64476ad5bcd797497179bc37b9262885c974ed6811159fd8e581f1461b6cc6d0a66146f4b70a2777c0f5e818d1322e0edb89
2018-08-13 11:36:39 +02:00
Hennadii Stepanov 869193f5a6 docs: fixed bitcoin-cli -help output for help2man
The `help2man` parses a string containing two spaces between words with an issue:
it gives out `.TP` and `.IP` commands instead of a single `.IP` command.
Removing an extra space fixes this issue.
Currently the `-help` output for the `-stdin` option looks without any issue due to eliminating
of two spaces between words by a `FormatParagraph` call for this particular case.
For consistency and preventing from future regressions extra spaces have been removed from the both lines.
The redundant `strprintf` call has been removed aswell.
2018-08-13 12:12:03 +03:00
Wladimir J. van der Laan b0d3e9b102
qt: Translations update before 0.17 branch
Make sure that translations are synchronized with transifex before the
branch-off point to minimize the difference and prevent duplicate work.

Tree-SHA512: 41e71eaf14094606fd90011d035c551a635d5a715f865a49841dbe2b54a76b7fbf59a7918f86e5fd80a717e2934a9613fe463391fd01848d0a01e5c4e7e7fef0
2018-08-13 11:00:17 +02:00
251 265bd50884 Removes unsed CBloomFilter constructor.
This commit removes the `CBloomFilter::CBloomFilter(const unsigned int, const double, const unsigned int)` constructor, which became obsolete with 086ee67.
2018-08-13 01:24:55 +02:00
MarcoFalke fa6c3dea42
p2p: Clarify control flow in ProcessMessage() 2018-08-12 15:07:45 -04:00
Marcin Jachymiak 4b7091a842 Replace median fee rate with feerate percentiles
Removes medianfeerate result from getblockstats.
Adds feerate_percentiles which give the feerate of the 10th, 25th, 50th,
75th, and 90th percentile weight unit in the block.
2018-08-11 15:00:17 -04:00
DesWurstes 2da54f5a66 Cleanup StartRest() 2018-08-11 09:34:47 +03:00
MarcoFalke d6faea4f91
Merge #13908: [Docs] upgrade rescan time warning from minutes to >1 hour
bb5b1c0b2d [Docs] upgrade rescan time warning from minutes to >1 hour (Mason Simon)

Pull request description:

  When I rescanned just now it took well over an hour. The time warning "may take minutes" didn't prepare me for that.

  ```
  2018-08-08T03:10:17Z [wallet] Still rescanning. At block 174747. Progress=0.008341
  2018-08-08T03:11:17Z [wallet] Still rescanning. At block 204233. Progress=0.024533
  2018-08-08T03:12:17Z [wallet] Still rescanning. At block 221170. Progress=0.038340
  ...
  2018-08-08T04:16:17Z [wallet] Still rescanning. At block 524815. Progress=0.957105
  2018-08-08T04:17:17Z [wallet] Still rescanning. At block 528572. Progress=0.971323
  2018-08-08T04:18:17Z [wallet] Still rescanning. At block 532458. Progress=0.986824
  ```

  This is on a 4-core 4ghz system with a 7200rpm drive.

Tree-SHA512: 722ccf566bfd6a3381fa173e08849cb676fe4c1f1cb2c4b86b07df2a5dc1ca0d54797cbe8fd606cdc2c60fef2be7c98e052460decdac2132ba759cff822132e8
2018-08-10 21:36:18 -04:00
lucash.dev@gmail.com a679109be4 Speed up knapsack_solver_test by not recreating wallet 100 times.
Moved the code for creating the wallet out of the 100-times repetition loop, for the most time-consuming tests.
2018-08-10 18:33:47 -07:00
MarcoFalke bced8ea71a
Merge #13927: rpc: Use pushKV in some new PSBT RPCs
227d27e70c Use pushKV in some new PSBT RPCs. (Daniel Kraft)

Pull request description:

  Most of the code uses `UniValue::pushKV` where appropriate, but some new RPC code related to PSBTs did not.  This fixes those places - after this change, there are no remaining source files I could find that contain `push_back(Pair(`.

Tree-SHA512: d6567cf144d05d7e42276bd66ff4cd44413328f985772d11bb9d7339d32ab7c3438d4bb0040a37e75f8d193c610b08fa971073935885e0a178546aa045daf9fa
2018-08-10 21:33:10 -04:00
Wladimir J. van der Laan 48bf8ff5b1
Merge #13907: Introduce a maximum size for locators.
e254ff5d53 Introduce a maximum size for locators. (Gregory Maxwell)

Pull request description:

  The largest sensible size for a locator is log in the number of blocks.
   But, as noted by Coinr8d on BCT a maximum size message could encode a
   hundred thousand locators.  If height were used to limit the messages
   that could open new attacks where peers on long low diff forks would
   get disconnected and end up stuck.

  Ideally, nodes first first learn to limit the size of locators they
   send before limiting what would be processed, but common implementations
   back off with an exponent of 2 and have an implicit limit of 2^32
   blocks, so they already cannot produce locators over some size.

  Locators are cheap to process so allowing a few more is harmless,
   so this sets the maximum to 64-- which is enough for blockchains
   with 2^64 blocks before the get overhead starts increasing.

Tree-SHA512: da28df9c46c988980da861046c62e6e7f93d0eaab3083d32e408d1062f45c00316d5e1754127e808c1feb424fa8e00e5a91aea2cc3b80326b71c148696f7cdb3
2018-08-10 19:52:13 +02:00
Wladimir J. van der Laan 71dec5c81f
Merge #13925: Merge leveldb subtree
ec749b1bcd Squashed 'src/leveldb/' changes from 64052c76c5..524b7e36a8 (MarcoFalke)

Pull request description:

  For review:

  ```sh
  git fetch https://github.com/bitcoin-core/leveldb
  ./test/lint/git-subtree-check.sh src/leveldb
  ```

  Closes #13860

Tree-SHA512: 9d13384fe35e7144b4a7fca57efe77b0cc5295952da4a397e4c6d8aa3f8043d5113fccedd3ae1dcaa3d2649e732e5f57a71504847946e055aa4dc8c3780e29fc
2018-08-10 19:48:14 +02:00
Andrew Chow e306be7429 Use 72 byte dummy signatures when watching only inputs may be used
With watching only inputs, we do not know how large the signatures
for those inputs will be as their signers may not have implemented
71 byte signatures. Thus we estimate their fees using the 72 byte
dummy signature to ensure that we pay enough fees.

This only effects fundrawtransaction when includeWatching is true.
2018-08-09 18:39:56 -07:00
Andrew Chow 48b1473c89 Use 71 byte signature for DUMMY_SIGNATURE_CREATOR
Changes DUMMY_SIGNATURE_CREATOR to create 71 byte dummy signatures.

Update comments to reflect this change
2018-08-09 18:39:56 -07:00
Andrew Chow 18dfea0dd0 Always create 70 byte signatures with low R values
When extra entropy is not specified by the caller, CKey::Sign will
now always create a signature that has a low R value and is at most
70 bytes. The resulting signature on the stack will be 71 bytes when
the sighash byte is included.

Using low R signatures means that the resulting DER encoded signature
will never need to have additional padding to account for high R
values.
2018-08-09 18:39:56 -07:00
Karl-Johan Alm 18f690ec2f
wallet: shuffle coins before grouping, where warranted
Issue brought up in https://github.com/bitcoin/bitcoin/pull/12257\#discussion_r204554549
2018-08-10 09:08:11 +09:00
Gregory Maxwell e254ff5d53 Introduce a maximum size for locators.
The largest sensible size for a locator is log in the number of blocks.
 But, as noted by Coinr8d on BCT a maximum size message could encode a
 hundred thousand locators.  If height were used to limit the messages
 that could open new attacks where peers on long low diff forks would
 get disconnected and end up stuck.

Ideally, nodes first first learn to limit the size of locators they
 send before limiting what would be processed, but common implementations
 back off with an exponent of 2 and have an implicit limit of 2^32
 blocks, so they already cannot produce locators over some size.

This sets the limit to an absurdly high amount of 101 in order to
 maximize compatibility with existing software.
2018-08-09 20:54:01 +00:00
Andrew Chow c1dde3a949 No longer shutdown after encrypting the wallet
Since the database environment is flushed, closed, and reopened during
EncryptWallet, there is no need to shut down the software anymore.
2018-08-09 11:28:33 -07:00
Andrew Chow d7637c5a3f After encrypting the wallet, reload the database environment
Calls ReloadDbEnv after encrypting the wallet so that the database
environment is flushed, closed, and reopened to prevent unencrypted
keys from being saved on disk.
2018-08-09 11:27:39 -07:00
Andrew Chow 5d296ac810 Add function to close all Db's and reload the databae environment
Adds a ReloadDbEnv function to BerkeleyEnvironment in order to close all Db
instances, closes the environment, resets it, and then reopens
the BerkeleyEnvironment.

Also adds a ReloadDbEnv function to BerkeleyDatabase that calls
BerkeleyEnvironment's ReloadDbEnv.
2018-08-09 11:27:39 -07:00
Andrew Chow a769461d5e Move BerkeleyEnvironment deletion from internal method to callsite
Instead of having the object destroy itself, having the caller
destroy it.
2018-08-09 11:27:39 -07:00
Daniel Kraft 227d27e70c Use pushKV in some new PSBT RPCs.
Most of the code uses UniValue::pushKV where appropriate, but some new
RPC code related to PSBTs did not.
2018-08-09 18:08:45 +02:00
MarcoFalke fa14fa742d
Merge leveldb subtree
Merge commit 'ec749b1bcdf2483b642fb51d635800e272c68ba6' into HEAD
2018-08-09 11:31:45 -04:00
MarcoFalke 3e3a50aeb8
Merge #13911: doc: Revert translated string change, clarify wallet log messages
c4a884d555 Trivial: Revert translated string change, clarify wallet log messages (Pierre Rochard)

Pull request description:

  Fixes https://github.com/bitcoin/bitcoin/pull/12992 post-merge nits from @jnewbery

Tree-SHA512: 002d8a69b489fd216e15b7d6200d7117c489b32405d5e9f514f120d43113fd97ca2f235452b0093e0760bc03baf714edc4564ae14af8456e1b2a54f83c577bf3
2018-08-09 08:11:17 -04:00
MarcoFalke 8eb9870052
Merge #13876: wallet: Catch filesystem_error and raise InitError
fa8527ffec wallet: Catch filesystem_error and raise InitError (MarcoFalke)

Pull request description:

  Fixes #13754 by restoring the previous behaviour

Tree-SHA512: f64052e89f6b332be395df2a5ea6f227c213fa2f38e415e83f30a4fad0938e947e5cddff7902368a43c07be135955a31b90f7eac5a46875c58d54ea95f87f6e6
2018-08-09 08:03:23 -04:00
practicalswift 0e534d4dca Fix incorrect Doxygen comments 2018-08-08 22:14:45 +02:00
Chun Kuan Lee c4aecd1d80 Add risc-v 64-bit to gitian 2018-08-09 03:35:51 +08:00
Pierre Rochard c4a884d555 Trivial: Revert translated string change, clarify wallet log messages 2018-08-08 11:00:55 -04:00
Wladimir J. van der Laan df9f712746
Merge #13894: shutdown: Stop threads before resetting ptrs
faab63111d shutdown: Stop threads before resetting ptrs (MarcoFalke)

Pull request description:

  On shutdown some threads would continue to run after or during a pointer reset. This leads to occasional segfaults on shutdown.

  Fix this by resetting the smart pointers after all threads that might read from them have been stopped.

  This should fix:
  * A segfault in the txindex thread, that occurs when the txindex destructor is done, but the thread was not yet stopped (as this is done in the base index destructor)
  * A segfault in the scheduler thread, which dereferences conman. (e.g. CheckForStaleTipAndEvictPeers)

Tree-SHA512: abbcf67fadd088e10fe8c384fadfb90bb115d5317145ccb5363603583b320efc18131e46384f55a9bc574969013dfcbd08c49e0d42c004ed7212eca193858ab2
2018-08-08 15:19:00 +02:00
Wladimir J. van der Laan 78dae8cacc
Merge #13780: 0.17: Pre-branch maintenance
3fc20632a3 qt: Set BLOCK_CHAIN_SIZE = 220 (DrahtBot)
2b6a2f4a28 Regenerate manpages (DrahtBot)
eb7daf4d60 Update copyright headers to 2018 (DrahtBot)

Pull request description:

  Some trivial maintenance to avoid having to do it again after the 0.17 branch off.

  (The scripts to do this are in `./contrib/`)

Tree-SHA512: 16b2af45e0351b1c691c5311d48025dc6828079e98c2aa2e600dc5910ee8aa01858ca6c356538150dc46fe14c8819ed8ec8e4ec9a0f682b9950dd41bc50518fa
2018-08-08 13:55:27 +02:00
Mason Simon bb5b1c0b2d [Docs] upgrade rescan time warning from minutes to >1 hour 2018-08-07 22:39:34 -07:00
Wladimir J. van der Laan 9d86aad287
Merge #13812: wallet: sum ancestors rather than taking max in output groups
23fbbb100f wallet: sum ancestors rather than taking max in output groups (Karl-Johan Alm)

Pull request description:

  This is pointed out in https://github.com/bitcoin/bitcoin/pull/12257#discussion_r204549758.

  Basically, the ancestors gives an indication as to how many ancestors the resulting transaction will have, which is more precise when summing up the values, rather than taking the maximum, since all the coins in the group will become ancestors if selected.

Tree-SHA512: 0588c4b6059669650614817e041526a2ab89dda8c07fca8e077c7669dca1fed51cd164f7df56340840ab60285d48f3b140dcee64f64bf696b2dd4ab16d556a13
2018-08-07 17:23:04 +02:00
Wladimir J. van der Laan e8f387f997
Merge #13843: [trivial] Add doxygen-compatible comments to CAffectedKeysVisitor
3339d84535 [trivial] add doxygen-compatible comments to CAffectedKeysVisitor (Pierre Rochard)

Pull request description:

Tree-SHA512: 0003fde198a6977d0c8988efc8f76428f9e095009fddf131b07bd9809ef76a778c86bb2b1305e33df16101b6b703cf43eb6193462bb9f3687f98c1d9b109dd96
2018-08-07 16:49:18 +02:00
MarcoFalke fa5ce27385
ui: Compile boost:signals2 only once 2018-08-07 10:49:10 -04:00
MarcoFalke 1cd5f2cf9a
Merge #13895: Docs: fix GetWarnings docs to reflect behavior
13bb5cae31 Docs: fix GetWarnings docs to reflect behavior (Ben Woosley)

Pull request description:

  In "gui", it returns all warnings, joined by a separator
  In "statusbar", it returns the last warning set which seems notionally to be the most important, though that is debatable

Tree-SHA512: 5fc0dc68d143a040b7b893b7176188e2b064c2cf1d559420906e4de636e16e9ab7451a1b87603020a7a8f66d6b94f4ee6c7da2697efad879f9e6de9c0e0c9ac1
2018-08-07 10:30:31 -04:00
Wladimir J. van der Laan e7ea858729
Merge #13527: policy: Remove promiscuousmempoolflags
faa24441ec policy: Remove promiscuousmempoolflags (MarcoFalke)

Pull request description:

  It seems odd to clutter validation code with features that can only ever be used for testing (testnet or regtest). Removing that test-only code makes the mempool logic less painful to understand and easier to reason about when changed or refactored in the future.

Tree-SHA512: 3b897aa9604ac8d82ebe9573c6efd468c93ddaa08d378ebc902e247b7aa6c68fcde71e5b449c08f17a067146cdc66dc50a67ce06d07607c27e5189a49c3fba3f
2018-08-07 15:45:37 +02:00
Wladimir J. van der Laan 51c693d49e
Merge #13657: wallet: assert to ensure accuracy of CMerkleTx::GetBlocksToMaturity
93de2891fa wallet: assert to ensure accuracy of CMerkleTx::GetBlocksToMaturity (Ben Woosley)

Pull request description:

  According to my understanding, it should not be possible for coinbase
  transactions to be conflicting, thus it should not be possible for
  GetDepthInMainChain to return a negative result. If it did, this would
  also result in innacurate results for GetBlocksToMaturity due to the
  math therein. asserting ensures accuracy.

Tree-SHA512: 8e71c26f09fe457cfb00c362ca27066f7f018ea2af1f395090fdc7fd9f5964b76f4317c23f7a4923776f00087558511da5c1c368095be39fb1bacc614a93c32f
2018-08-07 14:19:50 +02:00
Wladimir J. van der Laan b81a8a5ea9
Merge #13667: wallet: Fix backupwallet for multiwallets
a1a998cf24 wallet: Fix backupwallet for multiwallets (Daniel Kraft)

Pull request description:

  `backupwallet` was broken for multiwallets in their own directories (i.e. something like `DATADIR/wallets/mywallet/wallet.dat`).  In this case, the backup would use `DATADIR/wallets/wallet.dat` as source file and not take the specific wallet's directory into account.

  This led to either an error during the backup (if the wrong source file was not present) or would silently back up the wrong wallet; especially the latter behaviour can be quite bad for users.

Tree-SHA512: 7efe2450ca047e40719fcc7cc211ed94699056020ac737cada7b59e8240298675960570c45079add424d0aab520437d5050d956acd695a9c2452dd4317b4d2c4
2018-08-07 13:31:54 +02:00
Wladimir J. van der Laan 37ab117a87
Merge #13872: [docs] Reformat -help output for help2man
7272fdcfe7 [docs] Reformat -help output for help2man (Tim Ruffing)

Pull request description:

  This commit slightly changes the format of the "Usage" strings in CLI
  `-help` messages to meet the expection of the help2man tool, which we
  use to generate man pages. On the way, we remove a few calls to
  `strprintf()`, which became superficial after commit 32fbfda.

  Before:
  ![screenshot from 2018-08-04 12-11-25](https://user-images.githubusercontent.com/1071625/43675564-6e2e016c-97e2-11e8-8de7-0912a4088efd.png)
  After:
  ![screenshot from 2018-08-04 12-11-46](https://user-images.githubusercontent.com/1071625/43675566-712d7032-97e2-11e8-85a7-5decc6dcb4b2.png)

Tree-SHA512: 9752ee0d0fde0b084e00232609866291ff493f4feb45919279b0f142b04635c049ddd2bf71ff6ad57d4ae1ed37103348640d253bb4f0b3e16b7fd2bb4b2a6fba
2018-08-07 10:32:53 +02:00
practicalswift d56b73f217 Remove redundant extern 2018-08-07 09:34:45 +02:00
practicalswift a9e90e5002 Remove redundant redeclaration of rescanblockchain(...) in same scope 2018-08-06 23:52:35 +02:00
Ben Woosley 13bb5cae31
Docs: fix GetWarnings docs to reflect behavior
In "gui", it returns all warnings, joined by a separator
In "statusbar", it returns just the first warning
2018-08-06 17:16:15 -04:00
MarcoFalke faab63111d
shutdown: Stop threads before resetting ptrs 2018-08-06 16:35:41 -04:00
John Newbery b2f23c4153 [RPC] Remove getinfo deprecation warning 2018-08-06 11:20:27 -04:00
MarcoFalke fa8527ffec
wallet: Catch filesystem_error and raise InitError 2018-08-04 12:04:38 -04:00
Tim Ruffing 7272fdcfe7 [docs] Reformat -help output for help2man
This commit slightly changes the format of the "Usage" strings in CLI
`-help` messages to meet the expection of the help2man tool, which we
use to generate man pages. On the way, we remove a few calls to
`strprintf()`, which became superficial after commit 32fbfda.
2018-08-04 16:17:13 +02:00
Pierre Rochard 3339d84535 [trivial] add doxygen-compatible comments to CAffectedKeysVisitor 2018-08-03 15:30:08 -04:00
Chun Kuan Lee bb6ca65f98 gui: get special folder in unicode 2018-08-04 02:47:58 +08:00
Chun Kuan Lee 1c5d225853 Drop boost::scoped_array 2018-08-04 01:11:42 +08:00
Russell Yanofsky 9c4dc597dd Use LOCK macros for non-recursive locks
Instead of std::unique_lock.
2018-08-03 07:11:37 -05:00
Russell Yanofsky 1382913e61 Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection
They should also work with any other mutex type which std::unique_lock
supports.

There is no change in behavior for current code that calls these macros with
CCriticalSection mutexes.
2018-08-03 07:11:37 -05:00
Russell Yanofsky ba1f095aad MOVEONLY Move AnnotatedMixin declaration
Move AnnotatedMixin closer to where it's used, and after the DEBUG_LOCKORDER
function declarations so it can call them.
2018-08-03 07:11:37 -05:00
Russell Yanofsky 41b88e9337 Add unit test for DEBUG_LOCKORDER code 2018-08-03 07:11:37 -05:00
Ben Woosley 384273260a
test: Add testing of value_ret for SelectCoinsBnB
Fix that the early bailout optimization tests did not test the actual
selection because their utxo pool was polluted by the make_hard_case test
preceding.
2018-08-03 02:45:20 -04:00
Pierre Rochard 909f54c80a [wallet] Add wallet name to log messages
After multiple wallets became supported, wallet-related log messages
became ambiguous as to which wallet they were being emitted by.

fixes #11317
2018-08-02 12:09:39 -04:00
Varunram d5f745a5c7
trivial: correct typos 2018-08-02 21:27:17 +08:00
practicalswift dd777f3e12 Remove unused variable 2018-08-02 14:30:59 +02:00
practicalswift cdf4089457 Remove redundant assignments (dead stores) 2018-08-02 14:30:53 +02:00
Wladimir J. van der Laan e577669062
gui: Pull initial 017x translations from transifex
Tree-SHA512: 4372a0602587e2bfceae69e3c90726c5d4a9d34a934dac9d000a9611fa7fca51e9d0fbacaee60decbea09294e53f94259ddcef2b3f876fefa1fd9f8a4dc25188
2018-08-02 13:43:51 +02:00
Wladimir J. van der Laan 2c14c1fa2f
Merge #13791: gui: Reject dialogs if key escape is pressed
7bf22bf0c2 gui: Reject options dialog when key escape is pressed (João Barbosa)
4a43306a4f gui: Reject edit address dialog when key escape is pressed (João Barbosa)
f7a553177d gui: Add GUIUtil::ItemDelegate with keyEscapePressed signal (João Barbosa)

Pull request description:

  Currently `EditAddressDialog` and `OptionsDialog` don't close when the escape key is pressed. The `QDataWidgetMapper` instances prevents closing the dialogs because the escape key is used to reset the widgets values. More details and workarounds in https://stackoverflow.com/a/51487847 and http://qtramblings.blogspot.com/2010/10/qdatawidgetmapper-annoyances.html.

  The adopted solution is different from the above references. It turns out that `QDataWidgetMapper::setItemDelegate` sets the event filter for all mapped widgets. So in this PR the mapper's delegate are changed to a custom `GUIUtil::ItemDelegate` that offers the signal `keyEscapePressed`, which is connected to the `QDialog::reject` slot.

  Note that the installed event filter lets all events pass, so the current behaviour isn't changed, meaning that widgets values are reset in addition to closing the dialog.

Tree-SHA512: 9c961d488480b4ccc3880a11a8f1824b65f77570ee8918c7302c62775a1a73e52ae988a31a55ffff87b4170ddbecf833c2f09b66095c00eb6854a4d43f030f1f
2018-08-02 12:59:39 +02:00
Wladimir J. van der Laan d3325b02e4
Merge #13844: doc: correct the help output for -prune
312ff01ee5 -prune option -help output aligned with code (Hennadii Stepanov)

Pull request description:

  The -help output for -prune is aligned with the code.

  In the code (.../src/init.cpp#L1063):
  ```
          if (nPruneTarget < MIN_DISK_SPACE_FOR_BLOCK_FILES) {
              return InitError(strprintf(_("Prune configured below the minimum of %d MiB.  Please use a higher number."), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024));
          }
  ```
  So correct value of nPruneTarget is **greater than or equal to** MIN_DISK_SPACE_FOR_BLOCK_FILES.

Tree-SHA512: 8e55aa99c8f5a9d020677b0f1b016215e2dbda5fa4ee7c8504b12a3abef226bc21beca118fa332c0bf206a4aff913a5a717b55bb5b2ecdba38423e9c0161209e
2018-08-02 12:00:57 +02:00
Wladimir J. van der Laan aa30e4bb8f
Merge #13824: doc: Remove outdated net comment
fa365021bb doc: Remove outdated net comment (MarcoFalke)

Pull request description:

  `mapAddresses` and the corresponding "critsect" has been removed in 5fee401fe1 more than 6 years ago. Now is probably a good time to remove this confusing comment.

Tree-SHA512: 498a403d5703da395c18a7ebb776aa6e693e59fe43a839fefd261e0a5af58621763813979d4cfbd8d1728ce73b325b82002e393cde79bdbff33e0fbf68ab6747
2018-08-02 10:07:11 +02:00
Wladimir J. van der Laan c1cba35725
Merge #13835: [trivial,doc] Fix memory consistency model in comment
fe7180c5b2 [trivial,doc] Fix memory consistency model in comment (Jesse Cohen)

Pull request description:

  Updating a comment overlooked during review in #13247

Tree-SHA512: 0bd54ba1c265fdd77fd6e12ad0be46dd422348f7d926ce9abaca53fdb3a3c55c0d1cd90b4382321352076f4a81e2249c0014cd789f47a3637cb93bd983cb4657
2018-08-02 10:05:46 +02:00
Hennadii Stepanov 312ff01ee5
-prune option -help output aligned with code
see: .../src/init.cpp#L1063
2018-08-02 01:16:41 +03:00
Wladimir J. van der Laan f030410e88
Merge #13697: Support output descriptors in scantxoutset
f6b7fc349c Support h instead of ' in hardened descriptor paths (Pieter Wuille)
fddea672eb Add experimental warning to scantxoutset (Jonas Schnelli)
6495849bfd [QA] Extend tests to more combinations (Pieter Wuille)
1af237faef [QA] Add xpub range tests in scantxoutset tests (Jonas Schnelli)
151600bb49 Swap in descriptors support into scantxoutset (Pieter Wuille)
0652c3284f Descriptor tests (Pieter Wuille)
fe8a7dcd78 Output descriptors module (Pieter Wuille)
e54d76044b Add simple FlatSigningProvider (Pieter Wuille)
29943a904a Add more methods to Span class (Pieter Wuille)

Pull request description:

  As promised, here is an implementation of my output descriptor concept (https://gist.github.com/sipa/e3d23d498c430bb601c5bca83523fa82) and integration within the `scantxoutset` RPC that was just added through #12196.

  It changes the RPC to use descriptors for everything; I hope the interface is simple enough to encompass all use cases. It includes support for P2PK, P2PKH, P2WPKH, P2SH, P2WSH, multisig, xpubs, xprvs, and chains of keys - combined in every possible way.

Tree-SHA512: 63b54a96e7a72f5b04a8d645b8517d43ecd6a65a41f9f4e593931ce725a8845ab0baa1e9db6a7243190d8ac841f6e7e2f520d98c539312d78f7fd687d2c7b88f
2018-08-01 20:06:17 +02:00
Sjors Provoost d795c610d3
[qt] TransactionView: highlight replacement tx after fee bump 2018-08-01 18:43:46 +02:00
Jesse Cohen fe7180c5b2 [trivial,doc] Fix memory consistency model in comment 2018-08-01 12:19:45 -04:00
MarcoFalke c88529a178
Merge #13805: [wallet] Correctly limit output group size
a13647b8bd [qa] Add test for too-large wallet output groups (Suhas Daftuar)
57ec1c97b2 [wallet] correctly limit output group size (Suhas Daftuar)

Pull request description:

  Also add a test to ensure that output groups are being limited, even if a wallet has many outputs corresponding to the same scriptPubKey (the test fails without the first commit).

Tree-SHA512: 2aaa82005b0910488f5cbf40690d4c5e2f46949e299ef70b4cb6e440713811443d411dcbc6d71b1701fd82423073125e21747787d70830cd021c841afb732d51
2018-08-01 12:03:20 -04:00
MarcoFalke e83d82a85c
Merge #13247: Add tests to SingleThreadedSchedulerClient() and document the memory model
cbeaa91dbb Update ValidationInterface() documentation to explicitly specify threading and memory model (Jesse Cohen)
b296b425a7 Update documentation for SingleThreadedSchedulerClient() to specify the memory model (Jesse Cohen)
9994d01d8b Add Unit Test for SingleThreadedSchedulerClient (Jesse Cohen)

Pull request description:

  As discussed in #13023 I've split this test out into a separate pr

  This test (and documentation update) makes explicit the guarantee (previously undefined, but implied by the 'SingleThreaded' in `SingleThreadedSchedulerClient()`) - that callbacks pushed to the `SingleThreadedSchedulerClient()` obey the single threaded model for memory and execution - specifically, the callbacks are executed fully and in order, and even in cases where a subsequent callback is executed by a different thread, sequential consistency of memory for all threads executing these callbacks is maintained.

  Maintaining memory consistency should make the api more developer friendly - especially for users of the validationinterface. To the extent that there are performance implications from this decision, these are not currently present in practice because all use of this scheduler happens on a single thread currently, furthermore the lock should guarantee consistency across callback executions even when callbacks are executed by multiple threads (as the test does).

Tree-SHA512: 5d95a7682c402e5ad76b05bc9dfbca99ca64105f62ab9e78f6fc0f6ea8c5277aa399fbb94298e35cc677b0c2181ff17259584bb7ae230e38aa68b85ecbc22856
2018-07-31 20:52:05 -04:00
MarcoFalke fa365021bb
doc: Remove outdated net comment 2018-07-31 17:02:42 -04:00
MarcoFalke 0fb9c87815
Merge #13822: bench: Make CoinSelection output groups pass eligibility filter
494634a052 bench: Make CoinSelection output groups pass eligibility filter (Andrew Chow)

Pull request description:

  Set the depth of the output groups used in the CoinSelection benchmark to be 6 in order to pass the eligibility filter for the benchmark.

  Fixes #13813

Tree-SHA512: 55fc6aeda0127f5e155efb982aec211b70dfd3257808dce627886af6866ffa25de4df3c9b10f8c45b6c298a42542c54654f36e59efb208e9055885361f0e501c
2018-07-31 15:24:33 -04:00
Wladimir J. van der Laan 7d3623794a
Merge #13776: net: Add missing verification of IPv6 address in CNetAddr::GetIn6Addr(...)
2fb0066b99 net: Add missing verification of IPv6 address in CNetAddr::GetIn6Addr(...) (practicalswift)

Pull request description:

  Add missing verification of IPv6 address in `CNetAddr::GetIn6Addr(...)`.

Tree-SHA512: 8b0681252eec9cf293a2043e99fdacec520e321b477d8aca1cbd6327b85bf6c5e8cd820fb914f097c62655947e88745ebccd824a78b995a8186e910e6fe520aa
2018-07-31 20:47:40 +02:00
Andrew Chow 494634a052 bench: Make CoinSelection output groups pass eligibility filter
Set the depth of the output groups used in the CoinSelection benchmark
to be 6 in order to pass the eligibility filter for the benchmark.
2018-07-31 11:31:07 -07:00
MarcoFalke 230652cafc
Merge #13799: Ignore unknown config file options; warn instead of error
247d5740d2 Ignore unknown config file options for now (Pieter Wuille)
04ce0d88ca Report when unknown config file options are ignored (Pieter Wuille)

Pull request description:

  As reported by @satwo on IRC a few days ago, the current mechanism of treating unknown config file options as errors is problematic for options like `-rpcclienttimeout` which aren't defined for `bitcoind`.

  A full solution would be to either make all binaries be aware of each other's options, or to permit config file options that only apply to specific binaries (`bitcoind`, `bitcoin-qt`, `bitcoin-cli`). Both of these seem too invasive to introduce for 0.17.

  As a compromise, this PR makes it ignores those options, but still warn about it in the log file.

Tree-SHA512: dfddc771b91df3031a9c98d9f3292f8f4fcd1b97ebb7317b2f457e12d9f205dc63f42721302e7258dbb53f273d7cc041a65a0a9120972769555784e1f1cc9aef
2018-07-31 12:17:55 -04:00
Wladimir J. van der Laan 8ce55df70d
Merge #13794: chainparams: Update with data from assumed valid chain
fa8f2d826c doc: Fix chainTxData comment (MarcoFalke)
fa6094f152 chainparams: Update with data from assumed valid chain (MarcoFalke)

Pull request description:

  Can be reviewed by using the `getblock` and `getchaintxstats` rpcs of a synced node. Reviewers get extra points when their full node has checkpoints and assumevalid disabled.

Tree-SHA512: cedd61fde129ae4c16fc12275b61e4c5659b6d72dd801c608efc294188561bc986d94652fe9bea71ada48654258e2a074d2d2da78036c69608ccff3a6cc1ccf5
2018-07-31 06:53:09 +02:00
Pieter Wuille 247d5740d2 Ignore unknown config file options for now 2018-07-30 18:01:20 -07:00
Jesse Cohen cbeaa91dbb Update ValidationInterface() documentation to explicitly specify threading and memory model 2018-07-30 19:41:59 -04:00
Jesse Cohen b296b425a7 Update documentation for SingleThreadedSchedulerClient() to specify the memory model 2018-07-30 19:41:59 -04:00
João Barbosa 7bf22bf0c2 gui: Reject options dialog when key escape is pressed 2018-07-30 23:13:04 +01:00
João Barbosa 4a43306a4f gui: Reject edit address dialog when key escape is pressed 2018-07-30 23:13:04 +01:00
João Barbosa f7a553177d gui: Add GUIUtil::ItemDelegate with keyEscapePressed signal 2018-07-30 23:13:04 +01:00
MarcoFalke 84d5a6210c
Merge #13786: refactor: Avoid locking tx pool cs thrice
fa5ed4f8d2 refactor: Avoid locking tx pool cs thrice (MarcoFalke)

Pull request description:

  `addUnchecked` is (outside the tests) only called by ATMP, which already takes the tx pool read lock. So locking it twice more in both `addUnchecked` methods seems redundant.

  Similarly `CalculateMemPoolAncestors` is (beside once in the wallet) only called in contexts, where the tx pool lock is already taken. So remove the lock there as well.

Tree-SHA512: fcf603b570da0fc529fe6db8add218663eae52845510732bee0d4611263d2429d3d3c9c8ae68493d67287d13504500ed51905ccbe711eb15a0af3b019edad543
2018-07-30 16:18:23 -04:00
Karl-Johan Alm 23fbbb100f
wallet: sum ancestors rather than taking max in output groups 2018-07-31 04:54:41 +09:00
MarcoFalke fa8f2d826c
doc: Fix chainTxData comment 2018-07-30 15:49:23 -04:00
James O'Beirne 6f53edb395 Acquire cs_main before ATMP call in block_assemble bench
Otherwise we fail an assert in sync.cpp:AssertLockHeldInternal.
2018-07-30 12:08:22 -04:00
Suhas Daftuar 57ec1c97b2 [wallet] correctly limit output group size 2018-07-30 10:43:16 -04:00
Wladimir J. van der Laan 63d73f5bc8
Merge #13554: Remove unused function arguments
bd9d0690dc Remove unused argument to WitnessSigOps(...) (practicalswift)
d1d7cfebd2 Remove unused argument to DefaultOptions(...) (practicalswift)
05dbb0c042 Remove unused argument to ThreadHTTP(...) (practicalswift)

Pull request description:

  Remove unused function arguments.

Tree-SHA512: 9933b6d34ff00a32d2f06a2e542d1225bdfb2c960599f01a8ff0427324b3529db49f19ffdbf54059acbbef5ca87f4c3169e97082169022022cd1e3afa7aaa56d
2018-07-30 16:30:54 +02:00
MarcoFalke fa587773e5
scripted-diff: Remove unused first argument to addUnchecked
-BEGIN VERIFY SCRIPT-
git grep -l addUnchecked | xargs sed --regexp-extended -i -e 's/addUnchecked\([^)][^,]+,\s*/addUnchecked(/g'
-END VERIFY SCRIPT-
2018-07-30 09:09:32 -04:00
MarcoFalke fe5c49766c tx pool: Use the entry's hash instead of the one passed to addUnchecked 2018-07-30 08:57:49 -04:00
MarcoFalke ddd395f968 Mark CTxMemPoolEntry members that should not be modified const 2018-07-30 08:57:49 -04:00
Pieter Wuille 04ce0d88ca Report when unknown config file options are ignored 2018-07-30 00:35:44 -07:00
Ben Woosley 23f4343781
Add CMerkleTx::IsImmatureCoinBase method
All but one call to GetBlocksToMaturity is testing it relative to 0
for the purposes of determining whether the coinbase tx is immature.
In such case, the value greater than 0 implies that the tx is coinbase,
so there is no need to separately test that status.

This names the concept for easy singular use.
2018-07-29 19:49:14 -04:00
MarcoFalke fa6094f152
chainparams: Update with data from assumed valid chain 2018-07-29 13:30:41 -04:00
MarcoFalke fa5ed4f8d2
refactor: Avoid locking tx pool cs thrice 2018-07-29 08:04:06 -04:00
MarcoFalke ad51e1372b
Merge #13774: Return void instead of bool for functions that cannot fail
d78a8dc3e8 Return void instead of bool for functions that cannot fail (practicalswift)

Pull request description:

  Return `void` instead of `bool` for functions that cannot fail:
  * `CBlockTreeDB::ReadReindexing(...)`
  * `CChainState::ResetBlockFailureFlags(...)`
  * `CTxMemPool::addUnchecked(...)`
  * `CWallet::CommitTransaction(...)`
  * `CWallet::LoadDestData(...)`
  * `CWallet::LoadKeyMetadata(...)`
  * `CWallet::LoadScriptMetadata(...)`
  * `CWallet::LoadToWallet(...)`
  * `CWallet::SetHDChain(...)`
  * `CWallet::SetHDSeed(...)`
  * `PendingWalletTx::commit(...)`
  * `RemoveLocal(...)`
  * `SetMinVersion(...)`
  * `StartHTTPServer(...)`
  * `StartRPC(...)`
  * `TorControlConnection::Disconnect(...)`

  Some of the functions can fail by throwing.

  Found by manually inspecting the following candidate functions:

  ```
  $ git grep -E '(^((static|virtual|inline|friend)[^a-z])*[^a-z]*bool [^=]*\(|return true|return false)' -- "*.cpp" "*.h"
  ```

Tree-SHA512: c0014e045362dbcd1a0cc8f69844e7b8cbae4f538e7632028daeca3a797ac11d8d3d86ebc480bedcb8626df3e96779d592747d52a12556fc49921b114fa0ccc6
2018-07-29 07:56:36 -04:00
Pieter Wuille f6b7fc349c Support h instead of ' in hardened descriptor paths 2018-07-27 12:21:12 -07:00
Jonas Schnelli fddea672eb Add experimental warning to scantxoutset 2018-07-27 11:52:45 -07:00
Pieter Wuille 151600bb49 Swap in descriptors support into scantxoutset 2018-07-27 11:52:45 -07:00
Pieter Wuille 0652c3284f Descriptor tests 2018-07-27 11:52:45 -07:00
Pieter Wuille fe8a7dcd78 Output descriptors module 2018-07-27 11:52:45 -07:00
Pieter Wuille e54d76044b Add simple FlatSigningProvider 2018-07-27 11:52:18 -07:00
Pieter Wuille 29943a904a Add more methods to Span class
This introduces a rudimentary begin(), end(), operator[], and subspan to Span.
2018-07-27 11:52:18 -07:00
MarcoFalke ef4fac0ea5
Merge #13775: doc: Remove newlines from error message
620361fce8 Fix accidental use of the addition assignment operator ("+="). Remove newlines from error message. (practicalswift)

Pull request description:

  Fix accidental use of the addition assignment operator (`+=`).

  _Note to reviewers:_ Perhaps the `\n`:s should be removed too?

Tree-SHA512: 4e8c2dfd6025d78ef9d60522297994829dacc447e6b6782e15c0bdd5dd2daa17ca9a8948bfa9a15be57d9286092356381d7e6747980303852d273eb0df0dd76b
2018-07-27 14:38:46 -04:00
practicalswift 620361fce8 Fix accidental use of the addition assignment operator ("+="). Remove newlines from error message. 2018-07-27 18:47:03 +02:00
MarcoFalke f98d1e0008
Merge #13711: [bench] Add benchmark for unserialize prevector
46340b3337 [bench] Add benchmark for unserialize prevector (Akio Nakamura)

Pull request description:

  This PR adds benchmarks for the unserialization of the prevector.

  Note: Separated from #12324.

Tree-SHA512: c055a283328cc2634c01eb60f26604a8665939bbf77d367b6ba6b4e01e77d4511fab69cc3ddb1e62969adb3c48752ed870f45ceba153eee192302601341e18a7
2018-07-27 11:44:10 -04:00
practicalswift d78a8dc3e8 Return void instead of bool for functions that cannot fail
* CBlockTreeDB::ReadReindexing(...)
* CChainState::ResetBlockFailureFlags(...)
* CTxMemPool::addUnchecked(...)
* CWallet::LoadDestData(...)
* CWallet::LoadKeyMetadata(...)
* CWallet::LoadScriptMetadata(...)
* CWallet::LoadToWallet(...)
* CWallet::SetHDChain(...)
* CWallet::SetHDSeed(...)
* RemoveLocal(...)
* SetMinVersion(...)
* StartHTTPServer(...)
* StartRPC(...)
* TorControlConnection::Disconnect(...)
2018-07-27 13:19:03 +02:00
DrahtBot 3fc20632a3 qt: Set BLOCK_CHAIN_SIZE = 220 2018-07-27 07:15:37 -04:00
DrahtBot eb7daf4d60 Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
practicalswift 2fb0066b99 net: Add missing verification of IPv6 address in CNetAddr::GetIn6Addr(...) 2018-07-27 08:41:20 +02:00
practicalswift aecd615ad7 wallet: Fix accidental use of the comma operator 2018-07-26 23:33:16 +02:00
practicalswift 1ac3c983bf Mark single-argument constructors "explicit" 2018-07-26 17:15:32 +02:00
Jesse Cohen 1e3bcd2517 [net_processing] Add thread safety annotations 2018-07-25 15:23:53 -04:00
Jesse Cohen f393a533be Annotate AssertLockHeld() with ASSERT_CAPABILITY() for thread safety analysis 2018-07-25 10:31:27 -04:00
Wladimir J. van der Laan 2d41af1728
Merge #13658: [moveonly] Extract RescanWallet to handle a simple rescan
3fe836b78d [moveonly] Extract RescanWallet to handle a simple rescan (Ben Woosley)

Pull request description:

  Where the outcome does not depend on the result, apart from a simple
  success check.

Tree-SHA512: e0d29c6fc0c7f99a730289e5a80deb586b2848aead56b5198a71ef01f65374812468dfd57be0b8b076eb9be4090d5101d28d979a1d5c3d2f1caeca77b303e90e
2018-07-25 15:39:04 +02:00
Wladimir J. van der Laan 9f23c16599
Merge #13721: Bugfixes for BIP 174 combining and deserialization
fad231ad41 Fix merging of global unknown data in PSBTs (Andrew Chow)
41df035ee1 Check that PSBT keys are the correct length (Andrew Chow)

Pull request description:

  This PR fixes a few bugs that were found and adds tests checking for these errors.

  Specifically:
  - Single byte keys are checked to actually be one byte.
  - Unknown global data must be merged when combining two PSBTs.

Tree-SHA512: c0e7b4bc607d510cc005aaa7c0813ee58c5467ab7ce4adce485522dfeee92b1af3d29fe89df778b0ea812bb3827e085b30e04d4f4ebcefd8364d809573991332
2018-07-25 15:04:25 +02:00
MarcoFalke a140953907
Merge #13753: scripted-diff: Remove trailing whitespaces
12dd101345 scripted-diff: Remove trailing whitespaces (João Barbosa)

Pull request description:

  The script test/lint/lint-whitespace.sh should prevent new cases.

  This happens in some pulls where the code editor and the author 'git add's them, so this would fix it all.

Tree-SHA512: bcdd3472fcd01a2754e52212c7db1de2fdc422728b06785481954a27162fb72001cb73708329cc56e95bcc5e45c1348ebc4eacc2ccfa6aa12413c7ec450b6a33
2018-07-25 07:09:33 -04:00
fanquake 3828a79711
scripted-diff: prefer MAC_OSX over __APPLE__
-BEGIN VERIFY SCRIPT-
sed -i 's/__APPLE__/MAC_OSX/g' src/compat/byteswap.h src/util.cpp
-END VERIFY SCRIPT-
2018-07-25 07:30:28 +08:00
fanquake fa6e841e89
gui: remove macOS ProgressBar workaround 2018-07-25 07:30:28 +08:00
fanquake 68c272527f
gui: remove SubstituteFonts 2018-07-25 07:30:28 +08:00
Cristian Mircea Messel 6d5fcad576 [gui] Make proxy icon from statusbar clickable
Clicking on the proxy icon will open settings showing the network tab
Create enum Tab in OptionsModel
Use new connect syntax
Use lambda for private slots
2018-07-25 01:03:26 +03:00
João Barbosa 12dd101345 scripted-diff: Remove trailing whitespaces
-BEGIN VERIFY SCRIPT-

sed --in-place'' --regexp-extended 's/[[:space:]]+$//g' $(git grep -I --files-with-matches --extended-regexp '[[:space:]]+$' -- src test  ':!*.svg' ':!src/crypto/sha256_sse4*' ':!src/leveldb' ':!src/qt/locale' ':!src/secp256k1' ':!src/univalue')

-END VERIFY SCRIPT-
2018-07-24 20:46:23 +01:00
MarcoFalke 1211b15bf6
Merge #13656: Remove the boost/algorithm/string/predicate.hpp dependency
e3245f2e7b Removes Boost predicate.hpp dependency (251)

Pull request description:

  This pull request removes the `boost/algorithm/string/predicate.hpp` dependency from the project.

  To replace the the `predicate.hpp` dependency from the project the function calls to `boost::algorithm::starts_with` and `boost::algorithm::ends_with` have been replaced with respectively C++11's `std::basic_string::front` and `std::basic_string::back` function calls.

  Refactors that were not required, but have been done anyways:

  - The Boost function `all` was implicitly made available via the `predicate.hpp` header. Instead of including the appropriate header, function calls to `all` have been replaced with function calls to `std::all_of`.

  - The  `boost::algorithm::is_digit` predicate has been replaced with a custom `IsDigit` function that is locale independent and ASCII deterministic.

Tree-SHA512: 22dda6adfb4d7ac0cabac8cc33e8fb8330c899805acc1ae4ede402c4b11ea75a399414b389dfaa3650d23b47f41351b4650077af9005d598fbe48d5277bdc320
2018-07-24 14:50:05 -04:00
Wladimir J. van der Laan 5f7575e263
Merge #12257: [wallet] Use destination groups instead of coins in coin select
232f96f5c8 doc: Add release notes for -avoidpartialspends (Karl-Johan Alm)
e00b4699cc clean-up: Remove no longer used ivars from CInputCoin (Karl-Johan Alm)
43e04d13b1 wallet: Remove deprecated OutputEligibleForSpending (Karl-Johan Alm)
0128121101 test: Add basic testing for wallet groups (Karl-Johan Alm)
59d6f7b4e2 wallet: Switch to using output groups instead of coins in coin selection (Karl-Johan Alm)
87ebce25d6 wallet: Add output grouping (Karl-Johan Alm)
bb629cb9dc Add -avoidpartialspends and m_avoid_partial_spends (Karl-Johan Alm)
65b3eda458 wallet: Add input bytes to CInputCoin (Karl-Johan Alm)
a443d7a0ca moveonly: CoinElegibilityFilter into coinselection.h (Karl-Johan Alm)
173e18a289 utils: Add insert() convenience templates (Karl-Johan Alm)

Pull request description:

  This PR adds an optional (off by default) `-avoidpartialspends` flag, which changes coin select to use output groups rather than outputs, where each output group corresponds to all outputs with the same destination.

  It is a privacy improvement, as each time you spend some output, any other output that is publicly associated with the destination (address) will also be spent at the same time, at the cost of fee increase for cases where coin select without group restriction would find a more optimal set of coins (see example below).

  For regular use without address reuse, this PR should have no effect on the user experience whatsoever; it only affects users who, for some reason, have multiple outputs with the same destination (i.e. address reuse).

  Nodes with this turned off will still try to avoid partial spending, if the fee of the resulting transaction is not greater than the fee of the original transaction.

  Example: a node has four outputs linked to two addresses `A` and `B`:

  * 1.0 btc to `A`
  * 0.5 btc to `A`
  * 1.0 btc to `B`
  * 0.5 btc to `B`

  The node sends 0.2 btc to `C`. Without `-avoidpartialspends`, the following coin selection will occur:
  * 0.5 btc to `A` or `B` is picked
  * 0.2 btc is output to `C`
  * 0.3 - fee is output to (unique change address)

  With `-avoidpartialspends`, the following will instead happen:
  * Both of (0.5, 1.0) btc to `A` or `B` is picked (one or the other pair)
  * 0.2 btc is output to `C`
  * 1.3 - fee is output to (unique change address)

  As noted, the pro here is that, assuming nobody sends to the address after you spend from it, you will only ever use one address once. The con is that the transaction becomes slightly larger in this case, because it is overpicking outputs to adhere to the no partial spending rule.

  This complements #10386, in particular it addresses @luke-jr and @gmaxwell's concerns in https://github.com/bitcoin/bitcoin/pull/10386#issuecomment-300667926 and https://github.com/bitcoin/bitcoin/pull/10386#issuecomment-302361381.

  Together with `-avoidreuse`, this fully addresses the concerns in #10065 I believe.

Tree-SHA512: 24687a4490ba59cf4198ed90052944ff4996653a4257833bb52ed24d058b3e924800c9b3790aeb6be6385b653b49e304453e5d7ff960e64c682fc23bfc447621
2018-07-24 16:34:03 +02:00
Karl-Johan Alm e00b4699cc
clean-up: Remove no longer used ivars from CInputCoin 2018-07-24 15:05:38 +09:00
Karl-Johan Alm 43e04d13b1
wallet: Remove deprecated OutputEligibleForSpending 2018-07-24 15:05:38 +09:00
Karl-Johan Alm 59d6f7b4e2
wallet: Switch to using output groups instead of coins in coin selection 2018-07-24 15:05:37 +09:00
Karl-Johan Alm 87ebce25d6
wallet: Add output grouping 2018-07-24 15:05:37 +09:00
Karl-Johan Alm bb629cb9dc
Add -avoidpartialspends and m_avoid_partial_spends 2018-07-24 15:05:37 +09:00
Karl-Johan Alm 65b3eda458
wallet: Add input bytes to CInputCoin
With nInputBytes, coin selection can execute without a reference to the COutput
2018-07-24 15:05:36 +09:00
Karl-Johan Alm a443d7a0ca
moveonly: CoinElegibilityFilter into coinselection.h 2018-07-24 15:05:36 +09:00
Karl-Johan Alm 173e18a289
utils: Add insert() convenience templates 2018-07-24 15:05:36 +09:00
Wladimir J. van der Laan 7ebd8c6385
qt: Update translation source messages
Tree-SHA512: f286d4252487863c66e764a780e714739cc4783b6a72ec345973998cf717e5fde69dd960c6df1a4a84247939a159779dc4a9d26e2e0686b782ad5cacf6956caf
2018-07-23 17:23:20 +02:00
Wladimir J. van der Laan c0a47da725
Merge #13719: Avoid creating a temporary vector for size-prefixed elements
84547fa6d4 Avoid creating a temporary vector for size-prefixed elements (Pieter Wuille)

Pull request description:

  This is a simple improvement to the PSBT serialization code, avoiding the need for temporary vectors everywhere.

Tree-SHA512: 9f7243b7169ec8ba00ffad31af03c016ab84e4f76ebac810167f91f5e8008f3827ad59fbcee0cb2bd2334fc26466eb222404af24e7fb6ec040fd78229ebe0fd1
2018-07-23 12:52:53 +02:00
Wladimir J. van der Laan d2186b3db6
Merge #13742: doc: Adjust bitcoincore.org links
fa451511a1 doc: Adjust bitcoincore.org links (MarcoFalke)

Pull request description:

  Minor adjustments to our https://bitcoincore.org/ links:

  Mainly adding links of the Bitcoin Core Github mirror and Bitcoin Core website to the doxygen introduction. (See e.g. current master: https://dev.visucore.com/bitcoin/doxygen/index.html). Also removing the link to bitcoin.org, to not imply there is only one resource that educates about bitcoin.

Tree-SHA512: d4d50f6de4d4b412203934e947889ebc0f564747e26f9190a2cff64234bf9fc3d56b8f056651550ce568170fba448559fa005959ef4e504d990e2fbc96a2ed77
2018-07-23 12:32:58 +02:00
Ben Woosley 984d72ec65
Return the script type from Solver
Because false is synonymous with TX_NONSTANDARD, this conveys the same
information and makes the handling explicitly based on script type,
simplifying each call site.

Prior to this change it was common for the return value to be ignored,
or for the return value and TX_NONSTANDARD to be redundantly handled.
2018-07-22 21:37:00 -04:00
251 e3245f2e7b Removes Boost predicate.hpp dependency
This is a squashed commit that squashes the following commits:

This commit removes the `boost/algorithm/string/predicate.hpp` dependenc
from the project by replacing the function calls to `boost::algorithm::starts_with`
`boost::algorithm::ends_with` and `all` with respectively C++11'
`std::basic_string::front`, `std::basic_string::back`, `std::all_of` function calls

This commit replaces `boost::algorithm::is_digit` with  a locale independent isdigi
function, because the use of the standard library's `isdigit` and `std::isdigit
functions is discoraged in the developer notes
2018-07-22 21:34:45 +02:00
MarcoFalke 0a34593ddb
Merge #13740: trivial: remove unneeded include
0454b56d8a trivial: remove unneeded include (Nikolay Mitev)

Pull request description:

  Remove dead include

Tree-SHA512: 66380fe25259d37a19f955142ad53da24d4927064a84249989f54bebc21d9d688236fb60979acc79f219b05692c4c73b3ebab0872b8d03ab2447b0b44a06c8ed
2018-07-22 11:12:09 -04:00
Wladimir J. van der Laan a6f00ce66f
Merge #13212: Net: Fixed a race condition when disabling the network.
793290f940 Net: Fixed a race condition when disabling the network. (lmanners)

Pull request description:

  This change addresses a race condition where setnetworkactive=false wouldn't always disconnect all peers.

  Before this change, the following could happen:
  1. Thread A -- Begins connecting to a node.
  2. Thread B -- Sets kNetworkActive=false and disconnects connected nodes.
  3. Thread A -- Finishes connecting and adds node to list of connected nodes.

  The node that was connected from Thread A remains connected and active,
  even though kNetworkActive=false.

  To fix the race, disconnections when kNetworkActive=false are now handled in the main network loop.

  fixes #13038

Tree-SHA512: 6d0b7a78ae956358e796efcc034cb532c2e0d824a52ae822a3899eefc7df76327519d1f2d77362c9fddf34ef860abd095d7490d7cc02d0ba7543bf1e8c8f2535
2018-07-22 16:33:00 +02:00
MarcoFalke fa451511a1
doc: Adjust bitcoincore.org links 2018-07-22 10:32:38 -04:00
Wladimir J. van der Laan 6deac922e3
Merge #13633: Drop dead code from Stacks
5617840392 Drop dead code from Stacks (Ben Woosley)

Pull request description:

  Stacks is local to this file, and only used in DataFromTransaction, so
  it's easy to confirm this code is unused.

Tree-SHA512: cc680c99f9b31cb56db70f453087d642f83906ce594c07a6bf3e61427cfbee41441495d440b240419ba3386582cf0670c0999b2f51e7fd56b00e0a0f3f618845
2018-07-22 16:20:07 +02:00
Wladimir J. van der Laan 0d1ebf4d3f
Merge #13733: Utils: Refactor ArgsManager a little
9544a3f3fc tiny refactor for ArgsManager (AtsukiTak)

Pull request description:

  This PR contains some small refactors for `ArgsManager`.

  1. Mark `const` on member function if it possible.
  2. Remove unused `error` argument from `ArgsManager::IsArgKnown`.

  I'm not sure whether these refactors should be separated into another PR. If so, I will do that.

Tree-SHA512: 7df09e7f7c4cdd2e7cd60e34137faa7ca7463be66490f8552fdea3656da6ccc98886e258bdeef21820d197fc2fde06ab2d3405205f5de53f258df7c191d206b0
2018-07-22 16:09:06 +02:00
Nikolay Mitev 0454b56d8a trivial: remove unneeded include 2018-07-22 16:49:14 +03:00
MarcoFalke 05714f96e4
Merge #11762: Avoid locking mutexes that are already held by the same thread
01a06d6686 Avoid locking mutexes that are already held by the same thread (practicalswift)

Pull request description:

  Avoid locking mutexes that are already held by the same thread. These are reentrant mutexes, but still no need to lock them more than once per thread :-)

Tree-SHA512: e2fb85882e8800892fd8e8170f3c13128d6acfeb14d7b69fb9555f2b7ad0884fb201cf945b8144ffaf6fb1253c28af7c8c6c435319a7ae30ca003f28aa645a98
2018-07-22 09:41:36 -04:00
MarcoFalke 10b9a811b6
Merge #12764: doc: Remove field in getblocktemplate help that has never been used.
ac8a1d092e [RPC] Remove field in getblocktemplate help that has never been used (Conor Scott)

Pull request description:

  [BIP 22 - getblocktemplate](https://github.com/bitcoin/bips/blob/master/bip-0022.mediawiki#Transactions%20Object%20Format) specifies an optional flag, `required` if the transaction must be in the block.

  Luke's implementation #936 did not include this flag, and it was later added to the help description in #3246 (more than a year later) but the field was still never actually implemented. As far as I can tell, bitcoin core would have never actually included this in a `getblocktemplate` call, so it seems logical to remove it from the help description.

  If I am missing something or this is considered harmless - I can close the PR.

Tree-SHA512: f25dda51cc4e1512aff69309be04e3053bdccc1cf03c8d58e8866aa1fdf9d86cc57df872e85528351fc8a8d6d64a8f46a36c513680834762d854f368fbeb0f44
2018-07-22 09:40:18 -04:00
MarcoFalke 62baa28787
Merge #13691: Remove redundant variables, statements and forward declarations
3dee4cc509 Remove redundant statement (practicalswift)
99be644966 Remove redundant unused variables (practicalswift)
66ed242343 Remove redundant forward declaration (practicalswift)

Pull request description:

  Remove redundant …
  * ~access modifiers,~
  * forward declarations,
  * unused variables,
  * statements, and
  * ~return types from lambdas.~

Tree-SHA512: 328bb7d9c45398e44ecbee32095b6376879470dfddbc2180e037620d8390d524b51d7fda112fd58a078715e04432b24dd6998a2459f3550aa0498aa68de866d4
2018-07-22 09:38:10 -04:00
MarcoFalke 59407fce54
Merge #13722: trivial: Replace CPubKey::operator[] with CPubKey::vch where possible
6755569840 trivial: Replace CPubKey::operator[] with CPubKey::vch where possible (Nikolay Mitev)

Pull request description:

  Use variable name instead of calling operator[] through &(*this)[0]

Tree-SHA512: 7054ffda0fa33fb45d4d9f3b29698643f02fd1421d78d5197a0881f2c368dc410647fd2e1a6feb8048e30f8ab8bc2fa8749bf42b9ccbe42c30de8ff80ac45274
2018-07-22 09:09:07 -04:00
MarcoFalke e8c74348d3
Merge #13683: wallet: Introduce assertion to document the assumption that cache and cache_used are always set in tandem
d06330396f wallet: Avoid potential null pointer dereference in CWalletTx::GetAvailableCredit(...) (practicalswift)

Pull request description:

  Avoid potential null pointer dereference in `CWalletTx::GetAvailableCredit(...)`.

  Introduced in 4279da4785.

Tree-SHA512: 92d1da9682f0bab11f6f96395ca30549331b0a056cbceb7e1a7f98b3d17d10082aaeed0907cafd46f4164b0e0f4b77e01f78bfd7d24e0503a66c6942ae842aa5
2018-07-22 08:34:09 -04:00
MarcoFalke eeae4711f3
Merge #13726: Utils and libraries: Removes the boost/algorithm/string/join dependency
5f019d5354 Removes the boost/algorithm/string/join dependency (251)

Pull request description:

  This commit removes the `boost/algorithm/string/join` dependency from the project by replacing `boost::algorithm::join` with the helper function proposed by @MarcoFalke in https://github.com/bitcoin/bitcoin/pull/13726#discussion_r204159967

Tree-SHA512: d4ba3e7621b76bd5210aec9b8d6c320f7ee963d7f902e6d2d3fc0eadbee1cd77799e5c09be9c11452d2825f25740fc436cdec3a6b6c66ced674d771e4ed306ae
2018-07-21 22:38:31 -04:00
AtsukiTak 9544a3f3fc tiny refactor for ArgsManager
This commit contains 2 refactors.

1. mark "const" on ArgsManager::GetHelpMessage and IsArgKnown.
2. remove unused "error" argument from ArgsManager::IsArgKnown.

Firstly, I mark "const" on where it is possible to. It is mentioned
before (e.g. https://github.com/bitcoin/bitcoin/pull/13190#pullrequestreview-118823133).

And about 2nd change, ArgsManager::IsArgKnown was added at commit #4f8704d which was
merged at PR #13112. But from its beggining, "error" argument never be used.
I think it should be refactored.
2018-07-22 03:16:53 +09:00
practicalswift 01a06d6686 Avoid locking mutexes that are already held by the same thread 2018-07-21 19:46:04 +02:00
Nikolay Mitev 6755569840 trivial: Replace CPubKey::operator[] with CPubKey::vch where possible 2018-07-21 05:35:16 +03:00
251 5f019d5354 Removes the boost/algorithm/string/join dependency
This commit removes the `boost/algorithm/string/join` dependency
from the project by replacing `boost::algorithm::join` with
a simple helper function.
2018-07-21 01:14:25 +02:00
Ben Woosley 5b82aa7352
Fix bitcoin-cli --version
By declaring the relevant option.

Note contrib/devtools/gen-manpages.sh relies on this version information.
2018-07-20 14:24:47 -04:00
Wladimir J. van der Laan 2dc5ab6378
Merge #13482: Remove boost::program_options dependency
f447a0a707 Remove program options from build system (Chun Kuan Lee)
11588c639e Replace boost program_options (Chun Kuan Lee)

Pull request description:

  Concept from #12744, but without parsing negated options.

Tree-SHA512: 7f418744bb8934e313d77a5f162633746ef5d043de802b9c9cd9f7c1842e7e566eb5f171cd9e2cc13317281b2449c6fbd553fa4f09b837e6af2f5d2b2aabdca2
2018-07-20 16:45:44 +02:00
Wladimir J. van der Laan c575260f80
Merge #11637: p2p: Remove dead service bits code
fa4bf92be9 Remove dead service bits code (MarcoFalke)

Pull request description:

  Seems fine to remove for the upcoming 0.17 release

  Fixes #10993

Tree-SHA512: 3a4664b787e3da399bcaaba693619bd384826df14f469dbdfbbfffc540d9da3f2b322cda262b43388376785f77907c2540541c239ab0fca82bd7eb69d02b6b7a
2018-07-20 15:13:49 +02:00
Wladimir J. van der Laan 6b6e854362
Merge #9662: Add createwallet "disableprivatekeys" option: a sane mode for watchonly-wallets
a3fa4d6a6a QA: Fix bug in -usecli logic that converts booleans to non-lowercase strings (Jonas Schnelli)
4704e5f074 [QA] add createwallet disableprivatekey test (Jonas Schnelli)
c7b8f343e9 [Qt] Disable creating receive addresses when private keys are disabled (Jonas Schnelli)
2f15c2bc20 Add disable privatekeys option to createwallet (Jonas Schnelli)
cebefba085 Add option to disable private keys during internal wallet creation (Jonas Schnelli)
9995a602a6 Add facility to store wallet flags (64 bits) (Jonas Schnelli)

Pull request description:

  This mode ('createwallet {"disableprivatekeys": true}') is intended for a sane pure watch-only mode, ideal for a use-case where one likes to use Bitcoin-Core in conjunction with a hardware-wallet or another solutions for cold-storage.

  Since we have support for custom change addresses in `fundrawtransaction`, pure watch-only wallets including coin-selection are possible and do make sense for some use cases.

  This new mode disables all forms of private key generation and ensure that no mix between hot and cold keys are possible.

Tree-SHA512: 3ebe7e8d54c4d4e5f790c348d4c292d456f573960a5b04d69ca5ef43a9217c7e7671761c6968cdc56f9a8bc235f3badd358576651af9f10855a0eb731f3fc508
2018-07-20 14:28:50 +02:00
Akio Nakamura 46340b3337 [bench] Add benchmark for unserialize prevector
This patch adds 2 benchmarks to measure for performance of
the unserialization of prevector.
2018-07-20 17:57:01 +09:00
Andrew Chow fad231ad41 Fix merging of global unknown data in PSBTs
Actually merge the global unknown key-value pairs.

Add a test for merging unknown key-value pairs.
2018-07-19 18:49:51 -07:00
Andrew Chow 41df035ee1 Check that PSBT keys are the correct length
Checks that all of the one byte type keys are actually one byte and
throw an error if they are not.

Add tests for each type to check for this behavior.
2018-07-19 18:29:25 -07:00
Pieter Wuille 84547fa6d4 Avoid creating a temporary vector for size-prefixed elements 2018-07-19 16:16:37 -07:00
MarcoFalke aba2e666d7
Merge #13712: wallet: Fix non-determinism in ParseHDKeypath(...). Avoid using an uninitialized variable in path calculation.
27ee53c1ae wallet: Add error handling. Check return value of ParseUInt32(...) in ParseHDKeypath(...). (practicalswift)
7223263899 wallet: Add tests for ParseHDKeypath(...) (practicalswift)

Pull request description:

  Add error handling. Check return value of `ParseUInt32(...)` in `ParseHDKeypath(...)`.

  `ParseUInt32(...)` returns `false` if the entire string could not be parsed or when an overflow or underflow occurred. In such case the uninitialized variable `number` would be used in the calculation of `path` (prior to this commit).

  An example key path triggering this is `m/0/4294967296`:

  ```
    ParseHDKeypath("m/0/4294967296", keypath);
  ```

  `4294967296` is `1` + `0xFFFFFFFF` (`uint32_t` max: `4294967295`).

  Introduced in a4b06fb42e which was merged into `master` 14 hours ago as part of #13557 ("BIP 174 PSBT Serializations and RPCs").

Tree-SHA512: e5ff423f67c18d82c1231bde6343587a453e793c32004d93dc9b61be6d9372b57a6b2c9978d9eb1000d6cc82fd180f2486013f928dca737fb92daad22c16e467
2018-07-19 17:39:59 -04:00
MarcoFalke f281f8f755
Merge #13074: [trivial] Correct help text for importaddress RPC
2c71edc2fc [wallet] [rpc] Fix importaddress help text (John Newbery)

Pull request description:

  Help text for `importaddress` referred to the first parameter as `script`, when in fact it's `address`. Calling with a script argument fails:

  ```
  → bcli -named importaddress script=2N3qhMpHK8WNo7wv87W9eHMgvGyJU1593Ei
  error code: -8
  error message:
  Unknown named parameter script
  → bcli -named importaddress address=2N3qhMpHK8WNo7wv87W9eHMgvGyJU1593Ei
  # success!
  ```

Tree-SHA512: 24dcb2cbd0a43e25896b1c67fa0386df2453ec04d49a339e10992417b3921ce3df8a6aa5abba7d2237d6188b018948b2a21ea2f04d37120ad36c31c7b7fc9f1c
2018-07-19 17:34:12 -04:00
practicalswift 27ee53c1ae wallet: Add error handling. Check return value of ParseUInt32(...) in ParseHDKeypath(...). 2018-07-19 21:13:03 +02:00
practicalswift 7223263899 wallet: Add tests for ParseHDKeypath(...) 2018-07-19 21:13:03 +02:00
Wladimir J. van der Laan 4a3e8c5aa6
Merge #13500: [wallet] Decouple wallet version from client version
cd3f4aa808 Decouple wallet version from client version (Andrew Chow)

Pull request description:

  Instead of comparing version numbers in the wallet to the client version number, compare them to the latest supported wallet version in the client. This allows for wallet version numbers to be unrelated to the client version number.

Tree-SHA512: 69c3e1f45a40bde01d622d504a803fea32fc14e2e27b14b0729725349d8592d56ebca26fd06f117fd6f5164fb4ce980122751b6370f6e25f1a947dbdf4143ddd
2018-07-18 20:58:54 +02:00
Wladimir J. van der Laan b654723461
Merge #13557: BIP 174 PSBT Serializations and RPCs
020628e3a4 Tests for PSBT (Andrew Chow)
a4b06fb42e Create wallet RPCs for PSBT (Andrew Chow)
c27fe419ef Create utility RPCs for PSBT (Andrew Chow)
8b5ef27937 SignPSBTInput wrapper function (Andrew Chow)
58a8e28918 Refactor transaction creation and transaction funding logic (Andrew Chow)
e9d86a43ad Methods for interacting with PSBT structs (Andrew Chow)
12bcc64f27 Add pubkeys and whether input was witness to SignatureData (Andrew Chow)
41c607f09b Implement PSBT Structures and un/serialization methods per BIP 174 (Andrew Chow)

Pull request description:

  This Pull Request fully implements the [updated](https://github.com/bitcoin/bips/pull/694) BIP 174 specification. It is based upon #13425 which implements the majority of the signing logic.

  BIP 174 specifies a binary transaction format which contains the information necessary for a signer to produce signatures for the transaction and holds the signatures for an input while the input does not have a complete set of signatures.

  This PR contains structs for PSBT, serialization, and deserialzation code. Some changes to `SignatureData` have been made to support detection of UTXO type and storing public keys.

  ***

  Many RPCs have been added to handle PSBTs.

  `walletprocesspsbt` takes a PSBT format transaction, updates the PSBT with any inputs related to this wallet, signs, and finalizes the transaction. There is also an option to not sign and just update.

  `walletcreatefundedpsbt` creates a PSBT from user provided data in the same form as createrawtransaction. It also funds the transaction and takes an options argument in the same form as `fundrawtransaction`. The resulting PSBT is blank with no input or output data filled in. It is analogous to a combination of `createrawtransaction` and `fundrawtransaction`

  `decodepsbt` takes a PSBT and decodes it to JSON. It is analogous to `decoderawtransaction`

  `combinepsbt` takes multiple PSBTs for the same tx and combines them. It is analogous to `combinerawtransaction`

  `finalizepsbt` takes a PSBT and finalizes the inputs. If all inputs are final, it extracts the network serialized transaction and returns that instead of a PSBT unless instructed otherwise.

  `createpsbt` is like `createrawtransaction` but for PSBTs instead of raw transactions.

  `convertpsbt` takes a network serialized transaction and converts it into a psbt. The resulting psbt will lose all signature data and an explicit flag must be set to allow transactions with signature data to be converted.

  ***

  This supersedes #12136

Tree-SHA512: 1ac7a79e5bc669933f0a6fcc93ded55263fdde9e8c144a30266b13ef9f62aacf43edd4cbca1ffbe003090b067e9643c9298c79be69d7c1b10231b32acafb6338
2018-07-18 20:25:44 +02:00
Wladimir J. van der Laan 585db54dd1
Merge #13655: bitcoinconsensus: invalid flags error should be set to bitcoinconsensus_err
417b6c1d29 bitcoinconsensus: invalid flags should be set to bitcoinconsensus_error type, add test cases covering bitcoinconsensus error codes (Thomas Kerin)

Pull request description:

  A check was added to the bitcoinconsensus verify_script codepath to ensure that callers only used _exposed_ interpreter flags. I think this error should be written to `bitcoinconsensus_err* err` and not returned by verify_script?

  I modified the check so it indicates the error using *err like the others, and added tests covering the error codes.

Tree-SHA512: 8ab370e56956a7d4740f83475e6078774affd663ac92383a02b85295da550f1b4f7a7a68f32ed5c5bcb39d98e2f15ec0b76de8399887e7763eb7c1e21d131093
2018-07-18 17:19:15 +02:00
Wladimir J. van der Laan 0d8d6be791
Merge #13672: Modified in_addr6 cast in CConman class to work with msvc
822a2a33a7 Modified in_addr6 cast in CConman class to work with msvc. (Aaron Clauson)

Pull request description:

  Fix to allow net.cpp to compile with MSVC. Without this fix the `(in6_addr)IN6ADDR_ANY_INIT` implicit cast generates a compilation error.

Tree-SHA512: f21c5002401dc93564dcf8d49fbafe7c03ad4182df1616d2ee201e2e172f1d696ca7982fb5b42a3b7d6878c8649823044a858401b4172239fb4b0cc2a38db282
2018-07-18 15:03:27 +02:00
practicalswift 3dee4cc509 Remove redundant statement 2018-07-18 09:39:31 +02:00
practicalswift 99be644966 Remove redundant unused variables 2018-07-18 09:39:31 +02:00
practicalswift 66ed242343 Remove redundant forward declaration 2018-07-18 09:39:31 +02:00
Chun Kuan Lee 11588c639e Replace boost program_options 2018-07-18 02:48:25 +00:00
Ben Woosley 33539cb34b
Extract MakeUnique into utilmemory.h
And use it to reduce chainparamsbase's direct reliance on util.h to
only args handling.

utilmemory.h can be replaced with <memory> once we move to C++14.
2018-07-17 13:56:21 -04:00
Wladimir J. van der Laan 30640f8c2d
Merge #13680: [doc] Remove outdated comment about miner ignoring CPFP
db6eb90094 [doc] Remove outdated comment about mining code ignoring CPFP (James O'Beirne)

Pull request description:

  BlockAssembler chooses transactions on the basis of packages (which incorporate
  unconfirmed ancestors into feerate), so the specified RBF comment about mining
  code ignoring CPFP is out of date.

Tree-SHA512: a4c1e60fee0a8f450526d565951187f869d000febce0eea8a8d2e18bb140c3c1b8602953d9dcab2d1e8d0c4fc8d392c67eb0773d67e52080d48e6b9bf13f9ee2
2018-07-17 17:20:37 +02:00
Wladimir J. van der Laan 8fceae0d6f
Merge #12196: Add scantxoutset RPC method
be98b2d9a8 [QA] Add scantxoutset test (Jonas Schnelli)
eec7cf7b33 scantxoutset: mention that scanning by address will miss P2PK txouts (Jonas Schnelli)
94d73d32ab scantxoutset: support legacy P2PK script type (Jonas Schnelli)
892de1dfea scantxoutset: add support for scripts (Jonas Schnelli)
78304941f7 Blockchain/RPC: Add scantxoutset method to scan UTXO set (Jonas Schnelli)
9048575511 Add FindScriptPubKey() to search the UTXO set (Jonas Schnelli)

Pull request description:

  Alternative to #9152.

  This takes `<n>` pubkeys and optionally  `<n>` xpubs (together with a definable lookup windows where the default is 0-1000) and looks up common scripts in the UTXO set of all given or derived keys.

  The output will be an array similar to `listunspent`. That array is compatible with `createrawtransaction` as well as with `signrawtransaction`.

  This makes it possible to prepare sweeps and have them signed in a secure (cold) space.

Tree-SHA512: a2b22a117cf6e27febeb97e5d6fe30184926d50c0c7cbc77bb4121f490fed65560c52f8eac67a9720d7bf8f420efa42459768685c7e7cc03722859f51a5e1e3b
2018-07-17 16:03:16 +02:00
MarcoFalke f8a32a316b
Merge #13682: bench: Remove unused variable
fa39f674ae bench: Remove unused variable (practicalswift)

Pull request description:

  Remove unused variable `vch`.

Tree-SHA512: 624d206d27453ec071d20ca52d7f9e142710ebe7529fc793beb98a61c6a74ad481f4433d14401b7761070746d99e0aa35dd67568a017b18617d6be88de6f3105
2018-07-17 08:55:46 -04:00
MarcoFalke cbc9b50734
Merge #13663: tests: Avoid read/write to default datadir
fa43a4138b bench_bitcoin: Avoid read/write to default datadir (MarcoFalke)
ea80b81e2e test_bitcoin: Avoid read/write to default datadir (MarcoFalke)

Pull request description:

  tests should never read or write and potentially corrupt the default datadir, so try to avoid it.

Tree-SHA512: ee446ff4bf59da2aed38c2e4758581d6103e9d4c35a118497e9ec21d566ba33d913e160c2d7ba2ea6f937f000343ecea3816154bd87ee47f64f5b0cf9e88f6e0
2018-07-17 08:05:26 -04:00
practicalswift d06330396f wallet: Avoid potential null pointer dereference in CWalletTx::GetAvailableCredit(...) 2018-07-17 10:58:22 +02:00
practicalswift fa39f674ae bench: Remove unused variable 2018-07-17 10:11:57 +02:00
Andrew Chow 020628e3a4 Tests for PSBT
Added functional tests for PSBT that test the RPCs. Also added all
of the BIP 174 test vectors (except for the updater tests) in the
functional tests.

Added a Unit test for the BIP 174 updater test vector.
2018-07-16 17:05:30 -07:00
Andrew Chow a4b06fb42e Create wallet RPCs for PSBT
walletprocesspsbt takes a PSBT format transaction, updates the
PSBT with any inputs related to this wallet, signs, and finalizes
the transaction. There is also an option to not sign and just
update.

walletcreatefundedpsbt creates a PSBT from user provided data
in the same form as createrawtransaction. It also funds the transaction
and takes an options argument in the same form as fundrawtransaction.
The resulting PSBT is blank with no input or output data filled
in.
2018-07-16 16:08:24 -07:00
Andrew Chow c27fe419ef Create utility RPCs for PSBT
decodepsbt takes a PSBT and decodes it to JSON

combinepsbt takes multiple PSBTs for the same tx and combines them.

finalizepsbt takes a PSBT and finalizes the inputs. If all inputs
are final, it extracts the network serialized transaction and returns
that instead of a PSBT unless instructed otherwise.

createpsbt is like createrawtransaction but for PSBTs instead of
raw transactions.

convertpsbt takes a network serialized transaction and converts it
into a psbt. The resulting psbt will lose all signature data and
an explicit flag must be set to allow transactions with signature
data to be converted.
2018-07-16 16:08:24 -07:00
James O'Beirne db6eb90094 [doc] Remove outdated comment about mining code ignoring CPFP
BlockAssembler chooses transactions on the basis of packages (which incorporate
unconfirmed ancestors into feerate), so the specified RBF comment about mining
code ignoring CPFP is out of date.
2018-07-16 18:34:28 -04:00
Pieter Wuille 347b4ff825 Initialize m_next_send_inv_to_incoming 2018-07-16 14:08:38 -07:00
Pieter Wuille f8d470e246
Merge #13298: Net: Bucketing INV delays (1 bucket) for incoming connections to hide tx time
d45b344ffd Bucket for inbound when scheduling invs to hide tx time (Gleb)

Pull request description:

  It has been brought up to my attention that current random delays mechanism (originally intended to obfuscate transaction metadata) allows to easily estimate the time a transaction was received by a node.

  It may be done by connecting multiple observer nodes to the same node. Each of those nodes will generate its own schedule of delays. Combined metadata regarding those events from different sources allows an observer to estimate transaction time.

  After this patch a spy won't gain additional information by just creating multiple connections to a target.

Tree-SHA512: c71dae5ff350b614cb40a8e201fd0562d3e03e3e72a5099718cd451f0d84c66d5e52bbaf0d5b4b75137514c8efdedcc6ef4df90142b360153f04ad0721545ab1
2018-07-16 10:37:02 -07:00
Wladimir J. van der Laan 17943f77bd
Merge #13652: rpc: Fix that CWallet::AbandonTransaction would leave the grandchildren, etc. active
89e70f9d7f Fix that CWallet::AbandonTransaction would only traverse one level (Ben Woosley)

Pull request description:

  Prior to this change, it would mark only the first layer of
  child transactions abandoned, due to always following the input `hashTx`
  rather than the current `now` tx.

Tree-SHA512: df068b49637d299ad73237c7244005fe5aa966d6beae57aff12e6948f173d9381e1b5d08533f7e3a1416991ed57f9f1f7b834057141d85c07dc60bb1f0872cea
2018-07-16 14:53:30 +02:00
Aaron Clauson 822a2a33a7 Modified in_addr6 cast in CConman class to work with msvc. 2018-07-16 16:29:27 +10:00
Mason Simon c64cc1bd94 scripted-diff: Fix references to share/rpcuser (now share/rpcauth)
Commit 3fdb29778a renamed share/rpcuser to share/rpcauth but left references to the old path in code; this commit fixes the old references.

Performed update using https://github.com/facebook/codemod with command: `codemod --extensions cpp,py,md 'share/rpcuser' 'share/rpcauth'`

-BEGIN VERIFY SCRIPT-
git grep --files-with-matches 'share/rpcuser' src/*.cpp | xargs sed -i -E 's:share/rpcuser:share/rpcauth:g'
git grep --files-with-matches 'share/rpcuser' test/functional/*.py | xargs sed -i -E 's:share/rpcuser:share/rpcauth:g'
-END VERIFY SCRIPT-
2018-07-15 17:56:02 -07:00
Jonas Schnelli eec7cf7b33
scantxoutset: mention that scanning by address will miss P2PK txouts 2018-07-15 21:18:11 +01:00
Jonas Schnelli 94d73d32ab
scantxoutset: support legacy P2PK script type 2018-07-15 21:18:10 +01:00
Jonas Schnelli 892de1dfea
scantxoutset: add support for scripts 2018-07-15 21:18:06 +01:00
Jonas Schnelli 78304941f7
Blockchain/RPC: Add scantxoutset method to scan UTXO set 2018-07-15 21:17:23 +01:00
Daniel Kraft a1a998cf24 wallet: Fix backupwallet for multiwallets
backupwallet was broken for multiwallets in their own directories
(i.e. something like DATADIR/wallets/mywallet/wallet.dat).  In this
case, the backup would use DATADIR/wallets/wallet.dat as source file
and not take the specific wallet's directory into account.

This led to either an error during the backup (if the wrong source
file was not present) or would silently back up the wrong wallet;
especially the latter behaviour can be quite bad for users.
2018-07-15 16:38:33 +02:00
Ben Woosley 3fe836b78d
[moveonly] Extract RescanWallet to handle a simple rescan
Where the outcome does not depend on the result, apart from a simple
success check.
2018-07-14 12:42:28 -04:00
Sjors Provoost 65a449f8e3
Explain when reindex-chainstate can be used instead of reindex 2018-07-14 17:48:16 +02:00
MarcoFalke fa43a4138b
bench_bitcoin: Avoid read/write to default datadir 2018-07-14 10:46:54 -04:00
MarcoFalke ea80b81e2e test_bitcoin: Avoid read/write to default datadir 2018-07-14 10:36:14 -04:00
Gleb d45b344ffd Bucket for inbound when scheduling invs to hide tx time 2018-07-13 23:14:35 -07:00
Pieter Wuille b25a4c2284
Merge #13072: Update createmultisig RPC to support segwit
f40b3b82df [tests] functional test for createmultisig RPC (Anthony Towns)
b9024fdda3 segwit support for createmultisig RPC (Anthony Towns)
d58055d25f Move AddAndGetDestinationForScript from wallet to outputype module (Anthony Towns)
9a44db2e46 Add outputtype module (Anthony Towns)

Pull request description:

  Adds an "address_type" parameter that accepts "legacy", "p2sh-segwit", and "bech32" to choose the type of address created. Defaults to "legacy" rather than the value of the `-address-type` option for backwards compatibility.

  As part of implementing this, OutputType is moved from wallet into its own module, and `AddAndGetDestinationForScript` is changed to apply to a `CKeyStore` rather than a wallet, and to invoke `keystore.AddCScript(script)` itself rather than expecting the caller to have done that.

  Fixes #12502

Tree-SHA512: a08c1cfa89976e4fd7d29caa90919ebd34a446354d17abb862e99f2ee60ed9bc19d8a21a18547c51dc3812cb9fbed86af0bef2f1e971f62bf95cade4a7d86237
2018-07-13 20:31:13 -07:00
Pieter Wuille 1329ef1f00
Merge #13651: [moveonly] Extract CWallet::MarkInputsDirty, and privatize AddToWalletIfInvolvingMe
17e6aa8e33 Privatize CWallet::AddToWalletIfInvolvingMe (Ben Woosley)
b7f5650942 Extract CWallet::MarkInputsDirty (Ben Woosley)

Pull request description:

  Thus reducing code and surface area of CWallet.

Tree-SHA512: 31a99acc77ef3438ef9b95d60030972b707bd69d6e7b1498a5f776b219d9aabc83464f75bfec7bad5cb635d0b2d686c389914e5cc57a4bb0b93c47bd82ca608c
2018-07-13 20:24:37 -07:00
Pieter Wuille 9a1ad2c5cb
Merge #11658: During IBD, when doing pruning, prune 10% extra to avoid pruning again soon after
ac51a26bdc During IBD, when doing pruning, prune 10% extra to avoid pruning again soon after (Luke Dashjr)

Pull request description:

  Pruning forces a chainstate flush, which can defeat the dbcache and harm performance significantly.

  Alternative to #11359

Tree-SHA512: 631e4e8f94f5699e98a2eff07204aa2b3b2325b2d92e8236b8c8d6a6730737a346e0ad86024e705f5a665b25e873ab0970ce7396740328a437c060f99e9ba4d9
2018-07-13 20:16:41 -07:00
Pieter Wuille 1e90862f5d
Merge #13417: [net] Tighten scope in net_processing
3339ba28e9 Make g_enable_bip61 a member variable of PeerLogicValidation (Jesse Cohen)
6690a28606 Restrict as much as possible in net_processing to translation unit (Jesse Cohen)
1d4df02b7e [move-only] Move things only referenced in net_processing out of header file (Jesse Cohen)
02bbc05310 Rescope g_enable_bip61 to net_processing (Jesse Cohen)

Pull request description:

  As part of a larger effort to decouple net_processing and validation a bit, these are a bunch of simple scope cleanups. I've moved things out of the header file that are only referenced in net_processing and added static (or anonymous namespace) modifiers to everything possible in net_processing.

  There are a handful of functions which could be static except that they are exposed for the sake of unit testing - these are explicitly commented. There has been some discussion of a compile time annotation, but no conclusion has been reached on that yet.

  This is somewhat related to other prs #12934 #13413 #13407 and will be followed by prs that reduce reliance on cs_main to synchronize data structures which are translation unit local to net_processing

Tree-SHA512: 46c9660ee4e06653feb42ba92189565b0aea17aac2375c20747c0d091054c63829cbf66d2daddf65682b58ce1d6922e23aefea051a7f2c8abbb6db253a609082
2018-07-13 20:10:55 -07:00
Pieter Wuille ad552a54c5
Merge #13566: Fix get balance
702ae1e21a [RPC] [wallet] allow getbalance to use min_conf and watch_only without accounts. (John Newbery)
cf15761f6d [wallet] GetBalance can take a min_depth argument. (John Newbery)
0f3d6e9ab7 [wallet] factor out GetAvailableWatchOnlyBalance() (John Newbery)
7110c830f8 [wallet] deduplicate GetAvailableCredit logic (John Newbery)
ef7bc8893c [wallet] Factor out GetWatchOnlyBalance() (John Newbery)
4279da4785 [wallet] GetBalance can take an isminefilter filter. (John Newbery)

Pull request description:

  #12953 inadvertently removed the functionality to call `getbalance "*" <int> <bool>` to get the wallet's balance with either minconfs or include_watchonly.

  This restores that functionality (when `-deprecatedrpc=accounts`), and also makes it possible to call ``getbalance minconf=<int> include_watchonly=<bool>` when accounts are not being used.

Tree-SHA512: 67e84de9291ed6d34b23c626f4dc5988ba0ae6c99708d02b87dd3aaad3f4b6baa6202a66cc2dadd30dd993a39de8036ee920fcaa8cbb1c5dfe606e6fac183344
2018-07-13 19:46:31 -07:00
Pieter Wuille d6b2235ca4
Merge #13630: Drop unused pindexRet arg to CMerkleTx::GetDepthInMainChain
d6f39b6c64 Drop unused pindexRet arg to CMerkleTx::GetDepthInMainChain (Ben Woosley)

Pull request description:

Tree-SHA512: 5f064a47e71113f90f296ab36dae92173ff3fc632ab4e1e85dc71d556cb9239d15939b1e542f4292dab93d336795b7f2e4ae64f6984303c852df8d24f54ccebe
2018-07-13 19:33:41 -07:00
Andrew Chow 8b5ef27937 SignPSBTInput wrapper function
The SignPSBTInput function takes a PSBTInput, SignatureData, SigningProvider,
and other data necessary for signing. It fills the SignatureData with data from
the PSBTInput, retrieves the UTXO from the PSBTInput, signs and finalizes the
input if possible, and then extracts the results from the SignatureData and
puts them back into the PSBTInput.
2018-07-13 14:27:31 -07:00
Andrew Chow 58a8e28918 Refactor transaction creation and transaction funding logic
In preparation for more create transaction and fund transcation RPCs,
refactor the transaction creation and funding logic into separate
functions.
2018-07-13 14:27:31 -07:00
Andrew Chow e9d86a43ad Methods for interacting with PSBT structs
Added methods which move data to/from SignaturData objects to
PSBTInput and PSBTOutput objects.

Added sanity checks for PSBTs as a whole which are done immediately
after deserialization.

Added Merge methods to merge a PSBT into another one.
2018-07-13 14:27:31 -07:00
Andrew Chow 12bcc64f27 Add pubkeys and whether input was witness to SignatureData
Stores pubkeys in SignatureData and retrieves them when using GetPubKey().

Stores whether the signatures in a SignatureData are for a witness input.
2018-07-13 14:27:31 -07:00
Andrew Chow 41c607f09b Implement PSBT Structures and un/serialization methods per BIP 174 2018-07-13 14:27:31 -07:00
Thomas Kerin 417b6c1d29 bitcoinconsensus: invalid flags should be set to bitcoinconsensus_error type, add test cases covering bitcoinconsensus error codes 2018-07-13 22:13:10 +01:00
Ben Woosley 17e6aa8e33
Privatize CWallet::AddToWalletIfInvolvingMe
And document in the header.
2018-07-13 16:18:14 -04:00
Ben Woosley b7f5650942
Extract CWallet::MarkInputsDirty
To avoid repeated implementations.
2018-07-13 16:18:13 -04:00
Jonas Schnelli 619cd29393
Merge #12944: [wallet] ScanforWalletTransactions should mark input txns as dirty
3c292cc19 ScanforWalletTransactions should mark input txns as dirty (Gregory Sanders)

Pull request description:

  I'm hitting a corner case in my mainnet wallet where I load a restore a wallet, call `rescanblockchain` from RPC, and it's "double counting" an output I've sent to myself since currently it never marks input transactions as dirty. This is fixed by a restart of the wallet.

  Note that this only happens with keys with birthdate *after* the blocks containing the spent funds which gets scanned on startup, so it's hard to test without a set seed function.

Tree-SHA512: ee1fa152bb054b57ab4c734e355df10d241181e0372c81d583be61678fffbabe5ae60b09b05dc1bbbcfb4838df9d8538791d4c1d80a09b84d78ad2f50dcb0a61
2018-07-13 20:34:43 +01:00
Ben Woosley 93de2891fa
wallet: assert to ensure accuracy of CMerkleTx::GetBlocksToMaturity
According to my understanding, it should not be possible for coinbase
transactions to be conflicting, thus it should not be possible for
GetDepthInMainChain to return a negative result. If it did, this would
also result in innacurate results for GetBlocksToMaturity due to the
math therein. asserting ensures accuracy.
2018-07-13 12:41:45 -04:00
Ben Woosley 89e70f9d7f
Fix that CWallet::AbandonTransaction would only traverse one level
Prior to this change, it would mark only the first layer of
child transactions abandoned, due to always following the input hashTx
rather than the current now tx.
2018-07-13 11:16:08 -04:00
Ben Woosley 5617840392
Drop dead code from Stacks
Stacks is local to this file, and only used in DataFromTransaction, so
it's easy to confirm this code is unused.
2018-07-12 18:44:33 -04:00
Jonas Schnelli 4704e5f074
[QA] add createwallet disableprivatekey test 2018-07-12 20:32:07 +01:00
Jonas Schnelli c7b8f343e9
[Qt] Disable creating receive addresses when private keys are disabled 2018-07-12 20:32:07 +01:00
Jonas Schnelli 2f15c2bc20
Add disable privatekeys option to createwallet 2018-07-12 20:32:07 +01:00
Jonas Schnelli cebefba085
Add option to disable private keys during internal wallet creation 2018-07-12 20:31:57 +01:00
Jonas Schnelli 9048575511
Add FindScriptPubKey() to search the UTXO set 2018-07-12 20:10:05 +01:00
Wladimir J. van der Laan dcb154e5aa
Merge #13177: GCC-7 and glibc-2.27 back compat code
253f592909 Add stdin, stdout, stderr to ignored export list (Chun Kuan Lee)
fc6a9f2ab1 Use IN6ADDR_ANY_INIT instead of in6addr_any (Cory Fields)
908c1d7745 GCC-7 and glibc-2.27 compat code (Chun Kuan Lee)

Pull request description:

  The `__divmoddi4` code was modified from https://github.com/gcc-mirror/gcc/blob/master/libgcc/libgcc2.c . I manually find the older glibc version of log2f by objdump, use `.symver` to specify the certain version.

Tree-SHA512: e8d875652003618c73e019ccc420e7a25d46f4eaff1c7a1a6bfc1770b3b46f074b368b2cb14df541b5ab124cca41dede4e28fe863a670589b834ef6b8713f9c4
2018-07-12 17:46:29 +02:00
Wladimir J. van der Laan 9b638c7ce1
Merge #13627: Free keystore.h from file scope level type aliases
d0b9405f96 Refactors `keystore.h` type aliases. (251)

Pull request description:

  This pull request frees `keystore.h` from type alias declarations that have been declared at file scope level.

  `keystore.h` has various type aliases that have been declared ~3 - 6 years ago at file scope level, which can either be encapsulated or removed.

  Where type alias declarations are encapsulated at the appropriate scope and access level, C++11's `using` notation is used in favor of the `typedef` notation.

Tree-SHA512: 1395cdc63e0c7ff5a1b1721675ad4416f71f507e999bd4ba019f03457cbfc08877848f10a8db7f5ccd2cd5ca3f5a291c986616f7703172fb6d79fba7447ffba8
2018-07-12 14:37:28 +02:00
MarcoFalke d3dae3ddf9
Merge #13145: Use common getPath method to create temp directory in tests.
075429a482 Use common SetDataDir method to create temp directory in tests. (winder)

Pull request description:

  Took a stab at #12574

  Created a `getPath` method which can be used with the `TestingSetup` fixture to create a temp directory. Updated tests using temp directories to use this method.

  I tried setting up a `BOOST_GLOBAL_FIXTURE` to create a truly global path for all tests but was getting linker errors when including `boost/test/unit_test.hpp` in `test_bitcoin.cpp`. Even if I had gotten the linking to work, it looks like `make check` invokes the test binary a bunch of times, so it may not have worked anyway.

Tree-SHA512: b51d0f5fada5d652ccc9362596cf98a742aa47f5daf94f189b5f034d8c035c85d095377befdcff7fb4247154d5160e8c500d70f554a2158e2c185a9d24f694f1
2018-07-12 07:47:53 -04:00
Jonas Schnelli 9995a602a6
Add facility to store wallet flags (64 bits) 2018-07-12 10:30:21 +01:00
winder 075429a482 Use common SetDataDir method to create temp directory in tests. 2018-07-11 23:44:12 -04:00
251 d0b9405f96 Refactors keystore.h type aliases.
This squashed commit either encapsulates type alias declarations at the appropriate scope; or removes type aliases that are not used.

The encapsulated type aliases are declared using C++11's `using` notation in favor of the `typedef` notation.
2018-07-12 00:48:49 +02:00
MarcoFalke 5ba77df15d
Merge #13114: wallet/keystore: Add Clang thread safety annotations for variables guarded by cs_KeyStore
968b76f77c Add missing cs_KeyStore lock (practicalswift)
4bcd5bb87d Add locking annotations for variables guarded by cs_KeyStore (practicalswift)

Pull request description:

  * Add Clang thread safety annotations for variables guarded by `cs_KeyStore`
  * Add missing `cs_KeyStore` lock

Tree-SHA512: 7d93513c2da0cd564b9f1e75aa5156a454a4133eb845020fde8872e685dd5758353e93c33364aeea4a812c08353a810494e503a5ce160cc5be0af5af4bb2e6d7
2018-07-11 15:09:24 -04:00
Wladimir J. van der Laan e538a952d5
Merge #13622: Remove mapRequest tracking that just effects Qt display.
beef7ec4be Remove useless mapRequest tracking that just effects Qt display. (Matt Corallo)

Pull request description:

  I thought we had removed this a long time ago, TBH, its really
  confusing feedback to users that we display whether a tx was
  broadcast to immediate neighbor nodes, given that has little
  indication of whether the tx propagated very far.

Tree-SHA512: c9d0808fb60146919bb78d0860ec2193601966c944887eaae7837408422f7e85dfdb306407a613200cdd4726aec66da18df618ebc6a8cfe8650bf08d4a8dc155
2018-07-11 16:36:15 +02:00
MarcoFalke fa4bf92be9
Remove dead service bits code 2018-07-11 10:32:25 -04:00
Wladimir J. van der Laan acc68bc631
Merge #13586: refactor: add benchmarks to bech32::Encode/Decode
189cf35f3e Add simple bech32 benchmarks (Karl-Johan Alm)

Pull request description:

  This PR adds benchmarks to `Encode()`/`Decode()`.

  The benchmark commit is duplicated in #13632.

Tree-SHA512: 102a193e4af58c9cb23c66d3dc7e174aa6328edab0ed74f92deb7804db5c3d0601807b3e25a5472b5c72d6113cde0dbc9976315644671a8f14ecf349967dbaaa
2018-07-11 11:44:10 +02:00
Ben Woosley d6f39b6c64
Drop unused pindexRet arg to CMerkleTx::GetDepthInMainChain 2018-07-11 00:22:10 -04:00
practicalswift bd9d0690dc Remove unused argument to WitnessSigOps(...) 2018-07-10 18:12:57 +02:00
practicalswift d1d7cfebd2 Remove unused argument to DefaultOptions(...) 2018-07-10 18:12:57 +02:00
practicalswift 05dbb0c042 Remove unused argument to ThreadHTTP(...) 2018-07-10 18:12:57 +02:00
Wladimir J. van der Laan fad42e8c4a
Merge #13547: Make signrawtransaction* give an error when amount is needed but missing
685d1d8115 [tests] Check signrawtransaction* errors on missing prevtx info (Anthony Towns)
a3b065b51f Error on missing amount in signrawtransaction* (Anthony Towns)

Pull request description:

  Signatures using segregated witness commit to the amount being spent, so that value must be passed into signrawtransactionwithkey and signrawtransactionwithwallet. This ensures an error is issued if that doesn't happen, rather than just assuming the value is 0 and producing a signature that is almost certainly invalid.

  Based on Ben Woosley's #12458, Fixes: #12429.

Tree-SHA512: 8e2ff89d5bcf79548e569210af0d850028bc98d86c149b92207c9300ab1d63664a7e2b222c1be403a15941aa5cf36ccc3c0d570ee1c1466f3496b4fe06c17e11
2018-07-10 17:04:11 +02:00
MarcoFalke b05ded1764
Merge #13565: test: Fix AreInputsStandard test to reference the proper scriptPubKey
f95989b3ed Fix AreInputsStandard test to reference the proper scriptPubKey (Ben Woosley)

Pull request description:

  This value doesn't affect the outcome of the test, because the values are
  properly set on line 351 (https://github.com/bitcoin/bitcoin/pull/13565/files#diff-b7061098b41bd31ef5db043705441133R351), but this makes the test values internally coherent.

Tree-SHA512: 5a5fda843475abd91f6c366315536d3573e70420d7c6abeebd74a54939d4de774c33faad4560d1fd4b2c35006224d9e7b3a8c925fe9926013586fd1f7aa886cc
2018-07-10 10:23:11 -04:00
Wladimir J. van der Laan c05c93c5d8
Merge #13118: RPCAuth Detection in Logs
dae0d13bbb RPCAuth Detection in Logs (Linrono)

Pull request description:

  This adds a log entry for when RPCAuth is detected.
  This keeps everything working as it currently is. I suppose it could be added as a nested if to also stop the creation of the cookie file if this would be wanted.

Tree-SHA512: 61a893b2e06ae5e7db2ddedc63819d34047fad0df764184b1b2b3f49016581e6bbf2c94a59374ca2c300190cd4e827f01da286aad5a4cc8fe5140e258b1cf8c4
2018-07-10 16:19:30 +02:00