Commit Graph

1078 Commits

Author SHA1 Message Date
Pieter Wuille e967b56fbe Switch reindexing to AcceptBlock in-loop and ActivateBestChain afterwards
(cherry picked from commit 316623f2c197971db9b5bcb9c84e446254b552c3)
2021-08-09 20:58:49 +01:00
Jack Grigg 990bc46b2b Use a visitor for handling -mineraddress config option
This makes it easier to add UA support.
2021-07-13 03:21:54 +01:00
Jack Grigg 9ad5b75b30 rust: Load Orchard circuit parameters at startup 2021-06-21 18:33:57 +01:00
Chun Kuan Lee abd0471696 windows: Call SetProcessDEPPolicy directly
(cherry picked from commit d8a299206780b38959d732cbe40ba1dd25834f0e)
2021-06-05 14:49:02 +01:00
Karl-Johan Alm 5d6fa863b3 Refactor: Remove using namespace <xxx> from src/*.cpp.
(cherry picked from commit b7b48c8bbdf7a90861610b035d8b0a247ef78c45)

Zcash: Excluding changes to code we haven't backported yet that cause
too many conflicts.
2021-04-02 16:04:55 +13:00
Homu ba4eb241e7 Auto merge of #4996 - str4d:2074-net-blocksonly, r=str4d
Add -blocksonly option

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6993
- bitcoin/bitcoin#7046
- bitcoin/bitcoin#6780
  - The third commit (we backported the rest in #2390).
- bitcoin/bitcoin#7126
- bitcoin/bitcoin#7439
- bitcoin/bitcoin#15990
  - Only the `-blocksonly` documentation changes.
- bitcoin/bitcoin#16555
- bitcoin/bitcoin#18391
  - Only the `-blocksonly` documentation changes.

Part of #2074.
2021-03-31 11:27:22 +00:00
glowang 49d420f808 Update -blocksonly documentation
When -blocksonly is set to 1, it interacts with the -walletbroadcast
parameter and sets it to 0 if it has not been set already.This behavior
is not captured by the current documentation, which claims that -blocksonly
does not impact any wallet transactions.

(cherry picked from commit 621e86ee8d0102e2bf41f7656a368083b89b2f83)

Zcash: Excludes max-peer doc changes, since we don't have
block-relay-only peers yet.
2021-04-01 00:24:19 +13:00
Sjors Provoost c6fbc477dd [doc] mention whitelist is inbound, and applies to blocksonly
(cherry picked from commit 20ea9ef6ce9228a5258b99eeeeb40e6dfae2299f)
2021-04-01 00:17:02 +13:00
MarcoFalke 8dd2c02a3a doc: Mention blocksonly in reduce-traffic.md, unhide option
(cherry picked from commit fa8ced32a60dea37ac169241cf9a1f708ef46c4b)

Zcash: Only the documentation changes.
2021-04-01 00:13:49 +13:00
Jack Grigg d08cdbe5f7 metrics: Implement IP access control on Prometheus scrape endpoint 2021-03-30 15:12:08 +13:00
str4d dde7546091 Clean up comment
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-03-30 15:12:08 +13:00
str4d d0f468e1ce Add security warnings for -prometheusmetrics option
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-03-30 15:12:08 +13:00
Jack Grigg 1c2c8fed2e metrics: Expose binary metadata 2021-03-30 15:12:08 +13:00
Jack Grigg a79ffa3b50 rust: Add a Prometheus metrics exporter
The -prometheusmetrics=host_name:port config option enables the metrics
exporter.
2021-03-30 15:12:07 +13:00
Gregory Maxwell 9e67ec66a2 Blacklist -whitelistalwaysrelay; replaced by -whitelistrelay.
Zcash: just a comment fix, no need to blacklist as -whitelistalwaysrelay
will never have been active.
(cherry picked from commit 89d113e02a83617b4e971c160d47551476dacc71)
2021-02-22 18:29:12 -07:00
Gregory Maxwell c411af61e7 Add whitelistforcerelay to control forced relaying.
Also renames whitelistalwaysrelay.

Nodes relay all transactions from whitelisted peers, this
 gets in the way of some useful reasons for whitelisting
 peers-- for example, bypassing bandwidth limitations.

The purpose of this forced relaying is for specialized gateway
 applications where a node is being used as a P2P connection
 filter and multiplexer, but where you don't want it getting
 in the way of (re-)broadcast.

This change makes it configurable with whitelistforcerelay.

(cherry picked from commit 325c725fb6205e38142914acb9ed1733d8482d46)
2021-02-22 18:26:40 -07:00
MarcoFalke c8f15614e5 Move blocksonly parameter interaction to InitParameterInteraction() 2021-02-19 20:01:02 +00:00
Jonas Schnelli 2acfcc801f Move -blocksonly parameter interaction to the new ParameterInteraction() function 2021-02-19 19:56:18 +00:00
Patick Strateman 237de99aa9 Fix comment for blocksonly parameter interactions 2021-02-19 19:28:16 +00:00
Patick Strateman fd635a1f86 Display DEFAULT_WHITELISTALWAYSRELAY in help text 2021-02-19 19:28:16 +00:00
Patick Strateman 92f952e265 Use DEFAULT_BLOCKSONLY and DEFAULT_WHITELISTALWAYSRELAY constants 2021-02-19 19:28:16 +00:00
Patick Strateman 7e6ef59248 Add help text for blocksonly and whitelistalwaysrelay 2021-02-19 19:28:16 +00:00
Patick Strateman 32a1bbf0ae Add whitelistalwaysrelay option 2021-02-19 19:28:16 +00:00
Homu b62e35dee8 Auto merge of #4994 - str4d:2074-net-misc-1, r=nuttycom
Bitcoin 0.12 misc P2P/Net PRs

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#5288
  - Only the reorg, option was removed in bitcoin/bitcoin#6374 which we merged in #1258
- bitcoin/bitcoin#6561
- bitcoin/bitcoin#6728
- bitcoin/bitcoin#6829
- bitcoin/bitcoin#6974
- bitcoin/bitcoin#7075
- bitcoin/bitcoin#7166

Part of #2074.
2021-02-19 15:48:11 +00:00
Josh Lehan d3a2f120f5 Re-organize -maxconnections option handling
Zcash: Was "Added -whiteconnections=<n> option" from bitcoin/bitcoin#5288. The
option was later removed in bitcoin/bitcoin#6374 which we merged in #1258. This
commit contains the difference between the two.
2021-02-18 19:03:58 +00:00
Homu e83ecc1dcb Auto merge of #4972 - LarryRuane:remove-PartitionCheck, r=str4d
Remove bad chain alert partition check

(cherry picked from https://github.com/bitcoin/bitcoin/pull/8275 commit ab8be98fdb25b678a8cd7e89adf06d1b1f6bdd62), original commit message:

As per meeting 2016-03-31
https://bitcoincore.org/en/meetings/2016/03/31/#bad-chain-alerts

The partition checker was producing huge number of false-positives
and was disabled in 0.12.1 on the understanding it would either be
fixed in 0.13 or removed entirely from master if not.
2021-02-18 18:46:40 +00:00
Jack Grigg 51ae7a0ae5 init: Pass post-Blossom spacing into CNode::SetMaxOutboundTarget() 2021-02-17 13:35:11 -07:00
MarcoFalke 72fbeae94e [net] Cleanup maxuploadtarget
* log: nMaxOutboundLimit is in bytes
* log: Hide misleading -maxuploadtarget=0 warning
* qa : Minor cleanup to maxuploadtarget rpc tests
* net: Use DEFAULT_MAX_UPLOAD_TARGET = 0
2021-02-17 19:23:38 +00:00
Jonas Schnelli 1a85cc8817 Introduce -maxuploadtarget
* -maxuploadtarget can be set in MiB
* if <limit> - ( time-left-in-24h-cycle / 600 * MAX_BLOCK_SIZE ) has reach, stop serve blocks older than one week and filtered blocks
* no action if limit has reached, no guarantee that the target will not be  surpassed
* add outbound limit informations to rpc getnettotals

Zcash: Also includes a cleanup from bitcoin/bitcoin#5697
2021-02-17 19:23:35 +00:00
BtcDrak fa8d2a45bb Remove bad chain alert partition check
As per meeting 2016-03-31
https://bitcoincore.org/en/meetings/2016/03/31/#bad-chain-alerts

The partition checker was producing huge number of false-positives
and was disabled in 0.12.1 on the understanding it would either be
fixed in 0.13 or removed entirely from master if not.

(cherry picked from commit ab8be98fdb25b678a8cd7e89adf06d1b1f6bdd62)
2021-02-02 09:25:35 -07:00
Jack Grigg 6c280abfac Remove init_and_check_sodium from crypto/common.h
This removes the last implicit dependency on libsodium from
libzcashconsensus.

As of zcash/zcash#4893 we no longer depend on libsodium for Ed25519
signature verification.
2020-12-20 22:42:22 +00:00
Jack Grigg c4ea423827 prevector: Terminate without logging on failed allocation
This reverts aeb089ecc7, which introduced
logging, adding a dependency on libbitcoin_util.a to libzcashconsensus.a.

Also adds missing #includes that were being indirectly included via
prevector.h including util.h.
2020-12-20 22:42:22 +00:00
Homu dea50714f9 Auto merge of #4892 - str4d:boosted, r=str4d
Replace boost::variant and boost::optional with standard library

Includes a commit cherry-picked from https://github.com/bitcoin/bitcoin/pull/20419.

Closes #4821. Closes #4822.
2020-12-17 02:42:55 +00:00
Jack Grigg d9928926f3 Migrate from boost::optional::get to boost::optional::value
std::optional only has std::optional::value.
2020-12-16 22:59:34 +00:00
Jack Grigg b521cb8932 scripted-diff: Migrate from boost::variant to std::variant
-BEGIN VERIFY SCRIPT-
sed -i 's/boost::variant/std::variant/' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ;
sed -i 's/boost::get<\(.*\)>(&/std::get_if<\1>(\&/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.cpp ;
sed -i 's/boost::get</std::get</' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.cpp ;
sed -i 's/boost::apply_visitor(/std::visit(/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ;
sed -i 's/class \(.*\)\b \?: public boost::static_visitor<.*>/class \1/' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ;
sed -i ':a;N;$!ba;s/#include <boost\/variant\(\/.*\)\?.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ;
sed -i ':a;N;$!ba;s/#include "boost\/variant\/.*.hpp"\n//' ./src/*/*.cpp ;
-END VERIFY SCRIPT-
2020-12-16 22:49:53 +00:00
Kris Nuttycombe e9b5d83709 Prefer explicit passing of CChainParams to the Params() global. 2020-12-15 08:23:09 -07:00
Jorge Timón f5e98e0fb1 scripted-diff: Remove PAIRTYPE
Zcash: Added an extra command to handle cases where the pair were not
separated by a space.

