Commit graph

30503 commits

Author SHA1 Message Date
fanquake
a820e79512
Merge bitcoin/bitcoin#22740: [addrman] Move serialization code to cpp
85b15ddc8f [refactor] [addrman] Update constant comments (John Newbery)
af9638a0fb [move-only] Extract constants from addrman .h to .cpp (Amiti Uttarwar)
7dc443a62d [addrman] Change addrman #define constants to be constexprs (Amiti Uttarwar)
a65053f1d4 [addrman] Move CAddrMan::Unserialize to cpp file (John Newbery)
1622543cf4 [addrman] Move CAddrMan::Serialize to cpp file (John Newbery)

Pull request description:

  Moving the serialization code from the header to the cpp helps clarify interfaces vs internals, as well as speed up the compilation of the whole program with a smaller header file.

ACKs for top commit:
  jnewbery:
    Code review ACK 85b15ddc8f
  0xB10C:
    Code review ACK 85b15ddc8
  mzumsande:
    Code Review ACK 85b15ddc8f (+ performed some light testing)

Tree-SHA512: a1aac25155601dd0ffd073b37388d9062c3d82c499821bd7ee883286cbc5dc0c7ae87f127c127778dae290006b98166640dc974d1953f3f34c53a67cf7b21613
2021-09-01 10:51:54 +08:00
Jon Atack
387355bb94
test, refactor: rpc_rawtransaction PEP8 2021-08-31 21:59:51 +02:00
Jon Atack
7d5cec2e49
refactor: separate the rpc_rawtransaction tests into functions 2021-08-31 21:59:38 +02:00
Jon Atack
409779df95
move-only: regroup similar rpc_rawtransaction tests together 2021-08-31 21:57:27 +02:00
Jon Atack
d861040dd2
test: remove no longer needed (ASCII art) comments 2021-08-31 21:55:15 +02:00
Jon Atack
14398b30d6
test: add and harmonize getrawtransaction logging 2021-08-31 21:55:00 +02:00
Jon Atack
85d8869cf8
test: run 2nd getrawtransaction section with/without -txindex
(and make the 'string "Flase"' test clearer as requested by reviewers)
2021-08-31 20:51:26 +02:00
Jon Atack
0097740773
refactor: txid to constant in rpc_rawtransaction to isolate tests 2021-08-31 20:51:23 +02:00
Jon Atack
8c19d1329f
refactor: dedup/reorg createrawtransaction sequence number tests 2021-08-31 20:51:20 +02:00
Jon Atack
7f073594c9
Test src/node/transaction::GetTransaction() without -txindex 2021-08-31 20:51:17 +02:00
MarcoFalke
fa3bd9de99
Remove CBanEntry::SetNull 2021-08-31 18:30:11 +02:00
MarcoFalke
fab53ff1e5
Remove unused SERIALIZE_METHODS for CBanEntry 2021-08-31 18:13:10 +02:00
Carl Dong
96cc6bb04f guix/prelude: Override VERSION with FORCE_VERSION
Previously, if the builder exported $VERSION in their environment (as
past Gitian-building docs told them to), but their HEAD does not
actually point to v$VERSION, their build outputs will differ from those
of other builders.

This is because the contrib/guix/guix-* scripts only ever act on the
current git worktree, and does not try to check out $VERSION if $VERSION
is set in the environment.

Setting $VERSION only makes the scripts pretend like the current
worktree is $VERSION.

This problem was seen in jonatack's attestation for all.SHA256SUMS,
where only his bitcoin-22.0rc3-osx-signed.dmg differed from everyone
else's.

Here is my deduced sequence of events:

1. Aug 27th: He guix-builds 22.0rc3 and uploads his attestations up to
   guix.sigs

2. Aug 30th, sometime after POSIX time 1630310848: he pulls the latest
   changes from master in the same worktree where he guix-built 22.0rc3
   and ends up at 7be143a960

