Commit Graph

1436 Commits

Author SHA1 Message Date
Jack Grigg 3fe8285c7e Implement Orchard signature validation consensus rules 2021-06-14 22:47:00 +01:00
Jack Grigg 5ce1e649d3 Throw an exception instead of asserting if Rust tx parser fails
The Rust parser is stricter than the C++ parser, so we can reach errors
now non-contextually that previously were thrown by the consensus rules.

Various tests have been updated to check for these exceptions, as they
can no longer instantiate these transactions to pass to the consensus
rules. The tests use an unsafe constructor so they can still check the
consensus rules.
2021-06-13 07:57:39 +01:00
Jack Grigg a54359eed6 test: Regenerate sighash.json after generator fixes 2021-06-13 07:57:39 +01:00
Jack Grigg 59efe29a78 test: Small fixes to sighash test vector generation
Also tweaks the test that parses them to display errors
2021-06-13 07:57:39 +01:00
Jack Grigg cfa7d6bf73 test: Generate valid Sapling types
The C++ parser only requires the various Sapling components to be 32-byte
arrays. The Rust parser enforces stricter type checks at parse time, and
we now unconditionally parse with the Rust parser for deriving txids.
2021-06-13 07:57:39 +01:00
Jack Grigg 08baaaa492 Fix tests that assume CTxOuts can be "null" 2021-06-13 01:45:17 +01:00
Jack Grigg 0b8a348c2b ZIP 244 signature digests 2021-06-12 20:03:53 +01:00
Jack Grigg bd1fd2eaca ZIP 244 transaction digests 2021-06-12 20:03:53 +01:00
Jack Grigg bfc77d571e v5 transaction format parser
The majority of the parser is in C++, but Orchard bundles are parsed
exclusively by Rust.

The ZIP 244 test vectors are brought in here so we can start by testing
round-trip serialization.
2021-06-10 22:11:42 +01:00
Homu 78de0cdf46 Auto merge of #5026 - str4d:bloom-filter-backports, r=str4d
Backport bloom filter improvements

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7113
- bitcoin/bitcoin#7818
  - Only the second commit (to resolve conflicts).
- bitcoin/bitcoin#7934
- bitcoin/bitcoin#8655
  - Partial backport to help resolve conflicts.
- bitcoin/bitcoin#9060
- bitcoin/bitcoin#9223
- bitcoin/bitcoin#9644
  - Partial backport to help resolve conflicts.
- bitcoin/bitcoin#9916
- bitcoin/bitcoin#9750
- bitcoin/bitcoin#13176
- bitcoin/bitcoin#13948
- bitcoin/bitcoin#16073
- bitcoin/bitcoin#18670
- bitcoin/bitcoin#18806
  - Reveals upstream's covert fix for CVE-2013-5700.
- bitcoin/bitcoin#19968
2021-04-15 20:40:26 +00:00
Jack Grigg c592bf7da0 python: Use UTF-8 encodings for opened files 2021-04-14 13:19:33 +12:00
Jeremy Rubin a314cdba56 Add CheckQueue Tests
zcash: cherry picked from commit 96c7f2c3458950061b057fcd3daaf47b57e6bac7
zcash: https://github.com/bitcoin/bitcoin/pull/9497
2021-04-02 12:22:48 -06:00
Sebastian Falbesoner 48fe1baf00 refactor: Remove unused methods CBloomFilter::reset()/clear()
Co-authored-by: MarcoFalke <falke.marco@gmail.com>
(cherry picked from commit 69ffddc83e0f3e265bf6cf7ae31489ae629fe6be)

Zcash: Excluding change to src/test/fuzz/bloom_filter.cpp which we
don't have (we haven't backported upstream's fuzzing framework).
2021-04-02 16:04:55 +13:00
kobake 8b1fe83120 Fix msvc compiler error C4146 (unary minus operator applied to unsigned type)
On msvc14, int literal '-2147483648' is invalid, because '2147483648' is unsigned type and cant't apply minus operator to unsigned type.
To define the int literal correctly, use '-2147483647 - 1' formula that is also used to define INT_MIN in limits.h.

(cherry picked from commit 8e0720bdb9141b00b4c00893b8139904c67ddacf)
2021-04-02 16:04:55 +13:00
S. Matthew English c6591f2cd2 unification of Bloom filter representation
Output instances of "BloomFilter" changed to "Bloom filter", in accordance with Wikipedia standard notation:

https://en.wikipedia.org/wiki/Bloom_filter

also to sync with the majority of cases in the self-same file

(cherry picked from commit b7aa2902fd3c29487f585c264d8845899f4c1846)
2021-04-02 16:04:55 +13:00
Pavel Janík 48be374f68 Do not shadow variables
(cherry picked from commit 4731cab8fbff51a8178c85d572e2482040278616)

Zcash: Excluding changes to code we haven't backported.
2021-04-02 16:04:55 +13:00
Pieter Wuille 7d488feb12 More efficient bitsliced rolling Bloom filter
This patch changes the implementation from one that stores 16 2-bit integers
in one uint32_t's, to one that stores the first bit of 64 2-bit integers in
one uint64_t and the second bit in another. This allows for 450x faster
refreshing and 2.2x faster average speed.

(cherry picked from commit 1953c40aa9589a03035fd294f3ba3549374a4826)
2021-04-02 16:04:55 +13:00
Gregory Maxwell 12ddfcacd4 Remove mruset as it is no longer used. 2021-02-19 20:16:10 +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
Homu 65122845c5 Auto merge of #4991 - nuttycom:backport/9792-fastrandom_chacha20, r=str4d
FastRandomContext improvements and switch to ChaCha20