-BEGIN VERIFY SCRIPT-
sed -i 's/PAIRTYPE(\([^,]*\), \([^\)]*\))/std::pair<\1, \2>/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i 's/PAIRTYPE(\([^,]*\),\([^\)]*\))/std::pair<\1, \2>/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i ':a;N;$!ba;s/#define std::pair<t1, t2>    std::pair<t1, t2>\n//' ./src/utilstrencodings.h ;
-END VERIFY SCRIPT-
2020-11-23 23:07:15 +00:00
Jorge Timón 92a867febc scripted-diff: Fully remove BOOST_FOREACH
-BEGIN VERIFY SCRIPT-
sed -i 's/BOOST_FOREACH *(\(.*\),/for (\1 :/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
-END VERIFY SCRIPT-
2020-11-23 23:07:15 +00:00
Jack Grigg 1944eb1c86 lint: Fix duplicate includes 2020-11-09 23:06:21 +00:00
Wladimir J. van der Laan c0603a9fa6 Use fsbridge for fopen and freopen
Abstracts away how a path is opened to a `FILE*`.

Reduces the number of places where path is converted to a string
for anything else but printing.
2020-10-22 01:11:37 +01:00
Wladimir J. van der Laan 73bc7a068d Replace uses of boost::filesystem with fs
Step two in abstracting away boost::filesystem.

