Commit Graph

14719 Commits

Author SHA1 Message Date
Pieter Wuille 918a7ddc01 Add extra message to avoid a long 'Loading banlist' 2021-02-16 18:02:25 +00:00
Cory Fields 2e8cdc8687 net: No need to export DumpBanlist 2021-02-16 18:02:25 +00:00
Cory Fields 0349f30828 net: make Ban/Unban/ClearBan functionality consistent
- Ban/Unban/ClearBan call uiInterface.BannedListChanged() as necessary
- Ban/Unban/ClearBan sync to disk if the operation is user-invoked
- Mark node for disconnection automatically when banning
- Lock cs_vNodes while setting disconnected
- Don't spin in a tight loop while setting disconnected
2021-02-16 18:02:25 +00:00
Kaz Wesley 8586da99fe fix race that could fail to persist a ban
DumpBanList currently does this:
  - with lock: take a copy of the banmap
  - perform I/O (write out the banmap)
  - with lock: mark the banmap non-dirty
If a new ban is added during the I/O operation, it may never be persisted to
disk.

Reorder operations so that the data to be persisted cannot be older than the
time at which the banmap was marked non-dirty.
2021-02-16 18:02:25 +00: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
kirkalx 92b93a87c8 peers.dat, banlist.dat recreated when missing 2021-02-16 18:02:25 +00:00
Philip Kaufmann d729f55bea banlist (bugfix): allow CNode::SweepBanned() to run on interval
- allows CNode::SweepBanned() to run, even if !CNode::BannedSetIsDirty(),
  because if nBanUntil is over we want the ban to be disabled for these
  nodes
2021-02-16 18:02:25 +00:00
Philip Kaufmann bbbf4dd3a8 banlist: add more banlist infos to log / add GUI signal
- to match the peers.dat handling also supply a debug.log entry for how
  many entries were loaded from banlist.dat and how long it took
- add a GUI init message for loading the banlist (same as with peers.dat)

- move the same message for peers.dat upwards in the code, to be able to
  reuse the timing variable nStart and also just log, if our read from
  peers.dat didn't fail
2021-02-16 18:02:25 +00:00
Philip Kaufmann 0205c70e0d banlist: better handling of banlist in StartNode()
- only start working on/with banlist data, if reading in the banlist from
  disk didn't fail
- as CNode::setBannedIsDirty is false (default) when reading fails, we
  don't need to explicitly set it to false to prevent writing
  banlist.dat in that case either
2021-02-16 18:02:25 +00:00
Philip Kaufmann e49ad06dd5 banlist: update set dirty to be more fine grained
- move the SetBannedSetDirty(false) call from DumpData() into DumpBanlist()
- ensure we only set false, if the write succeeded
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 f3466977d8 [Qt] banlist, UI optimizing and better signal handling
Zcash: non-QT parts only (whitespace)
2021-02-16 18:02:25 +00:00
Jonas Schnelli 3909d0b455 [Qt] add ui signal for banlist changes
Zcash: non-QT part only (the signal itself)
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
Jonas Schnelli edef9aa895 use CBanEntry as object container for banned nodes
- added a reason enum for a ban
- added creation time for a ban

Using CBanEntry as container will keep banlist.dat extenable.
2021-02-16 18:02:24 +00:00
Jonas Schnelli 046740585e CAddrDB/CBanDB: change filesize variables from int to uint64_t 2021-02-16 18:02:24 +00:00
Jonas Schnelli fa9fcfea60 banlist.dat: store banlist on disk 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 cfc4ca1817 Use SipHash-2-4 for address relay selection
Zcash: conflicts resolved against 957e5d216f
2021-02-11 11:10:42 -07:00
Pieter Wuille 407532d840 Switch CTxMempool::mapTx to use a hash index for txids 2021-02-11 11:10:42 -07:00
Pieter Wuille ec4196d8cf Use SipHash-2-4 for CCoinsCache index
This is ~1.7x slower than the Lookup3-of-Xor-with-salt construct we were
using before, but it is a primitive designed for exactly this.