3. Aug 30th, sometime before POSIX time 1630315907: With his worktree
   still on 7be143a960, he guix-codesigns. Normally, this would result
   in outputs going in guix-build-7be143a960e2, but he had
   VERSION=22.0rc3 in his environment, so the guix-* scripts pretended
   like he was building 22.0rc3, and used 22.0rc3's guix-build directory
   to locate un-codesigned outputs and dump codesigned ones.

   However, our SOURCE_DATE_EPOCH defaults to the POSIX time of HEAD
   (7be143a960), which made all timestamps in the resulting codesigned
   DMG 1630310848, 7be143a960e2's POSIX timestamp. This differs from the
   POSIX timestamp of 22.0rc3, which is 1630348517. Note that the
   windows codesigning procedure does not consider SOURCE_DATE_EPOCH.

We resolve this by only allowing VERSION overrides via the FORCE_VERSION
environment variable.
2021-08-31 10:57:04 -04:00
Antoine Poinsot
97cea1a93a
policy: unit test Segwit dust thresholds
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2021-08-31 16:51:38 +02:00
fanquake
81f4a3e84d
Merge bitcoin/bitcoin#22796: RBF move (1/3): extract BIP125 Rule 5 into policy/rbf
f293c68be0 MOVEONLY: getting mempool conflicts to policy/rbf (glozow)
8d71796335 [validation] quit RBF logic earlier and separate loops (glozow)
badb9b11a6 call SignalsOptInRBF instead of checking all inputs (glozow)
e0df41d7d5 [validation] default conflicting fees and size to 0 (glozow)
b001b9f6de MOVEONLY: BIP125 max conflicts limit to policy/rbf.h (glozow)

Pull request description:

  See #22675 for motivation, this is one chunk of it. It extracts some BIP125 logic into policy/rbf:

  - Defines a constant for specifying the maximum number of mempool entries we'd consider replacing by RBF
  - Calls the available `SignalsOptInRBF` function instead of manually iterating through inputs
  - Moves the logic for getting the list of conflicting mempool entries to a helper function
  - Also does a bit of preparation for future moves - moving declarations around, etc
  Also see #22677 for addressing the circular dependency.

ACKs for top commit:
  jnewbery:
    Code review ACK f293c68be0
  theStack:
    Code-review ACK f293c68be0 📔
  ariard:
    ACK f293c68b

Tree-SHA512: a60370994569cfc91d4b2ad5e94542d4855a48927ae8b174880216074e4fa50d4523dd4ee36efdd6edf2bf7adb87a8beff9c3aaaf6dd323b286b287233e63790
2021-08-31 22:34:25 +08:00
fanquake
0f0c5d4e7d
Merge bitcoin/bitcoin#22842: builder-keys: add kristapsk
9d43045b74 builder-keys: add kristapsk (Kristaps Kaupe)

Pull request description:

  https://github.com/bitcoin-core/gitian.sigs/pull/1681#issuecomment-908940489

  This is the key I also use to sign my commits.

  https://keys.openpgp.org/search?q=70A1D47DD44F59DF8B22244333E472FE870C7E5D
  https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/pubkeys/KristapsKaupe.asc

ACKs for top commit:
  laanwj:
    ACK 9d43045b74

Tree-SHA512: 151983313c38356828dccb61097a7ce53d6441ac2aa8df7a150f723479187a402e1c05959524748b6d26ac7617d78de8fd7110ec5ba5f32318ac120c602af13b
2021-08-31 20:54:17 +08:00
fanquake
19aa5afcae
Merge bitcoin/bitcoin#22744: ci: Re-enable verify-commits.py check
fa001602cd ci: Re-enable verify-commits.py check (MarcoFalke)
fa880b10d6 ci: Unconditionally set the global git author name in cirrys.yml (MarcoFalke)

Pull request description:

  Might be useful to detect bugs in the script itself or an accidentally missed signature.

ACKs for top commit:
  josibake:
    ACK fa001602cd
  Zero-1729:
    tACK fa001602cd
  fanquake:
    untested ACK fa001602cd