To repeat this, simply run:
```
git ls-files \*.cpp \*.h | xargs sed -i 's/boost::filesystem/fs/g'
```
2020-10-22 01:11:37 +01:00
Wladimir J. van der Laan 7044e39a57 Replace includes of boost/filesystem.h with fs.h
This is step one in abstracting the use of boost::filesystem.
2020-10-22 01:11:37 +01:00
Homu fb24911c55 Auto merge of #4570 - oxarbitrage:issue2783, r=daira
Add timestamp to warnings

Closes https://github.com/zcash/zcash/issues/2783 by adding timestamp to warnings.
2020-10-14 09:16:45 +00:00
Homu b076c8dfc5 Auto merge of #4770 - nuttycom:fastsync, r=nuttycom
Add -ibdskiptxverification flag to allow faster synchronization.

Subsumes #4037
2020-10-13 13:54:05 +00:00
Kris Nuttycombe a75c613ade Fix command-line help for -ibdskiptxverification 2020-10-13 07:18:51 -06:00
Kris Nuttycombe 95e38235c7
Rename IBDSkipTxVerification back to ShouldCheckTransaction
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-10-12 15:38:07 -06:00
Daira Hopwood acf2d07189 Fix a new warning about use of boost::bind placeholders after updating Boost. closes #4774
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-10 21:41:46 +01:00
Kris Nuttycombe 88a7dd59c0 Reject incompatible flags in "Step 2" 2020-10-09 11:54:06 -06:00
Kris Nuttycombe 8a2aaebd7e Ensure conflicting flags are reported as an error. 2020-10-09 11:48:23 -06:00
Kris Nuttycombe 2c051acae5
Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2020-10-09 11:44:15 -06:00
Kris Nuttycombe f0c24bd9f9 -ibdskiptxverification must imply -checkpoints 2020-10-09 09:45:31 -06:00
Daira Hopwood 007de07745 Add logging when we receive an invalid note plaintext (using the "receiveunsafe" log category).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-08 14:29:23 +01:00
Aditya Kulkarni 0b4395d275 Add a config option to skip transaction verification in IBD mode 2020-10-07 10:42:15 -06:00
Homu a983344931 Auto merge of #4752 - str4d:small-httpserver-backports, r=daira
Small httpserver.cpp backports

