Commit graph

21246 commits

Author SHA1 Message Date
Andrew Chow
6e1ae58298 Check error messages in descriptor tests 2019-08-16 19:34:01 -04:00
Andrew Chow
625534d7b1 Give more errors for specific failure conditions
Some failure conditions implicitly fail by failing some other check.
But the error messages are more helpful if they say explicitly what
actually caused the failure, so add those as failure conditions and
errors.
2019-08-16 19:34:01 -04:00
Andrew Chow
c325f619dd Return an error from descriptor Parse that gives more information about what failed 2019-08-16 19:34:01 -04:00
MeshCollider
7a960ba775
Merge #15986: Add checksum to getdescriptorinfo
26d3fad109 Add unmodified-but-with-checksum to getdescriptorinfo (Pieter Wuille)
104b3a5069 Factor out checksum checking from descriptor parsing (Pieter Wuille)

Pull request description:

ACKs for top commit:
  achow101:
    Code Review ACK 26d3fad109
  meshcollider:
    re-Code Review ACK 26d3fad109
  Sjors:
    ACK 26d3fad109

Tree-SHA512: b7a7f89b64a184927d6f9a0c183a087609983f0c5d5593f78e12db4714e930a4af655db9da4b0c407ea2e24d3b926cef6e1f2a15de502d0d1290a6e046826b99
2019-08-17 09:23:52 +12:00
nicolas.dorier
3b05f0f70f
Reformat p2p_permissions.py 2019-08-17 00:43:37 +09:00
nicolas.dorier
ce7eac3cb0
[Fix] The default whitelistrelay should be true 2019-08-17 00:43:22 +09:00
MarcoFalke
fa0119af22
doc: Refer in rpcbind doc to the manpage 2019-08-16 10:51:59 -04:00
MarcoFalke
b80cdfec9a
Merge #16618: [Fix] Allow connection of a noban banned peer
d117f4541d Add test for setban (nicolas.dorier)
dc7529abf0 [Fix] Allow connection of a noban banned peer (nicolas.dorier)

Pull request description:

  Reported by @MarcoFalke on https://github.com/bitcoin/bitcoin/pull/16248#discussion_r314026195

  The bug would mean that if the peer connecting to you is banned, but whitelisted without specific permissions, it would not be able to connect to the node.

  The solution is just to move the same line below.

ACKs for top commit:
  Sjors:
    Agree inline is more clear. utACK d117f45
  MarcoFalke:
    ACK d117f4541d

Tree-SHA512: 0fed39acb1e8db67bb0bf4c4de3ad034ae776f38d55bd661f1ae0e1a4c6becaf1824ab46ed8279f2f31df3f4b29ff56461d8b167d3e9cece62cfe58b5a912811
2019-08-16 10:17:25 -04:00
Sjors Provoost
20ea9ef6ce
[doc] mention whitelist is inbound, and applies to blocksonly 2019-08-16 15:58:31 +02:00
MarcoFalke
aed15edf17
Merge #16633: travis: Fix test_runner.py timeouts
faba46da07 ci: Set --ansi in test_runner (MarcoFalke)

Pull request description:

  Fixup to:

  *  tests: Use colors and dots in test_runner.py output only if standard output is a terminal #16561

ACKs for top commit:
  practicalswift:
    ACK faba46da07 -- diff looks correct
  fanquake:
    ACK faba46da07 - assuming Travis is all green.

Tree-SHA512: 50bf6ec8e7a2987d77821816289fd87458e63237d419a149e5e04027387d2c4b3c23db58977585fda30fbc4b13686a7def0d9e00096b9a8469dea2916fd30565
2019-08-16 09:28:50 -04:00
MarcoFalke
faba46da07
ci: Set --ansi in test_runner 2019-08-16 08:50:01 -04:00
MarcoFalke
fa21737ba7
ci: Add environment files for all settings 2019-08-16 08:46:37 -04:00
MarcoFalke
21a165325e
Merge #16620: util: Move ResolveErrMsg to util/error
fa27c55b05 util: Move ResolveErrMsg to util/error (MarcoFalke)