Tree-SHA512: 8a13a67d325f2477f4088d1034f0d5e4e04937a01ee3c738435fe66394c02b9f33225529952ad331b0ba19b63ca4b2f26911cb5d264890159840cf3e09085969
2021-08-31 20:48:31 +08:00
MarcoFalke
fa0a5fa744
ci: Fuzz with -ftrivial-auto-var-init=pattern 2021-08-31 13:42:28 +02:00
Kristaps Kaupe
9d43045b74
builder-keys: add kristapsk
https://keys.openpgp.org/search?q=70A1D47DD44F59DF8B22244333E472FE870C7E5D
https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/pubkeys/KristapsKaupe.asc
2021-08-31 13:41:32 +03:00
fanquake
76f031b050
build: fix unoptimized libraries in depends
We need to append-to rather than set CXXFLAGS, otherwise we loose -O2 &
-pipe. Currently this results in zeromq being built without optimizations
at all (or whatever the compiler would default too, essentially always -O0).

Bdb is the same, for the CXX portion of its code. C code has been built
with -O2.

Boost has actually been uneffected because it receives -O3 from it's own
build flags.
2021-08-31 11:43:48 +08:00
fanquake
ab9c34237a
release: remove gitian 2021-08-31 09:37:23 +08:00
Pieter Wuille
d2a09c8355 doc: mention bech32m/BIP350 in doc/descriptors.md 2021-08-30 13:45:22 -04:00
Pieter Wuille
56a42f10f4 Stricter BIP32 decoding and test vector 5 2021-08-30 12:02:04 -04:00
MarcoFalke
fa2e9de59f
test: Check that non-signaling BIP125 tx can be replaced via parent 2021-08-30 17:01:46 +02:00
MarcoFalke
7be143a960
Merge bitcoin/bitcoin#22824: refactor: remove RecursiveMutex cs_nBlockSequenceId
0bd882b740 refactor: remove RecursiveMutex cs_nBlockSequenceId (Sebastian Falbesoner)