Also includes a change to the `uiInterface.NotifyBlockTip` signal API.
These remove merge conflicts from subsequent backports for `sync.h`.

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#6859
- bitcoin/bitcoin#7112
  - Only the non-QT changes.
- bitcoin/bitcoin#7966
- bitcoin/bitcoin#8421
  - We already backported the second commit in zcash/zcash#2555
2020-10-01 12:48:58 +00:00
Jack Grigg ab35a260d5 Remove remaining OpenSSL references 2020-09-30 00:40:12 +01:00
Jonas Schnelli 66515b0628 NotifyBlockTip signal: switch from hash (uint256) to CBlockIndex*
- also adds a boolean for indication if the tip update was happening during initial sync
- emit notification also during initial sync
2020-09-30 00:35:32 +01:00
Homu 7d94064616 Auto merge of #4643 - str4d:locked-memory-manager, r=str4d
Locked memory manager

Add a pool for locked memory chunks, replacing `LockedPageManager`.

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#8321
- bitcoin/bitcoin#8753
- bitcoin/bitcoin#9063
- bitcoin/bitcoin#9070
- bitcoin/bitcoin#11385
- bitcoin/bitcoin#12048
  - Excludes change to benchmark.
- bitcoin/bitcoin#15117
- bitcoin/bitcoin#16161
  - Excludes Travis CI changes.
  - Includes change from bitcoin/bitcoin#13163
- bitcoin/bitcoin#15600
- bitcoin/bitcoin#18443
- Assorted small changes from:
  - bitcoin/bitcoin#9233
  - bitcoin/bitcoin#10483
  - bitcoin/bitcoin#10645
  - bitcoin/bitcoin#10969
  - bitcoin/bitcoin#11351
- bitcoin/bitcoin#19111
  - Excludes change to `src/rpc/server.cpp`
- bitcoin/bitcoin#9804
  - Only the commit for `src/key.cpp`
- bitcoin/bitcoin#9598
2020-09-29 22:18:48 +00:00
practicalswift a3fbfe4efc Improve readability by removing redundant casts to same type (on all platforms) 2020-09-25 14:56:20 +01:00
Larry Ruane 81db0a2fc7 Flush witness data when consistent (part 2)
After CWallet::ChainTipAdded() updates the witness data, it
may flush it to disk (SetBestChain()); make sure the locator
part is consistent with the witnesses (height).
2020-09-05 07:21:11 -06:00
Jack Grigg 3fd409433b FFI: Remove circuit parameter hashes from librustzcash_init_zksnark_params
These were hard-coded into the underlying zcash_proofs::load_parameters
function.

Closes zcash/zcash#4519.
2020-08-25 13:07:22 +01:00
Homu c2f991db5b Auto merge of #4659 - str4d:tracing-init, r=str4d
Improvements to tracing initialization

The refactor makes it easier to implement further tracing customisations.

We also now have spans for `zcashd` initialization and shutdown.
2020-08-17 07:32:04 +00:00
Homu b3407f06c8 Auto merge of #1665 - bitbandi:master, r=daira
Allow to configure the zk-SNARK parameters directory using `-paramsdir=`

same use as datadir=/foo/bar parameter
2020-08-14 15:24:05 +00:00
Jack Grigg 027a9925c9 init: Add spans for initialization and shutdown 2020-08-11 14:38:51 +01:00
Jack Grigg 735503b473 init: Rework tracing_init call 2020-08-11 14:38:51 +01:00
elbandi beae52ef9b Add paramsdir option for manpage 2020-08-07 22:37:15 +02:00
Jack Grigg 58c410974d init: Place additional constraints on pathDebug 2020-08-07 15:26:28 +01:00
Jack Grigg f89ea3fc33 Add an RPC method for setting the tracing filter directives 2020-08-07 15:26:28 +01:00
Jack Grigg 2b7d824714 Use a tracing EnvFilter directive for -debug flags 2020-08-07 15:08:10 +01:00
Jack Grigg d5de95f170 Replace C++ logging with tracing logging
Does not yet handle SIGHUP log-reopening.
2020-08-07 15:08:10 +01:00
Homu b6547929c9 Auto merge of #4593 - str4d:proofverifier-refactor, r=str4d
Refactor ProofVerifier