Backport of bitcoin/bitcoin#9792

Commits are recorded here in stack order

- pick bitcoin/bitcoin@4fd2d2fc97
- pick bitcoin/bitcoin@16329224e7
- pick bitcoin/bitcoin@e04326fe66
- pick bitcoin/bitcoin@663fbae777 -- already applied in #3858, skip
- pick bitcoin/bitcoin@c21cbe61c6 -- already applied in #3858, skip
2021-02-18 21:40:41 +00:00
Homu 9d0d8f49a8 Auto merge of #4973 - str4d:bech32-known-answer, r=str4d
test: Convert Bech32 test vectors into known-answer test vectors

This enables other projects to confirm independently that their encoding
or decoding functions are consistent, instead of merely that they are
round-trip correct.
2021-02-18 20:15:58 +00:00
Casey Rodarmor 63a214ad45 Add limitedmap test 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
Pieter Wuille 1f41301c97 Add a FastRandomContext::randrange and use it
(cherry picked from commit 4fd2d2fc97e21efceab849576e544160fd5e3e3d)
2021-02-17 15:43:43 -07:00
Pieter Wuille 12d8d06c80 Switch FastRandomContext to ChaCha20
(cherry picked from commit 16329224e70d0525208f6b0ba00c5e1531a4f5ea)
2021-02-17 15:43:43 -07:00
Pieter Wuille 89ab5b1eb6 Add ChaCha20
(cherry picked from commit e04326fe6652543dc26d90eba4a48fbdc935fd0c)
2021-02-17 15:43:43 -07:00
Homu cd00fb08d5 Auto merge of #4990 - nuttycom:backport/7888_prevector_bugs, r=nuttycom
Fix prevector bugs.

Backports:

bitcoin/bitcoin#7888
bitcoin/bitcoin#8671

Commits below are listed in stack order.

pick bitcoin/bitcoin@f71d4a3
pick bitcoin/bitcoin@a7af72a
pick bitcoin/bitcoin@4ed41a2
pick bitcoin/bitcoin@1e2c29f
2021-02-17 21:11:03 +00:00
Jeremy Rubin 372ed59e9c Minimal fix to slow prevector tests as stopgap measure
(cherry picked from commit f71d4a3786611d564e4c239099501daee989b170)
2021-02-17 10:56:59 -07:00
Kaz Wesley 6e582e2792 test prevector::swap
- add a swap operation to prevector tests (fails due to broken prevector::swap)
- fix 2 prevector test operation conditions that were impossible

(cherry picked from commit 4ed41a2b611dfd328fe6f72312d6c596650f03f8)
2021-02-17 10:56:59 -07:00
Homu b4b07a1bbd Auto merge of #2812 - str4d:2074-store-banlist, r=nuttycom
banlist.dat: store banlist on disk

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6310
- bitcoin/bitcoin#6315
  - Only the new signal and net changes, no QT.
- bitcoin/bitcoin#7350
- bitcoin/bitcoin#7458
- bitcoin/bitcoin#7696
- bitcoin/bitcoin#7959
- bitcoin/bitcoin#7906
  - Only the ban-related commits.
- bitcoin/bitcoin#8392
  - Only the second commit.
- bitcoin/bitcoin#8085
  - Only the second commit.
- bitcoin/bitcoin#10564
- bitcoin/bitcoin#13061
  - Wasn't needed when I first made this backport in 2017, but it is now!

Part of #2074.
2021-02-17 17:33:19 +00:00
Wladimir J. van der Laan 2f840b55c0 test: Add more test vectors for siphash
Add full test vectors from spec, test per byte and per 8 bytes.

Builds on #8086.
2021-02-17 08:07:00 -07:00
Bernhard M. Wiedemann 45113ebe57 Make tests pass after 2020
also test that 64 bit integers are properly handled
2021-02-17 03:06:02 +00:00
Pieter Wuille 46060d5c8b Support SipHash with arbitrary byte writes 2021-02-16 18:00:22 -07:00
EthanHeilman 71f39f4160 Fix de-serialization bug where AddrMan is corrupted after exception
* CAddrDB modified so that when de-serialization code throws an exception Addrman is reset to a clean state
* CAddrDB modified to make unit tests possible
* Regression test created to ensure bug is fixed
* StartNode modifed to clear adrman if CAddrDB::Read returns an error code.
2021-02-16 18:02:25 +00:00
Jonas Schnelli 68066648a9 [QA] fix netbase tests because of new CSubNet::ToString() output 2021-02-16 18:02:25 +00:00
Wladimir J. van der Laan 48ffe79511 net: Fix CIDR notation in ToString()
Only use CIDR notation if the netmask can be represented as such.
2021-02-16 18:02:25 +00:00
Jonas Schnelli f8bf7b146c net: use CIDR notation in CSubNet::ToString() 2021-02-16 18:02:25 +00:00
Jonas Schnelli a1f8683066 Adding CSubNet constructor over a single CNetAddr 2021-02-16 18:02:24 +00:00
Homu c81adc3718 Auto merge of #4979 - nuttycom:upstream_siphash, r=str4d
Backport of bitcoin/bitcoin#8020

Cherry-picked from bitcoin/bitcoin#8020

- cherry-pick bitcoin/bitcoin@a68ec21f7e
  - conflict with bitcoin/bitcoin@957e5d2