Pull request description:

  Pull request https://github.com/bitcoin/bitcoin/pull/16248#discussion_r314035862 duplicated the body of this util function. The whole point of the util function is to be shared, so do that here as a fixup to #16248

ACKs for top commit:
  Sjors:
    utACK fa27c55
  ryanofsky:
    utACK fa27c55b05

Tree-SHA512: e2b25ae05082fe9d0ee94bdc7d51f801bd9f78e8fc2b141e9a313e008dbb8a77653fe876e111c802c676859c6b76c37a673d1f8cfbe7ad25607a5ffcffde19fd
2019-08-16 07:53:23 -04:00
Jon Atack
a6c1fc3cd9
build: echo prop tests status during build
Enable users to see if the prop tests are enabled during the build. This can be particularly helpful as property-based tests are silently auto-enabled by default if librapidcheck is found.

Minor fixes to the docs and help grammar for this option.
2019-08-16 11:51:07 +02:00
Jonas Schnelli
93bacb8cc9
Merge #16612: qt: Remove menu icons
390874c722 qt: Remove menu icons (Wladimir J. van der Laan)

Pull request description:

  Remove the icons from the application menu. Why remove?

  - They are inconsistently applied, some actions had icons, some newer ones don't. Good luck coming up with a sensible icon for everything
  - Menu icons don't seem to have a place in modern UI: for example, GNOME, MacOS have stopped showing these a long time ago (see https://github.com/bitcoin/bitcoin/pull/16584#issuecomment-521195090)
  - Less bikeshedding opportunity about "what should the icon for this be"

  Removed icons:

  ```
  /icons/quit            res/icons/quit.png
  /icons/about           res/icons/about.png
  /icons/about_qt        res/icons/about_qt.png
  /icons/options         res/icons/configure.png
  /icons/key             res/icons/key.png
  /icons/verify          res/icons/verify.png (also .svg)
  /icons/debugwindow     res/icons/debugwindow.png
  /icons/open            res/icons/open.png
  /icons/info            res/icons/info.png
  /icons/filesave        res/icons/filesave.png
  ```
  I checked that these icons are used nowhere else.

  Removed from the menu not removed from the repository, because still referenced by other parts of the code:
  ```
  /icons/lock_closed
  /icons/edit
  /icons/address-book
  /icons/send
  ```

ACKs for top commit:
  practicalswift:
    ACK 390874c722 -- diff looks correct
  l2a5b1:
    ACK 390874c722 - Bitcoin Core has a very simple application menu. As long as the menu items describe their actions clearly and unambiguously then the icons alongside the label are redundant and offer very little value, if anything at all.
  kallewoof:
    ACK 390874c722
  jonasschnelli:
    utACK 390874c722

Tree-SHA512: dd1c52bed3bc6fb9359d5ea1b229a023dafaf813ae640775cbb433b9886bbc11a7d6a4306bac350b26d45fca9b495e4468630f2a32e185570e05f16a3ce45b47
2019-08-16 08:22:54 +02:00
nicolas.dorier
d117f4541d
Add test for setban 2019-08-16 13:40:31 +09:00
fanquake
0d65106dce
Merge #16383: rpcwallet: default include_watchonly to true for watchonly wallets
72eaab073b tests: functional watch-only wallet tests (William Casarin)
72ffbdc579 doc: add release note for include_watchonly default changes (William Casarin)
003a3c73c0 rpcwallet: document include_watchonly default for watchonly wallets (William Casarin)
a50d9e6c0b rpcwallet: default include_watchonly to true for watchonly wallets (William Casarin)

Pull request description:

  Right now it's a bit annoying to deal with watchonly wallets, many rpc commands have an `include_watchonly` argument that needs to be explicitly set.

  Wallets created with `createwallet` can have a `disable_private_keys` parameter, for those wallets we already know that they are watchonly, so there's no reason to have to explicitly ask for it for every command. Instead we check this wallet flag when the `include_watchonly` parameter isn't set.

