Commit graph

1174 commits

Author SHA1 Message Date
Byron Hambly
e619febc41 Merge 95b16e70a8 into merged_master (Bitcoin PR bitcoin/bitcoin#23072) 2023-04-23 09:55:51 +00:00
Byron Hambly
f21f92ba69 Merge 8bda5e0988 into merged_master (Bitcoin PR bitcoin/bitcoin#22855) 2023-04-23 09:29:14 +00:00
Byron Hambly
98d921235f Merge 971cad475f into merged_master (Bitcoin PR bitcoin/bitcoin#23044) 2023-04-23 07:40:20 +00:00
Byron Hambly
8d89f4e102 Merge 71bdf0bff1 into merged_master (Bitcoin PR bitcoin/bitcoin#22626) 2023-04-21 12:36:24 +00:00
Byron Hambly
2a48cc4c59 Merge b8336b22d3 into merged_master (Bitcoin PR bitcoin/bitcoin#22675) 2023-04-21 06:41:50 +00:00
James Dorfman
d625266215 Merge da67b75c5c into merged_master (Bitcoin PR bitcoin/bitcoin#22903) 2023-04-21 02:04:22 +00:00
Byron Hambly
162e1f24bd Merge 81f4a3e84d into merged_master (Bitcoin PR bitcoin/bitcoin#22796) 2023-04-11 09:13:05 +00:00
Byron Hambly
cb71563589 Merge 7be143a960 into merged_master (Bitcoin PR bitcoin/bitcoin#22824) 2023-04-11 08:37:41 +00:00
Byron Hambly
8599606ab3 Merge 21438d55d5 into merged_master (Bitcoin PR bitcoin/bitcoin#21800) 2023-04-09 05:08:13 +00:00
James Dorfman
ea7450b099 Merge 4b1fb50def into merged_master (Bitcoin PR bitcoin/bitcoin#22528) 2023-03-31 18:53:21 +00:00
Glenn Willen
4334fce793 Merge 61cefde7a7 into merged_master (Bitcoin PR bitcoin/bitcoin#22006) 2023-03-28 00:12:41 +00:00
Glenn Willen
7050d04a75 Merge 7925f3aba8 into merged_master (Bitcoin PR bitcoin/bitcoin#22383) 2023-03-22 03:54:56 +00:00
James Dorfman
17e6efe7fe Merge 5d83e7d714 into merged_master (Bitcoin PR bitcoin/bitcoin#21090)
We comment out a newly-added assert from the Bitcoin
side, because it's unclear how to replicate it
correctly in Elements.

Co-authored-by: Glenn Willen <gwillen@nerdnet.org>
2023-03-22 01:11:20 +00:00
James Dorfman
44df9bbb73 Merge 951850bebf into merged_master (Bitcoin PR #22371) 2023-03-16 14:23:27 +00:00
Glenn Willen
b9b7f6543a Apply suggestions from code review
Co-authored-by: Byron Hambly <byron@hambly.dev>
2023-01-04 15:32:04 -08:00
Glenn Willen
4f0da3ce3d Trim headers when flushing to disk, and reduce flush interval from 1h to 5min. 2022-12-12 09:46:07 -08:00
Glenn Willen
eff6be337f Trim headers when loading block index from disk. 2022-12-12 09:46:07 -08:00
Glenn Willen
68eb0864cb Refactor CBlockIndex to make proof and dynafed fields optional. 2022-12-12 09:46:04 -08:00
Glenn Willen
3cef73b46c Fix redundant assignment added by bad merge in dea074b88a 2022-06-27 13:36:12 -07:00
Glenn Willen
dea074b88a Merge b707a6f00f into merged_master (Elements PR ElementsProject/elements#1069) 2022-04-20 20:51:37 -07:00
Glenn Willen
04fd3d8dab Fix dropped '&' from merge of #1022
When PR 1022 was merged, an & got dropped from the declarations of the two
"fStall" out-parameters, rendering them unused (and triggering a compiler
warning.) Restore them, restoring the functionality of #1022.
2022-04-20 18:35:06 -07:00
Glenn Willen
cdfb4c9c6c Fix elements multiple-header-download issue.
This fixes an issue which causes Elements to download the blockchain headers
multiple times during initial block download.

In particular: each time we receive an INV P2P message with a new block
(about once a minute), we start downloading the headers, again, in parallel
with any existing download(s) in progress.

With this change, after we receive each batch of headers, we check whether
any of the headers in it were new to us. If not (they were all duplicates),
we stop there, and do not ask the peer for another batch. This reduces the
maximum amount of duplication to about 2x, which is not ideal, but a HUGE
improvement.
2021-11-17 09:06:38 -08:00
merge-script
95b16e70a8
Merge bitcoin/bitcoin#23072: log: Remove unnecessary timing of Callbacks bench
ab27800799 log: Remove unnecessary timing logs for Callbacks bench (Douglas Chimento)

Pull request description:

  Logging of Callbacks are no longer needed and records times that are not relevant for performance analysis.
  resolves #23071

ACKs for top commit:
  laanwj:
    Thanks. re-ACK ab27800799
  jonatack:
    Code review ACK ab27800799

Tree-SHA512: be1ea780c4db9407a8799065a8824b9d3610abac72af5907809ed62d493d5a54e65735de45ec5fdd0edb85ef21ec6036105abe8ca00093942980f6f92e7fec50
2021-09-23 15:07:16 +02:00
Douglas Chimento
ab27800799 log: Remove unnecessary timing logs for Callbacks bench
Logging of Callbacks are no longer needed and records events that are not relevant for performance analysis.
2021-09-23 14:36:16 +03:00
fanquake
8bda5e0988
Merge bitcoin/bitcoin#22855: RBF move 3/3: move followups + improve RBF documentation
0ef08f8bed add missing includes in policy/rbf (glozow)
c6abeb76fb make MAX_BIP125_RBF_SEQUENCE constexpr (glozow)
3cf46f6055 [doc] improve RBF documentation (glozow)
c78eb8651b [policy/refactor] pass in relay fee instead of using global (glozow)

Pull request description:

  Followups to #22675 and documentation-only changes intended to clarify the code/logic concerning mempool Replace-by-Fee.

ACKs for top commit:
  jnewbery:
    utACK 0ef08f8bed
  fanquake:
    ACK 0ef08f8bed

Tree-SHA512: 6797ae758beca0c9673cb00ce85da48e9a4ac5cb5100074ca93e004cdb31d24d91a1a7721b57fc2f619addfeb4950d8caf45fee0f5b7528defbbd121eb4d271f
2021-09-23 16:40:41 +08:00
Andrew Poelstra
6c368ab1a3 Merge a1726c555b into merged_master (Elements PR ElementsProject/elements#1045) 2021-09-21 20:32:03 +00:00
Andrew Poelstra
cf4136b3b0 SIGHASH_RANGEPROOF and asset issuance rangeproofs 2021-09-20 22:10:47 +00:00
MarcoFalke
fa45a1338a
refactor: Remove unused validation includes 2021-09-20 12:16:20 +02:00
Andrew Poelstra
e4c9cc06dc Merge 250c8e59d5 into merged_master (Elements PR ElementsProject/elements#1030) 2021-09-18 03:17:06 +00:00
Andrew Poelstra
086a1c9374 Merge 9f34730d0f into merged_master (Elements PR ElementsProject/elements#996) 2021-09-18 00:51:34 +00:00
W. J. van der Laan
71bdf0bff1
Merge bitcoin/bitcoin#22626: Remove txindex migration code
fa20f815a9 Remove txindex migration code (MarcoFalke)
fae8786033 doc: Fix validation typo (MarcoFalke)
fab89006d6 Add missing includes and forward declarations, remove unused ones (MarcoFalke)

Pull request description:

  No supported version of Bitcoin Core used the legacy txindex, so all relevant nodes can be assumed to have upgraded. Thus, there is no need to keep this code any longer.

  As a temporary courtesy, provide a one-time warning on how to free the disk space used by the legacy txindex.

  Fixes #22615

ACKs for top commit:
  laanwj:
    Code review ACK fa20f815a9
  hebasto:
    ACK fa20f815a9, tested on Linux Mint 20.2 (x86_64).
  Zero-1729:
    crACK fa20f815a9
  theStack:
    Approach ACK fa20f815a9

Tree-SHA512: 68aa32d064d1e3932e6e382816a4b5de417bd7e82861fea1ee50660e8c397f4efeb88ae4ed54a8ad1952c3563eb0b8449d7ccf883c353cc4d4dc7e15c53d78e8
2021-09-16 19:53:28 +02:00
Glenn Willen
d5042b41c8 Finish removing 'recheckpeginblockinterval'; move MainchainRPCCheck
- Finish removing all references to 'recheckpeginblockinterval', including
  documentation and tests.
- Remove periodic calls to MainchainRPCCheck; use it only at startup (and
  refactor accordingly to simplify logic.)
- Move MainchainRPCCheck from validation.h/cpp (public) to an internal
  helper function of init.cpp.
- Comment out definition of 'revalidation queue' type in txdb, to suppress
  "unused variable" warning. (Leave it visible to avoid future reuse.)
2021-09-13 22:10:33 +00:00
Andrew Poelstra
313f73d5b2 When validation is waiting for parent chain daemon, "stall".
Currently, if -validatepegin is given, and block validation can't proceed
because the parent chain is not synced, we mark the block invalid and put
it in a queue to be "revalidated" later. Unfortunately, marking a block
invalid has downstream consequences, in particular causing descendant blocks
to be marked invalid, which are not currently fixed by the queue.

Instead, we'll use a different strategy: if the mainchain daemon isn't
sufficiently synced to validate a block, we will "stall" connecting that
block to the chain, and have ActivateBestChain simply keep the tip at the
previous block until we're ready.

We can still download and validate (partly) blocks past this point while
we're waiting. They will be connected once the parent chain daemon catches
up.
2021-09-13 22:10:09 +00:00
glozow
3cf46f6055 [doc] improve RBF documentation
Document a few non-obvious things and delete no-longer-relevant comments
(e.g. about taking a lock that we're already holding).
No change in behavior.
2021-09-10 10:32:29 +01:00
glozow
c78eb8651b [policy/refactor] pass in relay fee instead of using global 2021-09-10 09:38:01 +01:00
fanquake
b8336b22d3
Merge bitcoin/bitcoin#22675: RBF move 2/3: extract RBF logic into policy/rbf
32748da0f4 whitespace fixups after move and scripted-diff (glozow)
fa47622e8d scripted-diff: rename variables in policy/rbf (glozow)
ac761f0a23 MOVEONLY: fee checks (Rules 3 and 4) to policy/rbf (glozow)
9c2f9f8984 MOVEONLY: check that fees > direct conflicts to policy/rbf (glozow)
3f033f01a6 MOVEONLY: check for disjoint conflicts and ancestors to policy/rbf (glozow)
7b60c02b7d MOVEONLY: BIP125 Rule 2 to policy/rbf (glozow)
f8ad2a57c6 Make GetEntriesForConflicts return std::optional (glozow)

Pull request description:

  This PR does not change behavior. It extracts the BIP125 logic into helper functions (and puts them in the policy/rbf* files). This enables three things - I think each one individually is pretty good:

  - Implementation of package RBF (see #22290). I want it to be as close to BIP125 as possible so that it doesn't become a distinct fee-bumping mechanism. Doing these move-only commits first means the diff is mostly mechanical to review, and I just need to create a function that mirrors the single transaction validation.
  - We will be able to isolate and test our RBF logic alone. Recently, there have been some discussions on discrepancies between our code and BIP125, as well as proposals for improving it. Generally, I think making this code more modular and de-bloating validation.cpp is probably a good idea.
  - Witness Replacement (replacing same-txid-different-wtxid when the witness is significantly smaller and therefore higher feerate) in a BIP125-similar way. Hopefully it can just be implemented with calls to the rbf functions (i.e. `PaysForRBF`) and an edit to the relevant mempool entries.

ACKs for top commit:
  mjdietzx:
    ACK 32748da0f4
  theStack:
    Code-review ACK 32748da0f4 📐
  MarcoFalke:
    review ACK 32748da0f4 🦇

Tree-SHA512: d89985c8b4b42b54861018deb89468e04968c85a3fb1113bbcb2eb2609577bc4fd9bf254593b5bd0e7ab059a0fa8192d1a903b00f77e6f120c7a80488ffcbfc0
2021-09-10 14:44:54 +08:00
MarcoFalke
fa57fa1a2e
Enable clang-tidy bugprone-argument-comment and fix violations 2021-09-07 09:11:10 +02:00
Andrew Poelstra
7d1c77f0a1 Merge 1ba24fe9b3 into merged_master (Elements PR ElementsProject/elements#1002)
This forward-ports the new Taproot sighash but does not fix a couple
22-blocked TODOs related to the MissingDataBehavior enum. Should be fixed
in a followup commit.

One nontrivial change I had to make was feeding the genesis hash to SignTransaction
(the "global" one in script/sign.cpp) so that it could correctly compute
the sighash at signing time.
2021-09-04 22:14:42 +00:00
glozow
ac761f0a23 MOVEONLY: fee checks (Rules 3 and 4) to policy/rbf 2021-09-02 16:23:27 +01:00
glozow
9c2f9f8984 MOVEONLY: check that fees > direct conflicts to policy/rbf 2021-09-02 16:23:27 +01:00
glozow
3f033f01a6 MOVEONLY: check for disjoint conflicts and ancestors to policy/rbf
This checks that a transaction isn't trying to replace something it
supposedly depends on.
2021-09-02 16:23:27 +01:00
glozow
7b60c02b7d MOVEONLY: BIP125 Rule 2 to policy/rbf 2021-09-02 16:23:26 +01:00
glozow
f8ad2a57c6 Make GetEntriesForConflicts return std::optional
Avoids reusing err_string.
2021-09-02 16:23:25 +01: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
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
Steven Roose
0c9197e421
Add logging for dynafed activation and transitions 2021-08-24 16:43:44 +01:00
glozow
f293c68be0 MOVEONLY: getting mempool conflicts to policy/rbf 2021-08-24 15:51:54 +01:00
glozow
8d71796335 [validation] quit RBF logic earlier and separate loops
No behavior change.
While we're looking through the descendants and calculating how many
transactions we might replace, quit early, as soon as we hit 100.
Since we're failing faster, we can also separate the loops - yes, we
loop through more times, but this helps us detangle the different BIP125
rules later.
2021-08-24 15:47:21 +01:00
glozow
badb9b11a6 call SignalsOptInRBF instead of checking all inputs 2021-08-24 15:47:21 +01:00
glozow
e0df41d7d5 [validation] default conflicting fees and size to 0
This should have no effect in practice, since we only ever call
PreChecks once per transaction.
2021-08-24 15:47:21 +01:00