- cherry-pick bitcoin/bitcoin@8cc9cfe160
- cherry-pick bitcoin/bitcoin@382c871d28
  - replace CCoinsKeyHasher with SaltedTxidHasher
- cherry-pick bitcoin/bitcoin@0b1295b066
  - self-conflict with previously-applied bitcoin/bitcoin@b8a657936 (zcash/zcash#3180)
2021-02-15 21:40:18 +00:00
Pieter Wuille f3b2cdb32b Add SipHash-2-4 primitives to hash 2021-02-11 11:10:42 -07: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 340add223a test: Convert Bech32 test vectors into known-answer test vectors
This enables other projects to confirm independently that their encoding
or decoding functions are consistent, instead of merely that they are
round-trip correct.
2021-02-02 15:54:25 +00:00
Jack Grigg 90232f65ae Rename libzcashconsensus.la -> libzcash_script.la 2021-01-25 22:20:25 +00:00
Jack Grigg ea8065917e Rename zcashconsensus_* -> zcash_script_* in APIs 2021-01-25 22:20:25 +00:00
Jack Grigg c5e7b84e9b Rename src/script/zcashconsensus.* -> src/script/zcash_script.* 2021-01-25 22:20:25 +00:00
Jack Grigg 308bb1083a Add amount and consensus branch ID to zcashconsensus_verify_script
We didn't initially expose these because we assumed that this API was
likely being used somewhere in the ecosystem. However, the build system
for libzcashconsensus has been broken since 2018, and no issues were
raised, which strongly indicates that this API is not currently in use.
2021-01-25 22:20:25 +00: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 79ad5984b1 Remove JSDescription::h_sig
This removes the zcash/JoinSplit.hpp dependency from
primitives/transaction.cpp, and thus from libzcashconsensus.
2020-12-20 22:42:22 +00:00
Jack Grigg b1aa9365af Add JSDescriptionInfo for constructing JSDescriptions
This matches the existing transaction builder structs:
- SpendDescriptionInfo
- OutputDescriptionInfo
- TransparentInputInfo

It also removes the dependency of the transaction format on the proving
system.
2020-12-20 22:42:22 +00:00
Homu 844ef48b45 Auto merge of #4912 - daira:daira-partial-revert-4904, r=daira
Partial revert of "Update links"

This partially reverts commit f459e43dc9. See #4904.

In summary, the rationale is that:
* Some of the changed files are from subtrees, which should be updated upstream.
* The licensing of four of the files under `build-aux/m4` is complicated and so changes to them should have required review with that in mind: 5b97cd27f8/COPYING (L38-L44)
* The changes to `contrib/debian/copyright` must also be reverted because those are in copies of specific versioned licenses.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-12-17 18:28:32 +00:00
Daira Hopwood 4fedb32441 Fix a typo introduced in #4904.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-12-17 18:27:52 +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
Homu a058196146 Auto merge of #4603 - nuttycom:ff/no_global_params, r=daira
Prefer explicit passing of CChainParams to the Params() global.

This is (intended to be) a pure refactoring, no functional changes included.
2020-12-17 01:26:36 +00:00
Jack Grigg a8bcd46b8c test: Fix test_bitcoin compilation on macOS High Sierra
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-12-17 00:42:48 +00:00
Jack Grigg d8d0918951 scripted-diff: Migrate from boost::optional to std::optional
-BEGIN VERIFY SCRIPT-
sed -i 's/boost::none/std::nullopt/g' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ./src/*/*/*.h* ./src/*/*/*.cpp ;
sed -i 's/boost::optional/std::optional/g' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ./src/*/*/*.h* ./src/*/*/*.cpp ;
sed -i 's/std::optional<\(.*\)&>/std::optional<std::reference_wrapper<\1>>/' ./src/*/*.h ./src/*/*.cpp ;
sed -i 's/is_initialized()/has_value()/' ./src/*.cpp ./src/*/*.cpp ;
sed -i ':a;N;$!ba;s/#include <boost\/optional.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h* ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i ':a;N;$!ba;s/#include "boost\/optional.hpp"\n//' ./src/*.h ;
-END VERIFY SCRIPT-
2020-12-16 22:59:35 +00:00
Jack Grigg 521eb81a95 Add <optional> header to files that will need it 2020-12-16 22:59:34 +00:00
Jack Grigg ae4551004a Finish migrating to std::variant 2020-12-16 22:59:32 +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
Jack Grigg f68c79554f Add <variant> header to files that will need it 2020-12-16 22:48:21 +00:00
Kris Nuttycombe e9b5d83709 Prefer explicit passing of CChainParams to the Params() global. 2020-12-15 08:23:09 -07:00
Dimitris Apostolou f459e43dc9
Update links 2020-12-13 11:24:44 +02:00
MarcoFalke 1ffd2d5fad util: Replace boost::signals2 with std::function
Zcash: Added missing imports that were being implicitly included.
2020-11-23 23:07:15 +00:00
Jorge Timón c3983ccb1c scripted-diff: Remove #include <boost/foreach.hpp>
-BEGIN VERIFY SCRIPT-
sed -i ':a;N;$!ba;s/#include <boost\/foreach.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp
-END VERIFY SCRIPT-
2020-11-23 23:07:15 +00:00
Jorge Timón 62114cff9e scripted-diff: Remove BOOST_REVERSE_FOREACH
-BEGIN VERIFY SCRIPT-
sed -i 's/BOOST_REVERSE_FOREACH(\(.*\), \(.*\))/for (\1 : reverse_iterate(\2))/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ;
-END VERIFY SCRIPT-
2020-11-23 23:07:15 +00:00
Jorge Timón 46509b99f4 Introduce src/reverse_iterator.hpp and include it...
...where it will be needed

Taken from https://gist.github.com/arvidsson/7231973 with small
modifications to fit the bitcoin core project
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 d0a5343da9 lint: Fix missing or inconsistent include guards 2020-11-09 23:06:21 +00:00
Jack Grigg 95ad6fc6bf test: Fix pyflakes warning in bitcoin-util-test.py 2020-11-09 19:56:16 +00:00
John Newbery e289f812d2 Improve logging in bctest.py if there is a formatting mismatch 2020-10-28 16:20:53 +00:00
John Newbery abd7840c22 Clean up bctest.py and bitcoin-util-test.py
- remove newlines
- change tabs for spaces, to align with convention in other py files
- add comments
- add 'Bitcoin Core Developers' copyright notice
2020-10-28 16:20:53 +00:00
jnewbery 5508f14437 Add logging to bitcoin-util-test.py
- Use the python standard logging library
- Run all tests and report all failing test-cases (rather than stop after one test case fails)
- If output is different from expected output, log a contextual diff.
2020-10-28 16:20:53 +00:00
Wladimir J. van der Laan 3e2460b6f8 test: Add format-dependent comparison to bctest
This splits the output comparison for `bitcoin-tx` into two steps:

- First, check for data mismatch, parsing the data as json or hex
  depending on the extension of the output file

- Then, check if the literal string matches

For either of these cases give a different error.

This prevents wild goose chases when e.g. a trailing space doesn't match
exactly, and makes sure that both test output and examples are valid
data of the purported format.
2020-10-28 16:20:53 +00:00
jnewbery 2079d495f6 add verbose mode to bitcoin-util-test.py 2020-10-28 16:07:25 +00:00
jnewbery e9c1703ba6 bitcoin-util-test.py should fail if the output file is empty 2020-10-28 16:07:25 +00:00
jnewbery cbce715c00 Add option to run bitcoin-util-test.py manually 2020-10-28 16:07:25 +00:00
jnewbery 25193f0fa0 Add bitcoin-tx JSON tests
Zcash: Modified for us, and excluding test cases we don't have.
2020-10-28 16:02:36 +00:00
Homu b9a4f291ea Auto merge of #4812 - str4d:shielded-reqs-reject-reasons, r=str4d
Improve reject reasons for unmet shielded requirements

These reject messages end up bubbling up to users via the RPC interface.
Distinguishing between the various failure cases will help users figure
out why their transaction is being rejected.

Closes zcash/zcash#3114.
2020-10-27 01:35:14 +00:00
Jack Grigg 1b42734b9f tests: Update chained_joinsplits test for HaveShieldedRequirements API change 2020-10-26 23:46:19 +00:00
Jack Grigg d7c80e760c utils: Remove unnecessary GetTempPath() 2020-10-26 02:02:18 +00:00
Wladimir J. van der Laan 0d3bba071d Remove `namespace fs=fs`
Having these inside functions is silly and redundant now.
2020-10-22 01:11:37 +01: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
Mustafa dafc0d35eb Move GetTempPath() to testutil. 2020-10-22 01:11:37 +01:00
Mustafa 42929fae9d Add a source file for unit test utils. 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
Kris Nuttycombe fd841a1b81 Remove redundant CheckBlock calls.
This change unifies handling of the -ibdskiptxverification
flag and ensures consistent handling of checkpoint heights
when evaluating whether transaction verification may be skipped.

This change also removes two redundant CheckBlock calls. This
change is consensus-critical and requires 3 reviews.
2020-10-07 13:07:34 -06:00
Jack Grigg a9f62bdda0 depends: Boost 1.74.0
- The old patch is no longer necessary because of this upstream fix:
    https://github.com/boostorg/build/pull/560

- Boost 1.72 removed a <deque> from an include, which exposed a missing
  include in src/httpserver.cpp.

- Boost 1.73 moved function placeholders into the boost::placeholders
  namespace.

- The new patch is a fix from just after Boost 1.74 was released, fixing
  a warning that was missed.
2020-10-05 19:48:46 +01:00
Daira Hopwood ce0654e13a Cosmetics in CScriptNum code and tests.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-01 00:34:31 +01:00
Daira Hopwood 932d627753 It's unnecessary to pass int64_t by const reference.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-01 00:34:31 +01:00
Daira Hopwood f432fe5ebf Add assertions for CScriptNum[10] +/- int64_t to avoid the possibility of UB.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-01 00:34:31 +01:00
Daira Hopwood 9ba10a8071 Avoid undefined behaviour in scriptnum tests.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-10-01 00:34:31 +01:00
Daira Hopwood b165ead16a Minor additional OpenSSL scouring.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-09-30 10:44:42 +01:00
Jack Grigg ab35a260d5 Remove remaining OpenSSL references 2020-09-30 00:40:12 +01:00
Wladimir J. van der Laan 7b3cb48232 Replace scriptnum_test's normative ScriptNum implementation
Compare against the scriptnum from Bitcoin Core 0.10 instead of OpenSSL.
Closes #7086.
2020-09-30 00:40:12 +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
Homu 94cf4a4946 Auto merge of #4558 - linuxion:master, r=str4d
[RPC] Add transaction size to JSON output

Cherry-picked from upstream PR https://github.com/bitcoin/bitcoin/pull/7072.
2020-09-28 22:40:09 +00:00
Nick abcce56fe1 [RPC] Add transaction size to JSON output
This may be useful for blockchain explorers.
2020-09-28 23:12:21 +01:00
Jack Grigg 66ac442da8 LockedPool: Make Arena::free and LockedPool::free noexcept
Attempting to free a detectably invalid pointer should terminate, as
this would be a programming error.
2020-09-28 16:20:06 +01:00
Jack Grigg fa6921c480 LockedPool: Fix LockedPool::free(nullptr) to be a no-op
It was documented as such, but nullptr is never an address within an
Arena, so it would fall through and trigger the std::runtime_error.
2020-09-28 15:46:00 +01:00
str4d b2b5cccf39
test: Fix LFSR period in comments
Verified using a Python implementation.

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-09-26 00:56:20 +01:00
Homu 514d868179 Auto merge of #4739 - str4d:update-leveldb, r=str4d
Update LevelDB to upstream commit f545dfabf

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#7911
- bitcoin/bitcoin#7982
- bitcoin/bitcoin#8133
- bitcoin/bitcoin#8784
  - Only the missing changes.
- bitcoin/bitcoin#8826
- bitcoin/bitcoin#8613
- bitcoin/bitcoin#10544
- bitcoin/bitcoin#10633
  - Only the changes to files and code we have.
- bitcoin/bitcoin#10806
- bitcoin/bitcoin#10958
- bitcoin/bitcoin#12451
- bitcoin/bitcoin#13925
- bitcoin/bitcoin#15270

This upgrades LevelDB in the exact same commit progression as upstream, up to January 2019.
2020-09-25 16:16:37 +00:00
Jack Grigg 2d172e121f Replace libsodium's crypto_generichash_blake2b with blake2b_simd 2020-09-24 15:58:14 +01:00
Dimitris Tsapakidis b892fe13f8 Fixed multiple typos
A few "a->an" and "an->a".
"Shows, if the supplied default SOCKS5 proxy" -> "Shows if the supplied default SOCKS5 proxy". Change made on 3 occurrences.
"without fully understanding the ramification of a command" -> "without fully understanding the ramifications of a command".
Removed duplicate words such as "the the".

Zcash: Only the changes to files and code that we have.
2020-09-23 00:07:48 +01:00
Taylor Hornby 9f284b5010 Fix buffer overflows in P2PKH tests 2020-08-26 14:01:40 -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
Jack Grigg efb4246ad3 Replace libsodium's crypto_sign with ed25519-zebra
crypto_sign_verify_detached is still used within the consensus rules
until Canopy activation. ed25519-zebra generates signatures that are
valid under both pre- and post-Canopy rules (for our honest usage),
so we can use it to generate transaction signatures now. Then once
Canopy activates, we can remove the remaining usages of crypto_sign.
2020-08-20 19:00:47 +01:00
Jack Grigg 1c447d85c0 Replace libsodium's randombytes_buf with rand_core::OsRng::fill_bytes 2020-08-18 21:57:06 +01:00
Kris Nuttycombe 0cdce269b5 Merge remote-tracking branch 'upstream/master' into bazel-patches 2020-08-14 14:30:15 -06:00
Jack Grigg f89ea3fc33 Add an RPC method for setting the tracing filter directives 2020-08-07 15:26:28 +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 b383d6cada Merge remote-tracking branch 'upstream/master' into bazel-patches 2020-07-31 12:49:40 -06:00
Kaz Wesley 2555074c22 LockedPool: avoid quadratic-time allocation
Use separate maps for used/free chunks to avoid linear scan through alloced
chunks for each alloc.
2020-07-31 06:51:33 +01:00
Kaz Wesley 509652e936 LockedPool: test handling of invalid allocations
(Currently fails due to bug)
2020-07-31 06:51:00 +01:00
Wladimir J. van der Laan d570eabc38 support: Add LockedPool
Add a pool for locked memory chunks, replacing LockedPageManager.

This is something I've been wanting to do for a long time. The current
approach of locking objects where they happen to be on the stack or heap
in-place causes a lot of mlock/munlock system call overhead, slowing
down any handling of keys.

Also locked memory is a limited resource on many operating systems (and
using a lot of it bogs down the system), so the previous approach of
locking every page that may contain any key information (but also other
information) is wasteful.
2020-07-31 06:43:09 +01:00
Cory Fields d5b30b36dd crypto: add aes cbc tests 2020-07-17 18:48:55 +12:00
Pieter Wuille 77b5fc23cc Add ctaes-based constant time AES implementation 2020-07-17 18:48:21 +12:00
Jack Grigg 96920e952d Remove C++ Equihash validator 2020-07-15 14:03:45 +12:00
Homu 973dff930a Auto merge of #4599 - daira:iterator-cleanup, r=therealyingtong
Clean up some iterator usage

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-07-14 05:12:41 +00:00
Daira Hopwood 66096d540f Clean up some iterator usage.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-07-13 19:35:26 +01:00
Kris Nuttycombe 07ff0d19a0 Make evident the relationship between chainparams and key IO. 2020-07-09 17:48:47 -06:00
Jack Grigg 042bd12a5c Move JSDescription::Verify to ProofVerifier::VerifySprout 2020-07-08 13:59:47 +12:00
Jack Grigg 35765ec9de Move ProofVerifier out of the libzcash namespace
It needs to be closer to the root of our dependency tree, so that it can
depend on the transaction format. The libzcash compilation unit is
further from the dependency tree root than the transaction format.
2020-07-08 13:59:47 +12: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
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
Homu 68fd808e0f Auto merge of #4444 - oxarbitrage:issue4375, r=str4d
Fix advertised version

Closes https://github.com/zcash/zcash/issues/4375 by adding the `-` character to the list of safe ones.

Now i can see stuff like the following in the logs:

```
...
2020-04-13 14:19:37 receive version message: /MagicBean:2.1.1-1/: version 170009, blocks=795400, us=[2800:a4:316b:8e00:ceb:c7b4:3481:197f]:59754, peer=2
...
```

API call `getpeerinfo` will also gets fixed.
2020-05-05 00:29:32 +00:00
Alfredo Garcia 766e0b8f09 add a test case 2020-04-19 09:52:38 -03:00
Homu 215c74ec3f Auto merge of #4454 - defuse:cscriptnum-serialization-fix, r=daira
Fix undefined behavior in CScriptNum

Fixes #4432
2020-04-15 22:36:33 +00:00
Taylor Hornby 418ef7002a Fix undefined behavior in CScriptNum 2020-04-15 09:19:00 -06:00
Jack Grigg f4fe77ad1e test: Run Equihash test vectors on both C++ and Rust validators 2020-04-15 11:31:10 +12:00
Jack Grigg cf480fe402 Add ZIP 221 logic to block index
CBlockHeader.hashFinalSaplingRoot has been renamed to hashLightClient.

CBlockIndex now stores:
- hashLightClient as from the block header
- hashFinalSaplingRoot, which is accurate for all blocks prior to
  Heartwood activation, and all blocks from Heartwood activation onward
  that are connected at some point to the main chain in ConnectBlock().
- hashChainHistoryRoot, which is null prior to Heartwood activation, and
  set per ZIP 221 from Heartwood activation.

The new block index fields are only written to disk for client version
2.1.2 and above, which will be the first Heartwood-aware clients (even
if Heartwood doesn't have an activation height).
2020-04-08 08:49:01 +12:00
NikVolf cf247bc655 push/pop history with tests
Co-authored-by: Jack Grigg <jack@z.cash>
2020-04-08 08:49:01 +12: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
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
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
Larry Ruane 75251cb2bc util: CBufferedFile fixes 2020-03-02 18:03:46 -07:00
Jack Grigg 99ec1ff971 Add support for Sapling addresses in -mineraddress 2020-02-28 13:59:53 +13:00
Jack Grigg 80169c940f ZIP 213 consensus rules 2020-02-28 13:59:53 +13:00
Alfredo Garcia 445ae593d6 change the cm member of OutputDescription to cmu 2020-02-26 17:43:50 -03: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 d631187b39 Replace time adjustment with warning only.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-02-25 16:48:16 +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
Gregory Maxwell d6a48adb76 Eliminate data races for strMiscWarning and fLargeWork*Found.
This moves all access to these datastructures through accessor functions
and protects them with a lock.

Relative to the upstream commit, we also add GetMiscWarning() to make this accessible to tests.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-02-21 01:30:23 +00:00
mdr0id 1ce2e86612 Update #! env for python3 2020-02-10 13:34:29 -08:00
Homu e93586a0c4 Auto merge of #4331 - zcash:hotfix-v2.1.1-1, r=ebfull
Hotfix v2.1.1-1

The commits in this PR have been reviewed internally by our team.
2020-02-07 04:50:43 +00:00
Jack Grigg 7bbd846f0f Apply a consistent ban policy within ContextualCheckTransaction 2020-02-06 14:30:37 +00:00
Homu 74ff73abab Auto merge of #3858 - str4d:microbench-1, r=str4d
Micro-benchmarking framework part 1

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6733
- bitcoin/bitcoin#6770
- bitcoin/bitcoin#6892
  - Excluding changes to `src/policy/policy.h` which we don't have yet.
- bitcoin/bitcoin#7934
  - Just the benchmark, not the performance improvements.
- bitcoin/bitcoin#8039
- bitcoin/bitcoin#8107
- bitcoin/bitcoin#8115
- bitcoin/bitcoin#8914
  - Required resolving several merge conflicts in code that had been refactored upstream. The changes were simple enough that I decided it was okay to impose merge conflicts on pulling in those refactors later.
- bitcoin/bitcoin#9200
- bitcoin/bitcoin#9202
  - Adds support for measuring CPU cycles, which is later removed in an upstream PR after the refactor. I am including it to reduce future merge conflicts.
- bitcoin/bitcoin#9281
  - Only changes to `src/bench/bench.cpp`
- bitcoin/bitcoin#9498
- bitcoin/bitcoin#9712
- bitcoin/bitcoin#9547
- bitcoin/bitcoin#9505
  - Just the benchmark, not the performance improvements.
- bitcoin/bitcoin#9792
  - Just the benchmark, not the performance improvements.
- bitcoin/bitcoin#10272
- bitcoin/bitcoin#10395
  - Only changes to `src/bench/`
- bitcoin/bitcoin#10735
  - Only changes to `src/bench/base58.cpp`
- bitcoin/bitcoin#10963
- bitcoin/bitcoin#11303
  - Only the benchmark backend change.
- bitcoin/bitcoin#11562
- bitcoin/bitcoin#11646
- bitcoin/bitcoin#11654

This pulls in all changes to the micro-benchmark framework prior to December 2017, when it was rewritten. The rewrite depends on other upstream PRs we have not pulled in yet.

This does not pull in all benchmarks prior to December 2017. It leaves out benchmarks that either test code we do not have yet (except for the `FastRandomContext` refactor, which I decided to pull in), or would require rewrites to work with our changes to the codebase.
2020-01-24 23:39:50 +00:00
Homu 599ebb9686 Auto merge of #3742 - defuse:pow-security-improvements, r=str4d
Equihash Macro and Testing Improvements
2020-01-24 20:52:30 +00:00
Wladimir J. van der Laan 957e5d216f Kill insecure_random and associated global state
There are only a few uses of `insecure_random` outside the tests.
This PR replaces uses of insecure_random (and its accompanying global
state) in the core code with an FastRandomContext that is automatically
seeded on creation.

This is meant to be used for inner loops. The FastRandomContext
can be in the outer scope, or the class itself, then rand32() is used
inside the loop. Useful e.g. for pushing addresses in CNode or the fee
rounding, or randomization for coin selection.

As a context is created per purpose, thus it gets rid of
cross-thread unprotected shared usage of a single set of globals, this
should also get rid of the potential race conditions.

- I'd say TxMempool::check is not called enough to warrant using a special
  fast random context, this is switched to GetRand() (open for
  discussion...)

- The use of `insecure_rand` in ConnectThroughProxy has been replaced by
  an atomic integer counter. The only goal here is to have a different
  credentials pair for each connection to go on a different Tor circuit,
  it does not need to be random nor unpredictable.

- To avoid having a FastRandomContext on every CNode, the context is
  passed into PushAddress as appropriate.

There remains an insecure_random for test usage in `test_random.h`.

Zcash: Resolved conflicts with the following files

	src/addrman.cpp
	src/main.cpp
	src/net.cpp
	src/net.h
	src/policy/fees.cpp
	src/policy/fees.h
	src/random.cpp
	src/test/merkle_tests.cpp
	src/test/net_tests.cpp
	src/test/prevector_tests.cpp
	src/test/sighash_tests.cpp
	src/test/skiplist_tests.cpp
	src/test/test_bitcoin.cpp
	src/test/versionbits_tests.cpp
	src/wallet/test/crypto_tests.cpp
2020-01-22 21:41:26 +00:00
Pieter Wuille e82901f4fd
Do not treat bare multisig as IsMine
Such outputs can still be watched, and signed for, but they aren't treated as valid payments.
That means they won't cause transactions to appear in listtransactions, their outputs to be
shown under listunspent, or affect balances.
2019-12-18 18:59:15 -06:00
Jim Posen de9c679770
[script] Unit tests for IsMine
Does not test watch-only addresses.

Zcash: Excluding SegWit tests and isInvalid code (which is part of the
SegWit support structure).
2019-12-18 18:59:15 -06:00
Jim Posen bf2c8b3bc6
[script] Unit tests for script/standard functions
Zcash: Excluding unit tests for SegWit logic.
2019-12-18 18:59:15 -06:00
Wladimir J. van der Laan 3782c4d6ab
wallet_ismine.h → script/ismine.h
Removes conditional dependency of `src/test` on wallet.

Makes multisig and P2SH tests complete without wallet built-in.
2019-12-18 16:50:29 -06:00
Wladimir J. van der Laan 91f0b506ca
test: Create test fixture for wallet
Removes all the `#ifdef ENABLE_WALLET` from `test_bitcoin` by
making the wallet tests use their own fixture.
2019-12-18 16:50:29 -06:00
Wladimir J. van der Laan 994a51d4d7
test: move accounting_tests and rpc_wallet_tests to wallet/test
Move the two other wallet tests to where they belong.
2019-12-18 16:50:29 -06:00
Jonas Schnelli 6c1b6c8ccc
[Wallet] refactor wallet/init interaction 2019-12-18 16:50:29 -06:00
MarcoFalke cbdceb0b28
transaction_tests: Be more strict checking dust
* Don't allow off-by-one or more
* Make clear dust is coupled with minRelayTxFee
* Check rounding for odd values
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 98354db098 Auto merge of #4246 - rex4539:fix-comment, r=daira
Remove stale comment

Closes https://github.com/zcash/zcash/issues/2962
2019-12-06 17:32:12 +00:00
Dimitris Apostolou f0003239f8
Change "protect" terminology to "shield" 2019-12-04 23:17:06 +02:00
Peter Todd 602960e5b5
Accept any sequence of PUSHDATAs in OP_RETURN outputs
Previously only one PUSHDATA was allowed, needlessly limiting
applications such as matching OP_RETURN contents with bloom filters that
operate on a per-PUSHDATA level. Now any combination that passes
IsPushOnly() is allowed, so long as the total size of the scriptPubKey
is less than 42 bytes. (unchanged modulo non-minimal PUSHDATA encodings)

Also, this fixes the odd bug where previously the PUSHDATA could be
replaced by any single opcode, even sigops consuming opcodes such as
CHECKMULTISIG. (20 sigops!)
2019-12-04 20:35:01 +00:00
Luke Dashjr 4884e75c8c
Policy: MOVEONLY: 3 functions to policy.o:
- [script/standard.o] IsStandard
- [main.o] IsStandardTx
- [main.o] AreInputsStandard

Also, don't use namespace std in policy.cpp
2019-12-04 20:34:14 +00: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 6278085c23
Match alerts both with and without comments
We always locally check alerts against our subversion string without comments.
This change ensures that we will also propagate alerts to peers based on their
subversion strings without comments. Note that if an alert specifically targets
a commented subversion string, we will only relay it to peers with the exact
same comments.
2019-12-04 17:21:56 +00:00
Jack Grigg 00d1efde32
Add tests covering the current interaction of alerts with subver comments 2019-12-04 17:21:52 +00:00
Jack Grigg c1ed8080f2
Handle Equihash and optional miner code in TestChain100Setup 2019-12-04 17:21:51 +00:00
Jorge Timón af9b9652fa
Chainparams: Replace CBaseChainParams::Network enum with string constants (suggested by Wladimir) 2019-12-04 17:18:30 +00:00
Wladimir J. van der Laan 5514316892
Fix argument parsing oddity with -noX
`bitcoind -X -noX` ends up, unintuitively, with `X` set.
(for all boolean options X)

This result is due to the odd two-pass processing of arguments. This
patch fixes this oddity and simplifies the code at the same time.
2019-12-04 17:18:27 +00:00
Gavin Andresen b346588c13
Unit test doublespends in new blocks
As suggested by Greg Maxwell-- unit test to make sure a block
with a double-spend in it doesn't pass validation if half of
the double-spend is already in the memory pool (so full-blown
transaction validation is skipped) when the block is received.
2019-12-04 17:13:57 +00:00
Dimitris Apostolou cec2bd93cf
Remove stale comment 2019-11-29 16:37:38 +02:00
Dagur Valberg Johannsson fe1ff82a7d Remove option mempooltxinputlimit
This option is no longer used after Overwinter. Fixes #4209.
2019-11-19 10:35:39 +01:00
Homu fd8444d0b7 Auto merge of #4178 - oxarbitrage:issue3731, r=str4d
Remove z_mergetoaddress from experimental state

Closes #3731.
2019-11-11 01:57:21 -08:00
Eirik Ogilvie-Wigley 5371e0cffb fix comment 2019-11-01 14:46:15 -06:00
Eirik Ogilvie-Wigley 0950c94c13 Fix getblocksubsidy tests 2019-11-01 12:10:15 -06:00
Sean Bowe 4180589f02
Set mainnet activation of Blossom 2019-11-01 09:31:55 -06:00
Alfredo Garcia cbf1a85013 remove z_mergetoaddress from experimental 2019-10-26 12:52:36 -03:00
Larry Ruane a3eb2b8708 update unit tests to compute empty roots 2019-10-12 18:03:36 -06:00
Jack Grigg fe3cb8ec93
Remove makeGrothProof argument from JoinSplit::prove 2019-09-16 13:10:54 +01:00
Jack Grigg 5f84491d82
Remove libsnark code for pre-Sapling Sprout proofs 2019-08-22 15:42:47 +01:00
Jack Grigg 1b4cf1337c
Use Sapling JSDescriptions in Boost tests 2019-08-22 15:42:42 +01:00
Homu 5fd1f5afc0 Auto merge of #3972 - LarryRuane:3708-getblockhashesrpc, r=str4d
3708 getblockhashesrpc

Part of #3708
2019-08-09 08:00:17 -07:00
Homu 2528af69ff Auto merge of #4025 - bitcartel:shorter_block_target_interval_zip208, r=daira
Implement ZIP 208: Shorter Block Target Spacing

Closes #3690.
2019-08-09 02:35:30 -07:00
Larry Ruane 6e7e50be4d insightexplorer minor bug fixes 2019-08-08 14:45:30 -06:00
Larry Ruane 2e505df351 add timestampindex related RPC getblockhashes 2019-08-08 14:35:07 -06:00
Larry Ruane 86b23f37ad add spentindex RPC for bitcore block explorer 2019-08-07 14:23:42 -06:00
Eirik Ogilvie-Wigley 42a21ef004 Test clean up and fixes 2019-08-05 14:52:34 -06:00
Eirik Ogilvie-Wigley 7ddcf427c0 Fix/update comments 2019-08-05 12:41:31 -06:00
Eirik Ogilvie-Wigley 2972521323 Add comments and fix typos 2019-08-02 21:43:17 -06:00
Eirik Ogilvie-Wigley 797713284c Update main_tests for shorter block times 2019-08-02 19:37:02 -06:00
Homu c68511b876 Auto merge of #3926 - LarryRuane:3708-getaddressrpcs, r=str4d
add addressindex RPC for bitcore block explorer

Addresses #3708
2019-08-01 05:43:29 -07:00
Homu 2300b911f8 Auto merge of #4035 - Eirik0:use-committransaction, r=str4d
Use CommitTransaction

This enables `-walletbroadcast` to correctly control transactions created with `z_*` APIs. It also addresses some TODOs in the code and consolidates some repeated logic.

Closes #4077 (because `CommitTransaction` calls `KeepKey` on the transparent change address).
2019-08-01 03:04:06 -07:00
Eirik Ogilvie-Wigley e358e89db9 PartitionCheck tests for shorter block times 2019-07-31 12:20:15 -06:00
Larry Ruane 68e174e22b add addressindex related RPCs 2019-07-31 10:31:16 -06:00
Jack Grigg 19bd2d0e7c
Use reserve key for transparent change when sending to Sprout 2019-07-31 12:15:09 +01:00
Eirik Ogilvie-Wigley 1188c9adf7 Fix zip208 founders reward calculation and update test 2019-07-30 17:41:33 -06:00
Eirik Ogilvie-Wigley 8865f4b6f6 Update expiry height for shorter block times 2019-07-30 01:16:37 -06:00
Eirik Ogilvie-Wigley 0bb79ea191 pow test cleanup 2019-07-29 19:07:56 -06:00