ACKs for top commit:
  achow101:
    Code review ACK 72eaab073b
  Sjors:
    ACK 72eaab073b
  promag:
    ACK 72eaab073b, code review only, didn't look closely to the test.
  kallewoof:
    ACK 72eaab073b
  fanquake:
    ACK 72eaab073b - I've looked over the changes, they make sense to me. Compiled and ran the tests etc.

Tree-SHA512: d3646b55e97f386594d7efc994f0712f3888475c6a5dc7f131ac9f8c49bf5d4677182b88f42b34152abe1ad101ecadd152b4c20e9d3c1267190db36f77ab8bd7
2019-08-16 11:55:35 +08:00
fanquake
95a5918c90
Merge #16587: doc: Improve versionbits.h documentation
6576a8765f doc: Improve versionbits.h documentation (Antoine Riard)

Pull request description:

  While reviewing burying of BIP 9 deployments, seen that versionbits.h wasn't that much documented. This is an attempt to improve it. It can be useful, given after burying this code isn't going to be used anymore and isn't straightforward at first sight.

ACKs for top commit:
  jnewbery:
    ACK 6576a8765f
  ajtowns:
    ACK 6576a8765f
  fanquake:
    ACK 6576a8765f

Tree-SHA512: 906463e0b22b988f89d77f798bf94d294f70467d29975088b87384764fb5d0dd1350be67562cc264656f61f1eada2cba20f99c0d797d1d7f90203c269e34c714
2019-08-16 10:52:17 +08:00
fanquake
14982b87e9
Merge #16626: doc: Fix spelling error chache -> cache.
f9d40ce7eb Fix spelling error chache -> cache. (Nils Loewen)

Pull request description:

  Fixes a spelling error in `.travis.yml`.

ACKs for top commit:
  fanquake:
    ACK f9d40ce7eb

