Commit graph

11967 commits

Author SHA1 Message Date
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
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
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 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
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
Jesse Cohen 3339ba28e9 Make g_enable_bip61 a member variable of PeerLogicValidation 2018-07-09 21:09:58 -04:00
Matt Corallo beef7ec4be Remove useless mapRequest tracking that just effects Qt display.
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.
2018-07-09 20:06:39 -04:00
Wladimir J. van der Laan b641f60425
Merge #13481: doc: Rewrite some validation docs as lock annotations
fa324a8b15 doc: Rewrite some validation doc as lock annotations (MarcoFalke)

Pull request description:

  #13402 added some lock annotations in comments. This pull removes them and adds clang-readable locking annotations instead.

Tree-SHA512: 2d392efa8ac4978830a9df08b2009e69d6f1ac031f62be2275ae8d7c7e483331c7f8d458d865443af907a7af27a592421c6cca6b2df3f2877e0f369b9198f383
2018-07-09 21:53:48 +02:00
Wladimir J. van der Laan 3a3eabef40
Merge #13386: SHA256 implementations based on Intel SHA Extensions
66b2cf1ccf Use immintrin.h everywhere for intrinsics (Pieter Wuille)
4c935e2eee Add SHA256 implementation using using Intel SHA intrinsics (Pieter Wuille)
268400d318 [Refactor] CPU feature detection logic for SHA256 (Pieter Wuille)