`ProofVerifier` was previously used to conditionally verify pre-Sapling Sprout
proofs (based on `ProofVerifier::Strict` or `ProofVerifier::Disabled` being
used), but hybrid Sprout proofs bypassed it (so were being verified multiple
times during block verification), and once `libsnark` was removed in
zcash/zcash#4060 `ProofVerifier::check` was doing nothing.

This PR refactors `ProofVerifier`, moving it out of the `libzcash` compilation
unit (so that it can depend on `primitives/transaction.h`), and moving Sprout
verification from `JSDescription::Verify` to `ProofVerifier::VerifySprout`.
Verification-skipping for Sprout proofs is re-introduced.

Additionally, the `ZCJoinSplit` global is removed from the codebase, and
`ZCJoinSplit::prove` is converted into a static function. We load the hybrid
Sprout parameters dynamically at proving time within the Rust code, and no
longer require a C++ global for any proving parameters.

As a side-effect, `libzcashconsensus.la` building with `--with-libs` is fixed,
as `primitives/transaction.cpp` no longer depends on `librustzcash.h`.
2020-08-07 12:16:59 +00:00
Kris Nuttycombe 0391809da1 Remove amqp code and Proton library depenencies & flags. 2020-07-31 13:08:18 -06:00
Larry Ruane a65ecaad54 flush wallet db (SetBestChain()) on clean shutdown 2020-07-20 20:04:48 -06:00
Kris Nuttycombe 07ff0d19a0 Make evident the relationship between chainparams and key IO. 2020-07-09 17:48:47 -06:00
Jack Grigg 7e2558d2e2 Make ZCJoinSplit::prove static and remove ZCJoinSplit globals
We don't support making pre-Sapling JoinSplit proofs, and we load the
parameters for post-Sapling JoinSplit proofs at proving time, so there
is no need for a global ZCJoinSplit to be passed through the APIs.
2020-07-08 13:59:47 +12:00
Kris Nuttycombe 88c5bf7217
Minor help message correction.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-07-06 15:41:28 -06:00
Kris Nuttycombe aff38f75f3
Qualified imports of std:: types
Co-authored-by: str4d <thestr4d@gmail.com>
2020-07-01 16:06:27 -06:00
Kris Nuttycombe 1c00a0b541
Identify `-fundingstream` parameter as being regtest-only
Co-authored-by: str4d <thestr4d@gmail.com>
2020-06-29 15:42:45 -06:00
Jack Grigg efd04b920b Implement zip-207 and zip-214.
Add funding streams to consensus parameters.

Add funding stream payments to coinbase txns generated by the miner.
* Reduce valueBalance for shielded outputs to funding streams.
* Ensure we produce binding signatures in any case where shielded
  outputs go to either a funding stream or the miner.
2020-06-25 16:15:50 -06:00
Alfredo Garcia 493c0f98a2 change order of returned pair, fix compatibility issue
Co-Authored-By: Daira Hopwood <daira@jacaranda.org>
2020-06-23 11:47:29 -03:00
Alfredo Garcia 18a1448ac7 add timestamp to warnings 2020-06-12 18:12:15 -03:00
Alfredo Garcia 3b9bd2da2f fix sort of options 2020-05-28 10:58:04 -03:00
Wladimir J. van der Laan 540cdb34e2 Add `-debuglogfile` option
This patch adds an option to configure the name and/or directory of the
debug log.

The user can specify either a relative path, in which case the path
is relative to the data directory. They can also specify an absolute
path to put the log anywhere else in the file system.
2020-05-28 10:53:58 -03:00
Homu 4fad49d802 Auto merge of #4416 - daira:sa_restart, r=daira
Use SA_RESTART in sa_flags when setting up signal handlers