Pull request description:

  The RecursiveMutex `cs_nBlockSequenceId` is only used at one place in `CChainState::ReceivedBlockTransactions()` to atomically read-and-increment the nBlockSequenceId member:

  83daf47898/src/validation.cpp (L2973-L2976)

  ~~For this simple use-case, we can make the member `std::atomic` instead to achieve the same result (see https://en.cppreference.com/w/cpp/atomic/atomic/operator_arith).~~

  ~~This is related to #19303. As suggested in the issue, I first planned to change the `RecursiveMutex` to `Mutex` (still possible if the change doesn't get Concept ACKs), but using a Mutex for this simple operation seems to be overkill. Note that at the time when this mutex was introduced (PR #3370, commit 75f51f2a63) `std::atomic` were not used in the codebase yet -- according to `git log -S std::atomic` they have first appeared in 2016 (commit 7e908c7b82), probably also because the compilers didn't support them properly earlier.~~

  At this point, the cs_main lock is set, hence we can use a plain int for the member and mark it as guarded by cs_main.

ACKs for top commit:
  Zero-1729:
    ACK 0bd882b
  promag:
    Code review ACK 0bd882b740.
  hebasto:
    ACK 0bd882b740

Tree-SHA512: 435271ac8f877074099ddb31436665b500e555f7cab899e5c8414af299b154d1249996be500e8fdeff64e4639bcaf7386e12510b738ec6f20e415e7e35afaea9
2021-08-30 10:07:31 +02:00
Sebastian Falbesoner
0bd882b740 refactor: remove RecursiveMutex cs_nBlockSequenceId
The RecursiveMutex cs_nBlockSequenceId is only used at one place in
CChainState::ReceivedBlockTransactions() to atomically read-and-increment the
nBlockSequenceId member. At this point, the cs_main lock is set, hence we can
use a plain int for the member and mark it as guarded by cs_main.
2021-08-29 13:31:00 +02:00
fanquake
83daf47898
Merge bitcoin/bitcoin#22820: build, qt: Fix typo in QtInputSupport check
e251726aff build, qt: Fix typo in QtInputSupport check (Hennadii Stepanov)

Pull request description:

  This typo slipped in fecb3723b6 (#21565).

  I apologize for that as a reviewer of #21565.

ACKs for top commit:
  fanquake:
    ACK e251726aff

Tree-SHA512: c14d603ed5a9b7e4b6503bfb93e66b800d5a107f21a8375c6f98465ef937e3e55b9c4fc160407c7e3ee402b495c5820ebb35ec6cb92956c1ee4092415635b915
2021-08-28 17:05:58 +08:00
Andrew Chow
86beee0579 Use waste metric for deciding which selection to use
Instead of always choosing BnB if it finds a solution, always do both
BnB and KnapsackSolver and choose the one which has the least waste.
2021-08-27 12:46:19 -04:00
Andrew Chow
b3df0caf7c tests: Test GetSelectionWaste
Tests for some waste calculation scenarios

add_coin is modified to allow fee and long term fee to be set for an
added CInputCoin.
2021-08-27 12:46:17 -04:00
Andrew Chow
4f5ad43b1e Add waste metric calculation function 2021-08-27 12:46:06 -04:00
Andrew Chow
935b3ddf72 scripted-diff: tests: Use KnapsackSolver directly
When doing the coin selector tests for KnapsackSolver, call it directly
instead of using AttemptSelection and hoping/instructing it uses
KnapsackSolver.

-BEGIN VERIFY SCRIPT-
sed -i 's/testWallet\.AttemptSelection( /KnapsackSolver(/g' src/wallet/test/coinselector_tests.cpp
sed -i 's/testWallet\.AttemptSelection(/KnapsackSolver(/g' src/wallet/test/coinselector_tests.cpp
sed -i 's/, filter_standard, vCoins, setCoinsRet, nValueRet, coin_selection_params)/, KnapsackGroupOutputs(filter_standard), setCoinsRet, nValueRet)/g' src/wallet/test/coinselector_tests.cpp
sed -i 's/, filter_confirmed, vCoins, setCoinsRet, nValueRet, coin_selection_params)/, KnapsackGroupOutputs(filter_confirmed), setCoinsRet, nValueRet)/g' src/wallet/test/coinselector_tests.cpp
sed -i 's/, filter_standard_extra, vCoins, setCoinsRet, nValueRet, coin_selection_params)/, KnapsackGroupOutputs(filter_standard_extra), setCoinsRet, nValueRet)/g' src/wallet/test/coinselector_tests.cpp
sed -i 's/BOOST_CHECK( /BOOST_CHECK(/g' src/wallet/test/coinselector_tests.cpp
-END VERIFY SCRIPT-
2021-08-27 12:46:06 -04:00
Andrew Chow
6a023a6f90 tests: Add KnapsackGroupOutputs helper function
In order to change the KnapsackSolver tests to call KnapsackSolver, we
need KnapsackGroupOutputs to create the OutputGroups filtered with the
filter criteria.
2021-08-27 12:46:06 -04:00
Andrew Chow
d5069fc1aa tests: Use SelectCoinsBnB directly instead of AttemptSelection
Instead of calling AttemptSelection with the hopes/instruction that it
uses BnB, call SelectCoinsBnB directly to test it.
2021-08-27 12:46:06 -04:00
Andrew Chow
54de7b4746 Allow the long term feerate to be configured, default of 10 sat/vb
The long term feerate is really the highest feerate that the user is
comfortable with making consolidatory transactions. This is should thus
be something that can be configured by the user via a new startup option
-consolidatefeerate. The default value is 10 sat/vbyte, chosen
arbitrarily (it seems like a reasonable number).
2021-08-27 12:46:04 -04:00
Hennadii Stepanov
e251726aff
build, qt: Fix typo in QtInputSupport check 2021-08-27 17:50:30 +03:00
John Newbery
724c497562 [fuzz] Add ConsumeAsmap() function 2021-08-27 11:01:45 +01:00
John Newbery
5840476714 [addrman] Make m_asmap private
Add a GetAsmap() getter function that returns a reference to const.
2021-08-27 11:01:43 +01:00
John Newbery
f9002cb5db [net] Rename the copyStats arg from m_asmap to asmap
The m_ prefix indicates that a variable is a data member. Using it as
a parameter name is misleading.

Also update the name of the function from copyStats to CopyStats to
comply with our style guide.
2021-08-27 10:55:44 +01:00
John Newbery
f572f2b204 [addrman] Set m_asmap in CAddrMan initializer list
This allows us to make it const.
2021-08-27 10:55:41 +01:00
MarcoFalke
33707a2a88
Merge bitcoin/bitcoin#22782: Remove unused MaybeSetAddrName
fa9eade142 Remove GetAddrName (MarcoFalke)
fa786570a5 Remove unused RecursiveMutex cs_addrName (MarcoFalke)
fa82f4ea96 Remove unused MaybeSetAddrName (MarcoFalke)

Pull request description:

  .

ACKs for top commit:
  jnewbery:
    Code review ACK fa9eade142
  naumenkogs:
    utACK fa9eade142

Tree-SHA512: 61501a699add59225dc8127b6dfdda450d768c86f958fdf94e9c28309c3705ecfbee4b064d44228b8c1190c19c39272becc7ede8386ac1406699ea2285881c72
2021-08-27 11:46:26 +02:00
W. J. van der Laan
19364c0ddf
Merge bitcoin/bitcoin#20586: Fix Windows build with --enable-werror
b367745cfe ci: Make Cirrus CI Windows build with --enable-werror (Hennadii Stepanov)
c713bb2b24 Fix Windows build with --enable-werror on Ubuntu Focal (Hennadii Stepanov)

Pull request description:

  This PR makes possible to cross-compile Windows build with `--enable-werror --enable-suppress-external-warnings`.
  Some problems are fixed, others are silenced.

  Also `--enable-werror` is enabled for Cirrus CI Windows build (the last one on Cirrus CI without `--enable-werror`).

ACKs for top commit:
  practicalswift:
    cr ACK b367745cfe: patch looks correct
  laanwj:
    Code review ACK b367745cfe
  vasild:
    ACK b367745cfe
  jarolrod:
    ACK b367745cfe

Tree-SHA512: 64f5c99b7dad4c0efce80cd45d7074f275bd8411235dc9e0841287bdab64b812c6f8f9d632c35531d0b8210148531f53aaaac77be7699b29d2d6aaae304dbee0
2021-08-27 08:31:45 +02:00
fanquake
adccbb380b
Merge bitcoin/bitcoin#21862: test: Set regtest.BIP65Height = 111 to speed up tests
faf7e485e9 Set regtest.BIP65Height = 111 to speed up tests (MarcoFalke)

Pull request description:

  No need to waste time by forcing creation of more than 1000 blocks to get the benefits of being able to test BIP 65. Also, reducing the height makes it more likely that (third-party) tests are conforming to BIP 65, which is enforced on mainnet for all new blocks.

ACKs for top commit:
  theStack:
    re-ACK faf7e485e9 📍
  Zero-1729:
    re-ACK faf7e485e9
  kristapsk:
    ACK faf7e485e9

Tree-SHA512: 79a8263e7233838666b9b636b496a8b9eb12398c779f9434677e1d62816732c0a7c7b3e73965be1fb0038d35e05e5a90e665bd74e9610104127dfc4ea38169bf
2021-08-27 07:53:25 +08:00
Hennadii Stepanov
b8d45a3c20
Merge bitcoin-core/gui#384: Add copy IP/Netmask action for banned peer
ab1461d5d3 qt: Add copy IP/Netmask action for banned peer (Shashwat)

Pull request description:

  This PR adds a Copy IP/Netmask context menu action to the Banned Peers Table.

  This feature is helpful if a node using GUI might want to alert its peer about a particular malicious user. So it can copy that user’s IP/Netmask and broadcast it to its peers so they can ban it instantly using the setban command in the console.

  | Master        | PR               |
  | ----------- | ----------- |
  | ![Screenshot_from_2021-07-21_00-01-331](https://user-images.githubusercontent.com/23396902/126377808-bd23bb19-3f47-4f1b-8371-39baa9747bbe.png) | ![Screenshot from 2021-08-20 20-13-28(1)(1)](https://user-images.githubusercontent.com/85434418/130251441-a8d0f816-a2e9-4e63-a22d-94885c5cec98.png) |

ACKs for top commit:
  jarolrod:
    re-ACK ab1461d
  hebasto:
    re-ACK ab1461d5d3, tested on Linux Mint 20.2 (Qt 5.12.8).

Tree-SHA512: a528f089bd4cb5b51fec987550d21c2587459ad80f854b55850bc62c776c21f3fa31052a17e2b0e9e9d0b3468799c8070ed306543730fb7b324f283847151e17
2021-08-26 22:51:46 +03:00
John Newbery
85b15ddc8f [refactor] [addrman] Update constant comments
Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
2021-08-26 11:56:13 -07:00
Amiti Uttarwar
af9638a0fb [move-only] Extract constants from addrman .h to .cpp
Reviewer hint: use `git diff --color-moved=dimmed-zebra
--color-moved-ws=ignore-all-space`

Co-authored-by: John Newbery <john@johnnewbery.com>
2021-08-26 11:56:13 -07:00
Amiti Uttarwar
7dc443a62d [addrman] Change addrman #define constants to be constexprs
Co-authored-by: John Newbery <john@johnnewbery.com>
2021-08-26 11:56:13 -07:00
John Newbery
a65053f1d4 [addrman] Move CAddrMan::Unserialize to cpp file
Reviewer hint: use `git diff --color-moved=dimmed-zebra
--color-moved-ws=ignore-all-space`

Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
2021-08-26 11:53:44 -07:00
John Newbery
1622543cf4 [addrman] Move CAddrMan::Serialize to cpp file
Reviewer hint: use `git diff --color-moved=dimmed-zebra
--color-moved-ws=ignore-all-space`

Co-authored-by: Amiti Uttarwar <amiti@uttarwar.org>
2021-08-26 11:53:34 -07:00
Shashwat
ab1461d5d3 qt: Add copy IP/Netmask action for banned peer
This adds a copy IP/Netmask context menu action for peers in the banned peer table
2021-08-26 23:33:27 +05:30
Hennadii Stepanov
774a4f517c
Merge bitcoin-core/gui#403: refactor: Make paths to update Encryption and HD wallet statuses simpler
b8aa84b1a1 qt, refactor: Replace `if` check with `assert` (Hennadii Stepanov)
fcdc8b0fcb qt, refactor: Drop redundant signalling in WalletView::setWalletModel (Hennadii Stepanov)
37dcf161d3 qt, refactor: Emit WalletView::encryptionStatusChanged signal directly (Hennadii Stepanov)
7d0d4c0490 qt: Add WalletFrame::currentWalletSet signal (Hennadii Stepanov)

Pull request description:

  This PR makes signal-slot paths to reach `setHDStatus` and `setEncryptionStatus` functions shorter and easier to reason about them.

  Required to simplify #398 (see https://github.com/bitcoin-core/gui/pull/398#discussion_r686094883).

  ---

  **Note for reviewers.** Please verify that "Encrypt Wallet..." menu item, and the following icons

  ![DeepinScreenshot_select-area_20210811202120](https://user-images.githubusercontent.com/32963518/129074601-13fa998a-ac47-4ad2-be00-ba400b12c18a.png)

  and updated properly in each and every possible scenario.

ACKs for top commit:
  jarolrod:
    tACK b8aa84b1a1
  Talkless:
    Code review ACK b8aa84b1a1. Did build on Debian Sid with Qt 5.15.2 but no actual testing performed.
  ryanofsky:
    Code review ACK b8aa84b1a1. Only change since last review was rebase

Tree-SHA512: 275737cdba02baff71049df41bc24089e916f96326dd2dea26ec607c7949cb3aae368eeabbe3ad5a0a27651503a1d65536873726de854c5f6af259bcc29727e7
2021-08-26 15:56:18 +03:00