Zcash: Propagate CCoinsKeyHasher -> SaltedTxidHasher changes to where
we've used CCoinsKeyHasher outside of its original scope.
2021-02-11 11:10:42 -07:00
Pieter Wuille f3b2cdb32b Add SipHash-2-4 primitives to hash 2021-02-11 11:10:42 -07:00
Homu a960e896dd Auto merge of #4966 - str4d:zcash-script-lib, r=nuttycom
Replace libzcashconsensus with libzcash_script

We inherited `libzcashconsensus` from upstream (we just renamed it before launch to avoid conflicts). However, it has become increasingly inaccurately named; it only covers (Zcash's subset of) the Bitcoin scripting system, and not the myriad of other consensus changes (in particular, the shielded pools).

This PR reworks the library to instead be focused on transparent script verification:
- The script verification APIs are altered to take `amount` and `consensusBranchId` fields.
- Equihash code is removed (the canonical Equihash validator is now the `equihash` Rust crate).
- The library is renamed to `libzcash_script`.

The API changes are backwards-incompatible, but the library rename prevents any issues. Also, `libzcashconsensus` was in fact broken and not compiling for several years and no one complained, suggesting that it was not actually being relied on within the ecosystem. By contrast, this focused library already has a consumer: the `zebrad` full node.

Closes zcash/zcash#4879.
2021-01-28 19:34:09 +00:00
Homu 090e284f57 Auto merge of #4964 - str4d:univalue-update, r=nuttycom
Update UniValue subtree

This brings us up-to-date with upstream Bitcoin's version of the library.

Includes a commit cherry-picked from bitcoin/bitcoin#12193.
2021-01-28 18:06:37 +00:00
Homu cc5574b819 Auto merge of #4963 - defuse:fix-updatecheck-token, r=nuttycom
Move the github API token out of updatecheck.py into an untracked file.
2021-01-28 16:38:34 +00:00
Homu b9504dbb3f Auto merge of #4967 - LarryRuane:upstream-lockfixes, r=nuttycom
cherry-pick upstream locking fixes

Cherry-pick https://github.com/bitcoin/bitcoin/pull/9225
2021-01-28 14:13:34 +00:00
Homu dc94d76053 Auto merge of #4968 - str4d:design-book, r=str4d
Set up an mdbook in which we can document zcashd's architecture design

I've explained various parts of zcashd's node architecture enough times
now that it really should be written down!
2021-01-28 03:31:06 +00:00
Jack Grigg fecde3de1f Link to zips.z.cash for protocol spec 2021-01-27 17:46:03 +00:00
Jack Grigg aec304d7a0 Show README as root of zcashd book 2021-01-27 17:45:45 +00:00
Jack Grigg 9cee5686bb Actions: Add a workflow to deploy the zcashd book 2021-01-27 17:20:30 +00:00
Jack Grigg 8cfbabd6ed Set up an mdbook in which we can document zcashd's architecture design
I've explained various parts of zcashd's node architecture enough times
now that it really should be written down!
2021-01-27 17:16:34 +00:00
Matt Corallo 8982265456 Fix unlocked access to vNodes.size() 2021-01-26 11:39:45 -07:00
Matt Corallo 6da9ecda03 Remove double brackets in addrman 2021-01-26 10:48:18 -07:00
Matt Corallo 5123af41d6 Fix AddrMan locking 2021-01-26 10:40:50 -07:00
Matt Corallo e78376b4fe Make fImporting an std::atomic 2021-01-26 10:39:37 -07:00
Matt Corallo e286250ce4 Make fDisconnect an std::atomic 2021-01-26 10:23:32 -07: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 2e4edc507d Remove crypto/equihash from libzcashconsensus
This library (in the version we inherited from Bitcoin Core 0.11.2) is
entirely focused on transparent script verification; a full Equihash
solver is out of scope. Now that Heartwood has activated, the canonical
Equihash validator is the Rust implementation in the equihash crate.
2021-01-25 22:20:25 +00:00
Taylor Hornby 92da71b0fe Document the required .updatecheck-token file in the release docs 2021-01-25 13:48:02 -07:00
Homu ce5d8daae6 Auto merge of #4961 - str4d:leveldb-1.22-prep, r=str4d
Prepare for LevelDB 1.22 update

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#7944
- bitcoin/bitcoin#8604
  - Only the first commit (we removed the upstream build documentation).
- bitcoin/bitcoin#12294
  - Only the third commit.
- bitcoin/bitcoin#13659
- bitcoin/bitcoin#16110
2021-01-25 20:11:31 +00:00
Karel Bilek 82b40d080e scripted-diff: Use UniValue.pushKV instead of push_back(Pair())
-BEGIN VERIFY SCRIPT-
git grep -l "push_back(Pair" | xargs sed -i "s/push_back(Pair(\(.*\)));/pushKV(\1);/g"
-END VERIFY SCRIPT-
2021-01-25 19:50:54 +00:00
Jack Grigg 36e86d3c69 Merge commit '9e26ae1c78fe62e23dcca7b22e1cd1a42b45dd25' into univalue-update 2021-01-25 19:50:54 +00:00
Homu 7580890dc1 Auto merge of #4959 - str4d:dependency-updates, r=str4d
Dependency updates

Boost is reverted to 1.74 to mitigate #4945 until a fix is found.
2021-01-25 19:20:45 +00:00
Taylor Hornby 45392c2215 Move the github API token out of updatecheck.py into an untracked file. 2021-01-25 10:06:43 -07:00
Jack Grigg 9e26ae1c78 Squashed 'src/univalue/' changes from 9ef5b78c1..98fadc090
98fadc090 Merge #24: Push bool into array correctly
5f03f1f39 Push bool into array correctly
98261b1e7 Merge #22: Clamp JSON object depth to PHP limit
54c401541 Clamp JSON object depth to PHP limit
5a58a4667 Merge #21: Remove hand-coded UniValue destructor.
b4cdfc4f4 Remove hand-coded UniValue destructor.
7fba60b5a Merge #17: [docs] Update readme
4577454e7 Merge #13: Fix typo
ac7e73cda [docs] Update readme
7890db99d Merge #11: Remove deprecated std pair wrappers
40e34852a Merge #14: Cleaned up namespace imports to reduce symbol collisions
4a4964729 Fix typo
85052a481 Remove deprecated std::pair wrappers
51d3ab34b Merge #10: Add pushKV(key, boolean) function (replaces #5)
129bad96d [tests] test pushKV for boolean values
b3c44c947 Pushing boolean value to univalue correctly
07947ff2d Merge #9: [tests] Fix BOOST_CHECK_THROW macro
ec849d9a2 [tests] Fix BOOST_CHECK_THROW macro
d208f986d Cleaned up namespace imports to reduce symbol collisions
31bc9f5a4 Merge #8: Remove unused Homebrew workaround
fa042093d Remove HomeBrew workaround
a523e08ae Merge #7: Declare single-argument (non-converting) constructors "explicit"
a9e53b38b Merge #4: Pull upstream
fe805ea74 Declare single-argument (non-converting) constructors "explicit"
8a2d6f1e3 Merge pull request #41 from jgarzik/get-obj-map
ba341a20d Add getObjMap() helper method.  Also, constify checkObject().
ceb119413 Handle .pushKV() and .checkObject() edge cases.
107db9829 Add ::push_back(double) method for feature parity.
d41530031 Move one-line implementation of UniValue::read() to header.
52e85b35b Move exception-throwing get_* methods into separate implementation module.
dac529675 README.md: update code quotes
3e31dcffb README.md: close code quote
d09b8429d Update README.md
f1b86edb4 Convert README to markdown style.
1dfe464ef Import UniValue class unit tests from bitcoin project.
0d3e74dd1 operator[] takes size_t index parameter (versus unsigned int)
640158fa2 Private findKey() method becomes size_t clean, and returns bool on failure.
709913585 Merge pull request #36 from ryanofsky/pr/end-str
4fd5444d1 Reject unterminated strings
16a1f7f6e Merge #3: Pull upstream
daf1285af Merge pull request #2 from jgarzik/master
f32df99e9 Merge branch '2016_04_unicode' into bitcoin
280b191cb Merge remote-tracking branch 'jgarzik/master' into bitcoin
2740c4f71 Merge branch '2015_11_escape_plan' into bitcoin
REVERT: 9ef5b78c1 Use size_t for UniValue array indexing

git-subtree-dir: src/univalue
git-subtree-split: 98fadc090984fa7e070b6c41ccb514f69a371c85
2021-01-25 16:57:06 +00:00