Explanation: if a signal interrupts certain syscalls such as `open`, `read`, or `write`,
then the library function will by default fail with `errno` `EINTR`. But we [almost](https://github.com/zcash/zcash/search?q=WSAEINTR) [never](https://github.com/zcash/zcash/search?q=EINTR)
check for `EINTR`, so this is likely to cause spurious errors. We want to restart the syscall
instead, which is what `SA_RESTART` is intended to do. Since our signal handlers (defined
in init.cpp) only set a flag, restarting the syscall is safe and is always the Right Thing.

See <https://www.gnu.org/software/libc/manual/html_node/Flags-for-Sigaction.html> and
<https://www.gnu.org/software/libc/manual/html_node/Interrupted-Primitives.html> for
further information.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-04-15 19:23:14 +00:00
Homu 3033b8a0ec Auto merge of #4402 - oxarbitrage:issue4326, r=str4d
Add -lightwalletd experimental option

Similar to `-insightexplorer` but loading less indexes.

After testing and code review this should be able to close https://github.com/zcash/zcash/issues/4326
2020-04-10 03:42:54 +00:00
Alfredo Garcia a43f5daff8 add -lightwalletd experimental option 2020-04-09 11:05:21 -03:00
Alfredo Garcia 6039242829
multiple debug categories documentation 2020-04-06 09:09:43 -03:00
Daira Hopwood dd215e8994 Use `SA_RESTART` in `sa_flags` when setting up signal handlers.
Explanation: if a signal interrupts certain syscalls such as `open`, `read`, or `write`,
then the library function will by default fail with `errno` `EINTR`. But we almost never
check for `EINTR`, so this is likely to cause spurious errors. We want to restart the syscall
instead, which is what `SA_RESTART` is intended to do. Since our signal handlers (defined
in init.cpp) only set a flag, restarting the syscall is safe and is always the Right Thing.

See <https://www.gnu.org/software/libc/manual/html_node/Flags-for-Sigaction.html> and
<https://www.gnu.org/software/libc/manual/html_node/Interrupted-Primitives.html> for
further information.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-28 19:14:48 +00:00
Homu fc9d0fa72f Auto merge of #4404 - daira:fix-reindex-divby0, r=ebfull
Avoid a theoretical possibility of division-by-zero introduced in #4368

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-16 17:13:39 +00:00
Homu 5a626317c7 Auto merge of #4390 - daira:fix-chaintip-race-condition, r=ebfull
Fix race conditions during init

Fix race conditions due to accessing `chainActive.Tip()` during init, and other minor cleanups.
Includes backport of https://github.com/bitcoin/bitcoin/pull/8063 .
2020-03-16 15:11:43 +00:00
Daira Hopwood b49cdee878 Avoid a theoretical possibility of division-by-zero introduced in #4368.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-16 14:56:38 +00:00
Homu c0802cccac Auto merge of #4368 - gladcow:issue3813_reindex_in_metrics, r=str4d
Shows reindex progress in metrics screen

Resolves issue #3813.

The "Downloading blocks" message is changed to "Reindexing blocks" during reindex, after reindex is completed the text is reverted back to the first variant.

Reindex progress is shown as a sum of processed file size (we can't use reindexed block number as a progress because we can't predict how many blocks to process at all, we don't know the size of the block before we process it), the result looks like
```
Reindexing blocks | 22.64 MiB / 336.00 MiB (6%, 13583 blocks)
```
2020-03-12 09:28:35 +00:00
Homu ac4e91c6f4 Auto merge of #4343 - oxarbitrage:issue3083, r=str4d
Add expired transaction notifications

Closes https://github.com/zcash/zcash/issues/3083
2020-03-12 06:35:04 +00:00
Homu fa67c4e148 Auto merge of #4293 - oxarbitrage:issue2671, r=str4d
Refactor experimental feature handling

Adds new rpc call `getexperimentalfeatures` and also adds experimental features to `getblockchaininfo` output.

Closes #2671.
2020-03-12 02:09:12 +00:00
Daira Hopwood 0de0105c80 Exit init early if we request shutdown before having loaded the genesis block.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-10 17:57:52 +00:00
Daira Hopwood 99dc6de485 Setting a std::atomic variable in a signal handler only has defined behaviour if it is lock-free.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-10 17:57:52 +00:00
Daira Hopwood 74467f8f02 Resolve a race condition on `chainActive.Tip()` in initialization (introduced in #4379).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-03-10 17:57:52 +00:00
Patrick Strateman 82e641f3cc Acquire lock to check for genesis block. 2020-03-10 17:57:52 +00:00
gladcow e72885b690 Use processed file size as progress in metrics during reindex 2020-03-10 09:33:35 +03:00
Homu ca668cf666 Auto merge of #4374 - daira:rewrite-addtimedata, r=daira
Remove time adjustment; instead warn if peer clocks are too different

The policy is: warn if we have seen at least 8 (TIMEDATA_WARNING_SAMPLES) peer times, in the version messages of the first 20 (TIMEDATA_MAX_SAMPLES) unique (by IP address) peers that connect, that are more than 10 minutes (TIMEDATA_WARNING_THRESHOLD seconds) but less than 10 days (TIMEDATA_IGNORE_THRESHOLD seconds) away from local time.

fixes #4338
2020-03-09 21:15:34 +00:00
MeshCollider cb8de0395f Fix race for mapBlockIndex in AppInitMain 2020-03-07 10:21:59 +03:00
Alfredo Garcia 04012a62c1 refactor experimental features 2020-03-06 07:48:33 -03:00
Homu 35bff6ac7c Auto merge of #4256 - str4d:zip-213-shielded-coinbase, r=daira
[NU3 Heartwood] Shielded Coinbase

Implements [ZIP 213](https://github.com/zcash/zips/pull/217).
2020-03-06 10:19:13 +00:00
Jack Grigg d8f0bc9e21 init: Inform on error that -mineraddress must be Sapling or transparent 2020-03-06 13:18:04 +13:00
Jack Grigg 3b3382bb48 Adjust comments on ZIP 213 logic 2020-03-06 11:50:15 +13:00
Jack Grigg 9ea5f6907f Add regtest-only -nurejectoldversions option
This enables us to write RPC tests for network upgrades before they have
been activated on testnet.
2020-02-28 13:59:53 +13:00
Jack Grigg 99ec1ff971 Add support for Sapling addresses in -mineraddress 2020-02-28 13:59:53 +13:00
Sean Bowe e597ad842a
Clarify comment 2020-02-27 17:57:59 -07:00
Sean Bowe faca79eb2f
Initialize ThreadNotifyWallets before additional blocks are imported.
Co-authored-by: Daira Hopwood <daira@electriccoin.co>
2020-02-26 11:20:12 -07:00
Daira Hopwood 7fa7225509 Update GetAdjustedTime() to GetTime().
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-02-25 16:57:22 +00:00
Daira Hopwood ddc2bbf742 Revert "Add -maxtimeadjustment with default of 0 instead of the 4200 seconds used in Bitcoin Core."
This reverts commit eb5e328073.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-02-24 16:27:07 +00:00
Gregory Maxwell 9f4ad7e1c6 Move GetWarnings() into its own file.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-02-21 01:31:16 +00:00
Alfredo Garcia e992825e0a add txexpirynotify 2020-02-13 21:42:25 -03:00
Homu a2d719b9ff Auto merge of #4324 - zancas:4323_replace_boost_fn_w_std_fn, r=str4d
Replace boost::function with std::function

Fixes: #4323

This logic is cherry-picked from the relevant commit, as referenced here:

https://github.com/bitcoin/bitcoin/pull/10395
2020-02-07 20:49:18 +00:00
Daira Hopwood eb5e328073 Add -maxtimeadjustment with default of 0 instead of the 4200 seconds used in Bitcoin Core.
Based on 40061b05dc

Co-authored-by: mruddy <mruddy@users.noreply.github.com>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-02-05 17:00:09 +00:00
practicalswift b841318ce8
Replace boost::function with std::function (C++11) 2020-02-04 19:54:25 -07:00
Homu fa341bcff0 Auto merge of #4270 - str4d:2074-wallet-2, r=str4d
Bitcoin wallet PRs 2

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7576
- bitcoin/bitcoin#7577
- bitcoin/bitcoin#7608
- bitcoin/bitcoin#7691
- bitcoin/bitcoin#7905
2019-12-18 23:53:21 +00:00
Jonas Schnelli 6c1b6c8ccc
[Wallet] refactor wallet/init interaction 2019-12-18 16:50:29 -06:00
Jonas Schnelli 5b376b5125
[Wallet] optimize return value of InitLoadWallet() 2019-12-18 16:50:29 -06:00
Jonas Schnelli c3ca0163a8
[Wallet] move "load wallet phase" to CWallet
Zcash: Modified to move our modifications to "load wallet phase".
2019-12-18 16:50:29 -06:00
Jonas Schnelli 8dacb764bc
[Wallet] move wallet help string creation to CWallet 2019-12-18 16:50:29 -06:00
Homu 0a31c163c6 Auto merge of #4252 - str4d:wallet-interface-refactor, r=str4d
Wallet interface refactor

This refactors the logic introduced in #4144 to improve the separation between the node and wallet. The notifier thread now lives next in `src/validationinterface.cpp` directly next to the existing `CMainSignals` node-wallet interface.

Part of #3877.
2019-12-18 22:48:26 +00:00
Jack Grigg 2c8dff00cc
ThreadNotifyRecentlyAdded -> ThreadNotifyWallets 2019-12-18 15:06:54 -06:00
Luke Dashjr 996d6c3f54
Common argument defaults for NODE_BLOOM stuff and -wallet 2019-12-17 12:18:50 -06:00
MarcoFalke 386245e164
mempool: Replace maxFeeRate of 10000*minRelayTxFee with maxTxFee 2019-12-17 12:18:50 -06:00
MarcoFalke 2187f93703
HelpMessage: Don't hide -mintxfee behind showDebug 2019-12-17 12:18:50 -06:00
MarcoFalke 4db07b29c8
[trivial] init: Use defaults MIN_RELAY_TX_FEE & TRANSACTION_MAXFEE 2019-12-17 12:18:50 -06:00
MarcoFalke f4b9c3283d
translations: Don't translate markdown or force English grammar 2019-12-17 12:18:50 -06:00
MarcoFalke ab77f894b7
Clarify what minrelaytxfee does 2019-12-17 12:18:50 -06:00
MarcoFalke e3bdf82dc2
Init: Use DEFAULT_TRANSACTION_MINFEE in help message 2019-12-17 12:18:50 -06:00
MarcoFalke 3de455e138
[trivial] init cleanup 2019-12-17 12:18:50 -06:00
Homu 63c3d1ec94 Auto merge of #4227 - str4d:2074-scripts-1, r=str4d
Bitcoin script PRs 1

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6335
- bitcoin/bitcoin#6424
- bitcoin/bitcoin#11058
- bitcoin/bitcoin#12460
- bitcoin/bitcoin#13194

Part of #2074.
2019-12-17 17:05:58 +00:00
Homu 5db5bd749c Auto merge of #4245 - oxarbitrage:issue4012, r=daira
Remove dead code

Closes https://github.com/zcash/zcash/issues/4012

Equivalent to bitcoin/bitcoin/pull/9822
2019-12-10 22:10:10 +00:00
Alfredo Garcia c0d5b87277 readd create_directories 2019-12-09 18:04:06 -03:00
Jorge Timón dd0c036538
Policy: MOVEONLY: Create policy/policy.h with some constants
Zcash: Adjusted to be move-only after our changes to the constants.
2019-12-04 20:34:11 +00:00
Homu 868c63f92d Auto merge of #2390 - str4d:2132-mapargs-prep, r=str4d
Misc upstream PRs

Cherry-picked from the following upstream PRs:

- https://github.com/bitcoin/bitcoin/pull/6077
  - Second commit only (first was already applied to 0.11.X and then reverted)
- https://github.com/bitcoin/bitcoin/pull/6284
- https://github.com/bitcoin/bitcoin/pull/6489
- https://github.com/bitcoin/bitcoin/pull/6235
- https://github.com/bitcoin/bitcoin/pull/6905
- https://github.com/bitcoin/bitcoin/pull/6780
  - Excluding second commit (QT) and third commit (requires https://github.com/bitcoin/bitcoin/pull/6993)
- https://github.com/bitcoin/bitcoin/pull/6961
  - Excluding QT parts, and a small `src/policy/policy.cpp` change which depends on a bunch of other PRs, which we'll have to remember to come back to.
- https://github.com/bitcoin/bitcoin/pull/7044
- https://github.com/bitcoin/bitcoin/pull/8856
- https://github.com/bitcoin/bitcoin/pull/9002

Part of #2074 and #2132.
2019-12-04 19:20:44 +00:00
Jack Grigg 5fd97dcdf9
Wrap long line 2019-12-04 17:21:55 +00:00
Jack Grigg 784a481070
cleanup: Comments 2019-12-04 17:21:54 +00:00
Gregory Maxwell 9fee2baebf
Make connect=0 disable automatic outbound connections.
Otherwise it just responds to this obvious bit of configuration by
 trying to connect to "0" in a loop.
2019-12-04 17:18:45 +00:00
Jorge Timón 71068892d2
Globals: Decouple GetConfigFile and ReadConfigFile from global mapArgs 2019-12-04 17:18:44 +00:00
Gregory Sanders f4d9e06a90
Added additional config option for multiple RPC users. 2019-12-04 17:18:43 +00:00
MarcoFalke e11e1ea58e
[trivial] Reuse translation and cleanup DEFAULT_* values
* DEFAULT_DISABLE_SAFEMODE = false
* Use DEFAULT_* constants for extern bools
2019-12-04 17:18:41 +00:00
Luke Dashjr 9bc915b02a
Bugfix: Omit wallet-related options from -help when wallet is not supported 2019-12-04 17:18:40 +00:00
Luke Dashjr 2e02bb21f7
Constrain constant values to a single location in code 2019-12-04 17:18:39 +00:00
Jack Grigg 363c945325
Initialize experimental mode in a separate function 2019-12-04 17:18:38 +00:00
Jonas Schnelli a425ac9706
Initialize logging before we do parameter interaction 2019-12-04 17:18:37 +00:00
Jonas Schnelli ef6b9b0fb2
Refactor parameter interaction, call it before AppInit2() 2019-12-04 17:18:36 +00:00
Luke Dashjr 5bedad9580
Bugfix: Omit wallet-related options from -help when wallet is disabled 2019-12-04 17:18:35 +00:00
Luke Dashjr a624c49219
Bugfix: If genproclimit is omitted to RPC setgenerate, don't change it; also show correct default in getmininginfo 2019-12-04 17:18:34 +00:00
Luke Dashjr 3779bea091
Bugfix: Describe dblogsize option correctly (it refers to the wallet database, not memory pool) 2019-12-04 17:18:33 +00:00
Luke Dashjr b90ea483dd
Bugfix: RPC: blockchain: Display correct defaults in help for verifychain method 2019-12-04 17:18:32 +00:00