Pull request description:

  Based on #13191.

  This adds SHA256 implementations that use Intel's SHA Extension instructions (using intrinsics). This needs GCC 4.9 or Clang 3.4.

  In addition to #13191, two extra implementations are provided:
  * (a) A variable-length SHA256 implementation using SHA extensions.
  * (b) A 2-way 64-byte input double-SHA256 implementation using SHA extensions.

  Benchmarks for 9001-element Merkle tree root computation on an AMD Ryzen 1800X system:
  * Using generic C++ code (pre-#10821): 6.1ms
  * Using SSE4 (master, #10821): 4.6ms
  * Using 4-way SSE4 specialized for 64-byte inputs (#13191): 2.8ms
  * Using 8-way AVX2 specialized for 64-byte inputs (#13191): 2.1ms
  * Using 2-way SHA-NI specialized for 64-byte inputs (this PR): 0.56ms

  Benchmarks for 32-byte SHA256 on the same system:
  * Using SSE4 (master, #10821): 190ns
  * Using SHA-NI (this PR): 53ns

  Benchmarks for 1000000-byte SHA256 on the same system:
  * Using SSE4 (master, #10821): 2.5ms
  * Using SHA-NI (this PR): 0.51ms

Tree-SHA512: 2b319e33b22579f815d91f9daf7994a5e1e799c4f73c13e15070dd54ba71f3f6438ccf77ae9cbd1ce76f972d9cbeb5f0edfea3d86f101bbc1055db70e42743b7
2018-07-09 21:17:18 +02:00
Wladimir J. van der Laan 7e74c54fed
Merge #13452: rpc: have verifytxoutproof check the number of txns in proof structure
d280617bf5 [qa] Add a test for merkle proof malleation (Suhas Daftuar)
ed82f17000 have verifytxoutproof check the number of txns in proof structure (Gregory Sanders)

Pull request description:

  Recent publication of a weakness in Bitcoin's merkle tree construction demonstrates many SPV applications vulnerable to an expensive to pull off yet still plausible attack: https://bitslog.wordpress.com/2018/06/09/leaf-node-weakness-in-bitcoin-merkle-tree-design/

  This change would at least allow `verifytxoutproof` to properly validate that the proof matches a known block, with known number of transactions any time after the full block is processed. This should neuter the attack entirely.

  The negative is that a header-only processed block/future syncing mode would cause this to fail until the node has imported the data required.

  related: #13451

  `importprunedfunds` needs this check as well. Can expand it to cover this if people like the idea.

Tree-SHA512: 0682ec2b622a38b29f3f635323e0a8b6fc071e8a6fd134c954579926ee7b516e642966bafa667016744ce49c16e19b24dbc8801f982a36ad0a6a4aff6d93f82b
2018-07-09 20:25:50 +02:00
Wladimir J. van der Laan 453ae5ec9f
Merge #13603: bitcoin-tx: Stricter check for valid integers
57889e688d bitcoin-tx: Stricter check for valid integers (Daniel Kraft)

Pull request description:

  Just calling `atoi` to convert strings to integers does not check for valid integers very thoroughly; in particular, it just ignores everything starting from the first non-numeral character.  Even a string like "foo" is fine and silently returns 0.

  This meant that `bitcoin-tx` would not fail if such a string was passed in various places where an integer is expected (like the `locktime` or an input/output index); this means that it would, for instance, silently accept a typo and interpret it in an unexpected way.

  In this change, we use `ParseInt64` for parsing strings to integers, which actually verifies that the full string is valid as number.  New tests in the `bitcoin-util-test` cover the new error paths.

  This fixes #13599.

Tree-SHA512: 146a0af275e9f57784e5d0582d3defbac35551b54b6b7232f8a0b20db04aa611125e52aa4512ef2f8ed2cafc2a12fe586f9d10ed66d641cff090288f279b1988
2018-07-09 20:08:15 +02:00
Wladimir J. van der Laan a247594e75
Merge #13570: RPC: Add new "getzmqnotifications" method
161e8d40a4 RPC: Add new getzmqnotifications method. (Daniel Kraft)
caac39b0ac Make ZMQ notification interface instance global. (Daniel Kraft)

Pull request description:

  This adds a new RPC method `getzmqnotifications`, which returns information about all active ZMQ notification endpoints.  This is useful for software that layers on top of bitcoind, so it can verify that ZeroMQ is enabled and also figure out where it should listen.

  See #13526.

Tree-SHA512: edce722925741c84ddbf7b3a879fc9db1907e5269d0d97138fe724035d93ee541c2118c24fa92f4197403f380d0e25c2fda5ca6c62d526792ea749cf527a99a0
2018-07-09 17:21:03 +02:00
Wladimir J. van der Laan 17e9106c86
Merge #13614: doc: Update command line help for -printtoconsole and -debuglogfile (satwo)
5e362c0cf0 Fix command line help for -printtoconsole and -debuglogfile (Samuel B. Atwood)

Pull request description:

  This is a rebased version of #13589 with the changes to the 0.16.x release notes removed.

  > #13004 changed the default behavior for printtoconsole but this has not been reflected in the command line help.

  > This fixes the description of -printtoconsole to reflect this change, and also provides the user with missing information on how to explicitly disable logging to debug.log.

  > At present I have made the latter update to two separate places (-printtoconsole and -debuglogfile) because a user looking for information on how to disable logging is probably going to look in the "Debugging/Testing Options" section. Moving -debuglogfile from the "General" options category to the "Debugging/Testing" section could potentially remove the need for this redundancy but may be out of the scope of this PR.

Tree-SHA512: 7461d59a1864039d5a9dfcce765a1169df882f51a4ca50a6066416c0803821cd821be07be534e0bd57f0a22c0b45adb881a93abbe91962bc37d2d228f35ee712
2018-07-09 17:03:12 +02:00
Wladimir J. van der Laan 172f984f59
Merge #13615: net: Remove unused interrupt from SendMessages
4b6ab02122 Remove unused argument to ProcessGetBlockData(...) (practicalswift)
c469ecf22e net: Remove unused interrupt from SendMessages (fanquake)

Pull request description:

  Discussed very briefly with cfields.

  Includes 65b4400 from #13554 as it's a similar refactor.

Tree-SHA512: 45cd64208a5c8164242db74e6687e9344ea592bab5e7f9ba8e1bb449057fc908ec9d8b8523748a68426e4a4304e3388a138cd834698b39837b2149b72beefdc9
2018-07-09 16:50:09 +02:00
Anthony Towns b9024fdda3 segwit support for createmultisig RPC 2018-07-10 00:07:58 +10:00
Anthony Towns d58055d25f Move AddAndGetDestinationForScript from wallet to outputype module
Makes AddAndGetDestinationForScript use a generic CKeyStore rather than
the wallet, and makes it always add the script to the keystore, rather
than only adding related (redeem) scripts.
2018-07-10 00:06:19 +10:00
Wladimir J. van der Laan b55f0c31d4
Merge #13611: [bugfix] Use __cpuid_count for gnu C to avoid gitian build fail.
63c16ed507 Use __cpuid_count for gnu C to avoid gitian build fail. (Chun Kuan Lee)

Pull request description:

  Fixes #13538

Tree-SHA512: 161ae4db022288ae8631a166eaea2d08cf2c90bcd27218a094a754276de30b92ca9cfb5a79aa899c5a9d0534c5d7261037e7e915e1b92bc7067ab1539dc2b51e
2018-07-09 15:55:32 +02:00
Anthony Towns 9a44db2e46 Add outputtype module
Moves OutputType into its own module
2018-07-09 22:21:15 +10:00
practicalswift 4b6ab02122
Remove unused argument to ProcessGetBlockData(...) 2018-07-08 21:27:12 +08:00
fanquake c469ecf22e
net: Remove unused interrupt from SendMessages 2018-07-08 21:27:12 +08:00
Samuel B. Atwood 5e362c0cf0
Fix command line help for -printtoconsole and -debuglogfile
#13004 changed the default behavior for printtoconsole but this has not been reflected in the command line help.

This fixes the description of -printtoconsole to reflect this change, and also provides the user with missing information on how to explicitly disable logging to debug.log.

At present I have made the latter update to two separate places (-printtoconsole and -debuglogfile) because a user looking for information on how to disable logging is probably going to look in the "Debugging/Testing Options" section. Moving -debuglogfile from the "General" options category to the "Debugging/Testing" section could potentially remove the need for this redundancy but may be out of the scope of this PR.
2018-07-08 21:12:31 +08:00
MarcoFalke 88a15ebc8d
Merge #13564: [wallet] loadwallet shouldn't create new wallets.
ea65182f03 [wallet] loadwallet shouldn't create new wallets. (John Newbery)

Pull request description:

  A bug in the initial implementation of loadwallet meant that if the
  arguement was a directory that didn't contain a wallet.dat file, a new
  wallet would be created in that directory. Fix that so that if a
  directory is passed in, it must contain a wallet.dat file.

  Bug reported by promag (João Barbosa).

Tree-SHA512: 0a59fa8a33fde51a88544ad288b00e4995284fe16424f643076aaba42b8244fff362145217650ee53d518dfab7efbed4237632c34cdd3dcbbecaa9ecaab5fd7b
2018-07-07 06:07:41 -11:00
Chun Kuan Lee 63c16ed507 Use __cpuid_count for gnu C to avoid gitian build fail. 2018-07-07 16:01:43 +00:00
Daniel Kraft 57889e688d bitcoin-tx: Stricter check for valid integers
Just calling atoi to convert strings to integers does not check for
valid integers very thoroughly; in particular, it just ignores
everything starting from the first non-numeral character.  Even a string
like "foo" is fine and silently returns 0.

This meant that bitcoin-tx would not fail if such a string was passed in
various places where an integer is expected (like the locktime or an
input/output index); this means that it would, for instance, silently
accept a typo and interpret it in an unexpected way.

In this change, we use ParseInt64 for parsing strings to integers,
which actually verifies that the full string is valid as number.
New tests in the bitcoin-util-test cover the new error paths.
2018-07-07 14:25:09 +02:00
MarcoFalke 0212187fc6
Merge #13598: bench: fix incorrect behaviour in prevector.cpp
1fc605a8ae fix bench/prevector.cpp (Akio Nakamura)

Pull request description:

  This patch intends to fix some incorrect action of bench/prevector.cpp.

  1. PrevectorClear()
  2nd call of ```clear()``` should to operate t1 instead of t0.
  This patch changes t0 to t1.

  2. PREVECTOR_TEST()
  PREVECTOR_TEST macro should to call both
  ```PrevectorXX<nontrivial_t>(state)``` and ```PrevectorXX<trivial_t>(state)```
  by specific ```"name"``` which given by parameter instead of calling
  ```PrevectorResize<>()``` regardless of ```"name"```.
  This patch changes ```"PrevectorResize<"``` of this macro to
  ```"Prevector ## name<"```.

Tree-SHA512: d0498c6d627d7e96fc8ccfb329ca0be2641535b1ce1923d9b1fc720825f9bf4d7281dc8d5ae929038e37b3e625189af9807cb62e6d20933d73832a6dff4b5596
2018-07-05 19:59:35 -11:00
Wladimir J. van der Laan 287e4edc2f
Merge #12788: [build] Tune wildcards for LIBSECP256K1 target
98b181323 [build] Tune wildcards for LIBSECP256K1 target (Karl-Johan Alm)

Pull request description:

  Automake would think the target was out of date every time because e.g. '.deps' was updated.

  Note: I am assuming that secp256k1 depends on `*.h`, `*.c`, ~~and `libsecp256k1-config.h`~~ (it's `.h` so already included), aside from pre-existing `include/*`. If there are other files that would require a rebuild of the `LIBSECP256K1` target, they should probably be added.

  It would be neat if you could exclude specific files, rather than split it up like this, but it doesn't seem possible (https://www.gnu.org/software/make/manual/html_node/Wildcard-Function.html#Wildcard-Function)

  Should probably note this:
  ```Bash
  $ V=1 make check VERBOSE=1
  Making check in src
  make[1]: Entering directory '/home/user/workspace/bitcoin/src'
  make[2]: Entering directory '/home/user/workspace/bitcoin/src'
  make  -C secp256k1 libsecp256k1.la
  make[3]: Entering directory '/home/user/workspace/bitcoin/src/secp256k1'
  make[3]: 'libsecp256k1.la' is up to date.
  make[3]: Leaving directory '/home/user/workspace/bitcoin/src/secp256k1'
  make  check-TESTS check-local
  make[3]: Entering directory '/home/user/workspace/bitcoin/src'
  make[4]: Entering directory '/home/user/workspace/bitcoin/src'
  make  -C secp256k1 libsecp256k1.la
  make[5]: Entering directory '/home/user/workspace/bitcoin/src/secp256k1'
  make[5]: 'libsecp256k1.la' is up to date.
  make[5]: Leaving directory '/home/user/workspace/bitcoin/src/secp256k1'
  PASS: test/test_bitcoin.exe
  ```

Tree-SHA512: 62b133c76e882788dae0c14208a9f5acdbd731c2e7a248f9e01f488b8ec13f9d637d7ad0d63e18d324bb4e088f1836a936649b0fb97bee679eaadedbeed5c981
2018-07-05 19:39:42 +02:00
Wladimir J. van der Laan 062738cf69
Merge #13096: [Policy] Fix MAX_STANDARD_TX_WEIGHT check
2f1a30c63 Fix MAX_STANDARD_TX_WEIGHT check (Johnson Lau)

Pull request description:

  As suggested by the constant name and its comment in policy.h, a transaction with a weight of exactly MAX_STANDARD_TX_WEIGHT should be allowed. Users could be confused.

Tree-SHA512: af417de1c6a2e6796ebbb39aa0caad8764302ded155cb1bbfbe457e4567c199cc53256189832b17d4aeec369e190b3edd4c6116d5f0b8cf0ede6dfb4ed83bdd3
2018-07-05 18:40:58 +02:00
Wladimir J. van der Laan c9eb8d1c55
Merge #13577: logging: avoid nStart may be used uninitialized in AppInitMain warning
2dcd7b4ec logging: avoid nStart may be used uninitialized in AppInitMain warning (mruddy)

Pull request description:

  Was getting the following compiler warning:

  ```
  init.cpp: In function ‘bool AppInitMain()’:
  init.cpp:1616:60: warning: ‘nStart’ may be used uninitialized in this function [-Wmaybe-uninitialized]
           LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart);
  ```

  It's ok without this PR, but this PR renames `nStart` to `load_block_index_start_time`, makes it `const`, and also reduces the scope of the variable.

  The logging line is moved such that the the time spent will be logged even if a shutdown is requested while the index is being loaded.

  Having the log message output even when a shutdown is requested may be how this was intended to work before anyways. That could explain the leading space, as such a log message now looks like:
  ```
  2018-06-30T11:34:05Z [0%]...[16%]...[33%]...[50%]... block index           25750ms
  2018-06-30T11:34:17Z Shutdown requested. Exiting.
  ```

Tree-SHA512: 967048afbc31f2ce8f80ae7d33fee0bdcbe94550cf2b5b662087e2a7cff14a8bf43d909b30f930660c184ec6c3c7e1302a84e3e54fc1723f7412827f4bf2c518
2018-07-05 18:12:21 +02:00