Tree-SHA512: f38542f4e1225f2670aeb8f663440f843aa5cdd4588313a88bdfb36531c3419112b55775f12368b80ebd3e0fa5b5491ae43b18ccab39b7908f98bc6b6c7ca396
2019-08-16 10:34:27 +08:00
Nils Loewen
f9d40ce7eb
Fix spelling error chache -> cache. 2019-08-15 19:12:40 -07:00
MarcoFalke
1bf2ff2bf8
Merge #16060: Bury bip9 deployments
e78aaf41f4 [docs] Add release notes for burying bip 9 soft fork deployments (John Newbery)
8319e738f9 [tests] Add coverage for the content of getblockchaininfo.softforks (James O'Beirne)
0328dcdcfc [Consensus] Bury segwit deployment (John Newbery)
1c93b9b31c [Consensus] Bury CSV deployment height (John Newbery)
3862e473f0 [rpc] Tidy up reporting of buried and ongoing softforks (John Newbery)

Pull request description:

  This hardcodes CSV and segwit activation heights, similar to the BIP 90 buried deployments for BIPs 34, 65 and 66.

  CSV and segwit have been active for over 18 months. Hardcoding the activation height is a code simplification, makes it easier to understand segwit activation status, and reduces technical debt.

  This was originally attempted by jl2012 in #11398 and again by me in #12360.

ACKs for top commit:
  ajtowns:
    ACK e78aaf41f4 ; checked diff to previous acked commit, checked tests still work
  ariard:
    ACK e78aaf4, check diff, run the tests again and successfully activated csv/segwit heights on mainnet as expected.
  MarcoFalke:
    ACK e78aaf41f4 (still didn't check if the mainnet block heights are correct, but the code looks good now)

Tree-SHA512: 7e951829106e21a81725f7d3e236eddbb59349189740907bb47e33f5dbf95c43753ac1231f47ae7bee85c8c81b2146afcdfdc11deb1503947f23093a9c399912
2019-08-15 16:02:10 -04:00
MarcoFalke
367b023ae4
Merge #16582: test: Rework ci (Use travis only as fallback env)
faeacf3269 ci: Add note that this assumes a fresh git clone (MarcoFalke)
fa6cbdc3c9 ci: Use ./ci/ on non-travis host (MarcoFalke)
fa31bc35eb ci: Remove dependence on travis, use it as fallback env (MarcoFalke)
fa0aac0f43 ci: Add retry (MarcoFalke)
fafe78f6ae ci: Rename .travis/ to ./ci/ (MarcoFalke)

Pull request description:

  This moves the `.travis` folder to `ci` and removes dependence on travis, so that the test script can be run anywhere.

Top commit has no ACKs.

Tree-SHA512: 4d8c82f3eb4e9e047444b0e0f700485e929a3c4d27fc8777a95b8847f23ed507d2701cc92730198b14d1e753cbb558ffac883da558fc2ec72b8a12c4eaec9000
2019-08-15 12:55:57 -04:00
MarcoFalke
85883a9f8e
Merge #16443: refactor: have CCoins* data managed under CChainState
582d2cd747 Cover UTXO set access with lock annotations (James O'Beirne)
5693530685 refactor: have CCoins* data managed under CChainState (James O'Beirne)
fae6ab6aed refactor: pcoinsTip -> CChainState::CoinsTip() (James O'Beirne)

Pull request description:

  This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11):

  Parent PR: #15606
  Issue: #15605
  Specification: https://github.com/jamesob/assumeutxo-docs/tree/2019-04-proposal/proposal

  ---

  This change encapsulates UTXO set data within CChainState instances, removing global data `pcoinsTip` and `pcoinsviewdb`. This is necessary if we want to maintain multiple chainstates with their own rendering of the UTXO set.

  We introduce a class CoinsViews which consolidates the construction of a CCoins* hierarchy.

  This commit could be broken into smaller pieces, but it would require more ephemeral diffs to, e.g., temporarily change CCoinsViewDB's constructor invocations.

ACKs for top commit:
  Sjors:
    reACK 582d2cd747
  MarcoFalke:
    ACK 582d2cd747

Tree-SHA512: ec9d904fe5dca8cd2dc4b7916daa5d8bab30856dd4645987300f905e0a19f9919fce4f9d1ff03eda982943ca73e6e9a746be6cf53b46510de36e8c81a1eafba1
2019-08-15 12:47:15 -04:00
James O'Beirne
582d2cd747 Cover UTXO set access with lock annotations
i.e. any CoinsViews members. Adds a lock acquisition to `gettxoutsetinfo` RPC
to comply with added annotations.

Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
2019-08-15 11:19:40 -04:00
MarcoFalke
faeacf3269
ci: Add note that this assumes a fresh git clone 2019-08-15 11:13:10 -04:00
MarcoFalke
fa6cbdc3c9
ci: Use ./ci/ on non-travis host 2019-08-15 11:13:09 -04:00
MarcoFalke
fa31bc35eb
ci: Remove dependence on travis, use it as fallback env 2019-08-15 11:12:34 -04:00
MarcoFalke
fa0aac0f43
ci: Add retry
From: a1b1826bdb
2019-08-15 11:12:22 -04:00
MarcoFalke
fafe78f6ae
ci: Rename .travis/ to ./ci/ 2019-08-15 11:11:45 -04:00
James O'Beirne
5693530685 refactor: have CCoins* data managed under CChainState
This change encapsulates UTXO set data within CChainState instances, removing
global data `pcoinsTip` and `pcoinsviewdb`. This is necessary if we want to
maintain multiple chainstates with their own rendering of the UTXO set.

We introduce a class CoinsViews which consolidates the construction of a
CCoins* hierarchy. Construction of its various pieces (db, coinscatcher,
in-memory cache) is split up so that we avoid flushing bad state to disk if
startup is interrupted.

We also introduce `CChainState::CanFlushToDisk()` which tells us when it is
safe to flush the chainstate based on this partial construction.

This commit could be broken into smaller pieces, but it would require more
ephemeral diffs to, e.g., temporarily change CCoinsViewDB's constructor
invocations.

Other changes:

- A parameter has been added to the CCoinsViewDB constructor that allows the
  name of the corresponding leveldb directory to be specified.

Thanks to Russell Yanofsky and Marco Falke for helpful feedback.
2019-08-15 11:04:10 -04:00
Antoine Riard
6576a8765f doc: Improve versionbits.h documentation 2019-08-15 11:02:55 -04:00
MarcoFalke
8bd5e0af99
Merge #16465: test: Test p2sh-witness and bech32 in wallet_import_rescan
fa3c6575ca lint: Add false positive to python dead code linter (MarcoFalke)
fa25668e1c test: Test p2sh-witness and bech32 in wallet_import_rescan (MarcoFalke)
fa79af2989 test: Replace fragile "rng" with call to random() (MarcoFalke)
fac3dcf7d0 test: Generate one block for each send in wallet_import_rescan (MarcoFalke)

Pull request description:

  This adds test coverage for segwit in the `wallet_import_rescan` test, among other cleanups.

ACKs for top commit:
  jnewbery:
    ACK fa3c6575ca

Tree-SHA512: 877741763c62c1bf9d868864a1e3f0699857e8c028e9fcd65c7eeb73600c22cbe97b7b51093737743d9e87bcb991c1fe1086f673e18765aef0fcfe27951402f0
2019-08-15 10:28:58 -04:00
MarcoFalke
fa27c55b05
util: Move ResolveErrMsg to util/error 2019-08-15 10:05:32 -04:00
nicolas.dorier
dc7529abf0
[Fix] Allow connection of a noban banned peer 2019-08-15 22:40:32 +09:00
MarcoFalke
fa3c6575ca
lint: Add false positive to python dead code linter 2019-08-15 08:05:14 -04:00
MarcoFalke
e00501e00c
Merge #16561: tests: Use colors and dots in test_runner.py output only if standard output is a terminal
37f2784952 tests: Use colors and dots in test_runner.py output only if standard output is a terminal -- allows for using the test runner output as input to other programs (practicalswift)

Pull request description:

  Use colors and dots in `test_runner.py` output only if standard output is a terminal -- allows for using the test runner output as input to other programs.

  I found the need for this when parsing `test_runner.py` output while investigating intermittent functional test failures.

  Before:

  ```
  $ test/functional/test_runner.py wallet_hd.py > output 2>&1
  $ less output
  Temporary test directory at /tmp/test_runner_₿_🏃_20190807_074115
  ESC[1mWARNING!ESC[0m There is already a bitcoind process running on this system. Tests may fail unexpectedly due to resource contention!
  Remaining jobs: [wallet_hd.py]
  .......................................^M                                       ^M1/1 - ESC[1mwallet_hd.pyESC[0m passed, Duration: 20 s

  ESC[1mTEST         | STATUS    | DURATION

  ESC[0mESC[0;32mwallet_hd.py | ✓ Passed  | 20 s
  ESC[0mESC[1m
  ALL          | ✓ Passed  | 20 s (accumulated)
  ESC[0mRuntime: 20 s
  ```

  After:

  ```
  $ test/functional/test_runner.py wallet_hd.py > output 2>&1
  $ less output
  Temporary test directory at /tmp/test_runner_₿_🏃_20190807_074244
  1/1 - wallet_hd.py passed, Duration: 20 s
  WARNING! There is already a bitcoind process running on this system. Tests may fail unexpectedly due to resource contention!
  Remaining jobs: [wallet_hd.py]

  TEST         | STATUS    | DURATION

  wallet_hd.py | ✓ Passed  | 20 s

  ALL          | ✓ Passed  | 20 s (accumulated)
  Runtime: 20 s
  ```

ACKs for top commit:
  laanwj:
    ACK 37f2784952

Tree-SHA512: f15d95f9e07de2954c326d63d7a4bcd2971faeaa00386600dec2fb915ec89475aeef1dbc968b2c12aa5e988d4b3ed1974d6da0b6a3f1e1a105cfd90e8cb97cf6
2019-08-15 07:43:01 -04:00
Wladimir J. van der Laan
390874c722 qt: Remove menu icons 2019-08-15 13:05:10 +02:00
practicalswift
37f2784952 tests: Use colors and dots in test_runner.py output only if standard output is a terminal -- allows for using the test runner output as input to other programs 2019-08-15 09:52:28 +00:00
fanquake
8fc7f0cba9
Merge #16578: Do not pass in command line arguments to QApplication
a2714a5c69 Give QApplication dummy arguments (Andrew Chow)

Pull request description:

  QApplication takes the command line arguments and parses them itself for some [built in command line arguments](https://doc.qt.io/qt-5/qapplication.html#QApplication) that it has. We don't want any of those built in arguments, so instead give it dummy arguments.

  To test, you can use the `-reverse` option. Without this patch, everything will appear right-to-left; things that were on the left side will be on the right and everything is right aligned.

  After this patch, `-reverse` will now give a startup error since we do not support this argument.

ACKs for top commit:
  laanwj:
    ACK a2714a5c69
  hebasto:
    ACK a2714a5c69
  fanquake:
    ACK a2714a5c69 - Have tested that arguments like `-reverse` are no longer being passed through and result in an error.

Tree-SHA512: 983bd948ca6999f895b6662b58c37e33af7ed61fdd600c6b4623febb87ec06a92c66e3b3300783530110cc711902793ef82d751d7f563696c4c3a8416b2b1f51
2019-08-15 15:19:35 +08:00
fanquake
8516285d2e
Merge #16615: doc: Fix typos in COPYRIGHT
36f7697cf6 doc: Fix typos in COPYRIGHT (Chuf)

Pull request description:

  Fixed a couple of typos

ACKs for top commit:
  promag:
    ACK 36f7697cf6, correct name is already here:
  fanquake:
    ACK 36f7697cf6

Tree-SHA512: 9da498403667f6200669abc0a7fc110e6d2205b577743d412e18d7718016707181ca65f6660dda085c252808b77b1573dfab246ca9c3adfbe97f790d5bee9615
2019-08-15 08:23:59 +08:00
MarcoFalke
fa25668e1c
test: Test p2sh-witness and bech32 in wallet_import_rescan 2019-08-14 17:20:07 -04:00
MarcoFalke
fa79af2989
test: Replace fragile "rng" with call to random() 2019-08-14 17:19:48 -04:00
MarcoFalke
fac3dcf7d0
test: Generate one block for each send in wallet_import_rescan
This ...
* ensures that enough coins are available/spendable, even when more
  variants are added
* ensures that all mempool txs are mined, even when more variants are
  added
* makes the test more specific to test that the confirmation height
  is properly reported and timestamps are correctly handled in the test
  logic
* prepares the test for a future, where blocks are skipped for rescan if
  they are deemed irrelevant by a filter (c.f. BIP157)
2019-08-14 16:22:37 -04:00
Jonas Schnelli
f418c3379c
Merge #16435: autoconf: Sane --enable-debug defaults.
d6ac25bdd9 autoconf: Sane --enable-debug defaults. (Carl Dong)

Pull request description:

  ```
  Don't optimize even if variables adhere to as-if rule. This is a
  somewhat sane default for debugging.
  ```

  -----

  Fixes: #14830

  This is more of a "do something dumb and have people correct you" kind of PR. The end goal is to have a configure flag that will allow for debugging without annoying "optimized out" messages, for developer experiences' sake. This is the minimal diff, but people have suggested `--enable-debug-slow` in the past.

ACKs for top commit:
  jonasschnelli:
    Tested ACK d6ac25bdd9

Tree-SHA512: 7a5576ad1d33850aff1445ccb71b133f654b455da2d1daed2ed1b82ea773965790a62895aeeab74b23a25513ab96dddb670f9dbc593dd0b8c030694206a99ccf
2019-08-14 22:07:06 +02:00
John Newbery
e78aaf41f4 [docs] Add release notes for burying bip 9 soft fork deployments 2019-08-14 15:52:52 -04:00
James O'Beirne
8319e738f9 [tests] Add coverage for the content of getblockchaininfo.softforks 2019-08-14 15:52:52 -04:00
John Newbery
0328dcdcfc [Consensus] Bury segwit deployment
Hardcode segwit deployment height to 481824 for mainnet.
2019-08-14 15:52:52 -04:00
John Newbery
1c93b9b31c [Consensus] Bury CSV deployment height
Hard code CSV deployment height to 419328 for mainnet.
2019-08-14 15:52:52 -04:00
Chuf
36f7697cf6
doc: Fix typos in COPYRIGHT
Fixed a couple of typos
2019-08-14 17:28:26 +00:00
Wladimir J. van der Laan
67be6d7a17
Merge #16248: Make whitebind/whitelist permissions more flexible
c5b404e8f1 Add functional tests for flexible whitebind/list (nicolas.dorier)
d541fa3918 Replace the use of fWhitelisted by permission checks (nicolas.dorier)
ecd5cf7ea4 Do not disconnect peer for asking mempool if it has NO_BAN permission (nicolas.dorier)
e5b26deaaa Make whitebind/whitelist permissions more flexible (nicolas.dorier)

Pull request description:

  # Motivation

  In 0.19, bloom filter will be disabled by default. I tried to make [a PR](https://github.com/bitcoin/bitcoin/pull/16176) to enable bloom filter for whitelisted peers regardless of `-peerbloomfilters`.

  Bloom filter have non existent privacy and server can omit filter's matches. However, both problems are completely irrelevant when you connect to your own node. If you connect to your own node, bloom filters are the most bandwidth efficient way to synchronize your light client without the need of some middleware like Electrum.

  It is also a superior alternative to BIP157 as it does not require to maintain an additional index and it would work well on pruned nodes.

  When I attempted to allow bloom filters for whitelisted peer, my proposal has been NACKed in favor of [a more flexible approach](https://github.com/bitcoin/bitcoin/pull/16176#issuecomment-500762907) which should allow node operator to set fine grained permissions instead of a global `whitelisted` attribute.

  Doing so will also make follow up idea very easy to implement in a backward compatible way.

  # Implementation details

  The PR propose a new format for `--white{list,bind}`. I added a way to specify permissions granted to inbound connection matching `white{list,bind}`.

  The following permissions exists:
  * ForceRelay
  * Relay
  * NoBan
  * BloomFilter
  * Mempool

  Example:
  * `-whitelist=bloomfilter@127.0.0.1/32`.
  * `-whitebind=bloomfilter,relay,noban@127.0.0.1:10020`.

  If no permissions are specified, `NoBan | Mempool` is assumed. (making this PR backward compatible)

  When we receive an inbound connection, we calculate the effective permissions for this peer by fetching the permissions granted from `whitelist`  and add to it the permissions granted from `whitebind`.

  To keep backward compatibility, if no permissions are specified in `white{list,bind}` (e.g. `--whitelist=127.0.0.1`) then parameters `-whitelistforcerelay` and `-whiterelay` will add the permissions `ForceRelay` and `Relay` to the inbound node.

  `-whitelistforcerelay` and `-whiterelay` are ignored if the permissions flags are explicitly set in `white{bind,list}`.

  # Follow up idea

  Based on this PR, other changes become quite easy to code in a trivially review-able, backward compatible way:

  * Changing `connect` at rpc and config file level to understand the permissions flags.
  * Changing the permissions of a peer at RPC level.

ACKs for top commit:
  laanwj:
    re-ACK c5b404e8f1

Tree-SHA512: adfefb373d09e68cae401247c8fc64034e305694cdef104bdcdacb9f1704277bd53b18f52a2427a5cffdbc77bda410d221aed252bc2ece698ffbb9cf1b830577
2019-08-14 17:07:12 +02:00