Commit graph

1218 commits

Author SHA1 Message Date
Byron Hambly
b0ba2f97e2 Merge e70fb87a4f into merged_master (Bitcoin PR bitcoin/bitcoin#23381) 2023-05-18 09:30:53 +00:00
James Dorfman
df8f97d63b Merge 1847ce2d49 into merged_master (Bitcoin PR bitcoin/bitcoin#23157) 2023-05-16 09:04:56 +00:00
Byron Hambly
7925c2a451 Merge 224e90d9fd into merged_master (Bitcoin PR bitcoin/bitcoin#23336) 2023-05-15 12:27:08 +00:00
Byron Hambly
8299bec8a2 Merge c001da306b into merged_master (Bitcoin PR bitcoin/bitcoin#23325) 2023-05-14 10:52:15 +00:00
James Dorfman
664122467c Merge 0ccf9b2e55 into merged_master (Bitcoin PR bitcoin/bitcoin#23258) 2023-05-14 00:57:27 +00:00
Byron Hambly
4d11268e6a Merge 4b24f6bbb5 into merged_master (Bitcoin PR bitcoin/bitcoin#23302) 2023-05-12 10:40:11 +00:00
Byron Hambly
a4b97d5a9b Merge ec4e43c21c into merged_master (Bitcoin PR #23235) 2023-05-11 10:44:10 +00:00
Byron Hambly
94fc4e9706 Merge 6f0cbc75be into merged_master (Bitcoin PR bitcoin/bitcoin#22539) 2023-05-10 11:14:12 +00:00
Byron Hambly
498907a233 Merge 816e15ee81 into merged_master (Bitcoin PR bitcoin/bitcoin#22951) 2023-05-09 11:50:39 +00:00
Byron Hambly
eea9829aa6 Merge 825f4a64e6 into merged_master (Bitcoin PR bitcoin/bitcoin#22976) 2023-04-24 11:40:49 +00:00
Byron Hambly
14a2c59839 Merge 632be5514c into merged_master (Bitcoin PR bitcoin/bitcoin#23061) 2023-04-24 10:40:48 +00:00
Byron Hambly
070c52dcef Merge b7e3600815 into merged_master (Bitcoin PR bitcoin/bitcoin#21526) 2023-04-23 10:59:59 +00:00
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
glozow
c9b1439ca9 MOVEONLY: mempool checks to their own functions
No change in behavior, because package transactions would not be going
through the rbf logic in PreChecks anyway (BIP125 is currently disabled
for package acceptance, see ATMPArgs).

We draw the line here because each individual transaction in package
validation still goes through all PreChecks. For example, checking that
one's own conflicts and dependencies are disjoint (a consensus check)
and individual transaction mempool ancestor/descendant limits.
2021-11-04 14:55:12 -04:00
glozow
9e910d8152 scripted-diff: clean up MemPoolAccept aliases
The aliases are leftover from a previous MOVEONLY refactor - they are
unnecessary and removing them reduces the diff for splitting out mempool
Checks from PreChecks, making RBF variables MemPoolAccept-wide, etc.

-BEGIN VERIFY SCRIPT-

unalias() { sed -i "s:\<$1\>:$2:g" src/validation.cpp; sed -i "/$2 = $2/d" src/validation.cpp; }

unalias nModifiedFees 		  ws.m_modified_fees
unalias nConflictingFees      	  ws.m_conflicting_fees
unalias nConflictingSize          ws.m_conflicting_size
unalias setConflicts 	          ws.m_conflicts
unalias allConflicting		  ws.m_all_conflicting
unalias setAncestors	          ws.m_ancestors

-END VERIFY SCRIPT-
2021-11-04 14:54:03 -04:00
glozow
fd92b0c398 document workspace members 2021-11-04 12:38:13 -04:00
glozow
3d3e4598b6 [validation] cache iterators to mempool conflicts 2021-11-04 12:38:11 -04:00
glozow
36a8441912 [validation/rpc] cache + use vsize calculated in PreChecks
This is not only cleaner but also helps make sure we are always using
the virtual size measure that includes the sigop weight heuristic (which
is the vsize the mempool would return).
2021-10-28 15:58:54 +01:00
glozow
8fa2936b34 [validation] re-introduce bool for whether a transaction is RBF
This bool was originally part of Workspace and was removed in #22539
when it was no longer needed in Finalize(). Re-introducing it because,
once again, multiple functions will need to know whether we're doing an
RBF. Member of MemPoolAccept so that we can use this to inform package
RBF in the future.
2021-10-28 15:58:54 +01:00
glozow
cbb3598b5c [validation/refactor] store precomputed txdata in workspace
We want to be able to re-use the precomputed transaction data between
PolicyScriptChecks and ConsensusScriptChecks in
AcceptMultipleTransactions.
2021-10-28 15:58:53 +01:00
glozow
0a79eaba72 [validation] case-based constructors for ATMPArgs
No change in behavior.
ATMPArgs can continue to have granular rules like switching BIP125
on/off while we create an interface for the different sets of rules for
single transactions vs multiple-testmempoolaccept vs package validation.
This is a cleaner interface than manually constructing the args, which
makes it easy to mix up ordering, use the wrong default, etc. It also
means we don't need to edit ATMP/single transaction validation code
every time we update ATMPArgs for package validation.
2021-10-28 15:57:26 +01:00
MarcoFalke
1847ce2d49
Merge bitcoin/bitcoin#23157: txmempool -/-> validation 1/2: improve performance of check() and remove dependency on validation
082c5bf099 [refactor] pass coinsview and height to check() (glozow)
ed6115f1ea [mempool] simplify some check() logic (glozow)
9e8d7ad5d9 [validation/mempool] use Spend/AddCoin instead of UpdateCoins (glozow)
09d18916af MOVEONLY: remove single-use helper func CheckInputsAndUpdateCoins (glozow)
e8639ec26a [mempool] remove now-unnecessary code (glozow)
54c6f3c1da [mempool] speed up check() by using coins cache and iterating in topo order (glozow)
30e240f65e [bench] Benchmark CTxMemPool::check() (glozow)
cb1407196f [refactor/bench] make mempool_stress bench reusable and parameterizable (glozow)

Pull request description:

  Remove the txmempool <-> validation circular dependency by removing txmempool's dependency on validation. There are two functions in txmempool that need validation right now: `check()` and `removeForReorg()`. This PR removes the dependencies in `check()`.

  This PR also improves the performance of `CTxMemPool::check()` by walking through the entries exactly once, in ascending ancestorcount order, which guarantees that we see parents before children.

ACKs for top commit:
  jnewbery:
    reACK 082c5bf099
  GeneFerneau:
    tACK [082c5bf](https://github.com/bitcoin/bitcoin/pull/23157/commits/082c5bf099c64e3d27abe9b68a71ce500b693e7e)
  rajarshimaitra:
    tACK https://github.com/bitcoin/bitcoin/pull/23157/commits/082c5bf099c64e3d27abe9b68a71ce500b693e7e
  theStack:
    Code-review ACK 082c5bf099

Tree-SHA512: 40ac622af1627b5c3e6abb4f0f035d833265a8c5e8dc88faf5354875dfb5137f137825e54bbd2a2668ed37b145c5d02285f776402629f58596e51853a9a79d29
2021-10-25 15:21:27 +02:00
MarcoFalke
fa4ec1c0bd
Make GenTxid boolean constructor private 2021-10-22 12:32:16 +02:00
glozow
4307849256 [mempool] delete exists(uint256) function
Allowing callers to pass in a uint256 (which could be txid or wtxid)
but then always assuming that it's a txid is a footgunny interface.
2021-10-21 16:26:59 +01:00
fanquake
0ccf9b2e55
Merge bitcoin/bitcoin#23258: doc: Fix outdated comments referring to ::ChainActive()
a0efe529e4 Fix outdated comments referring to ::ChainActive() (Samuel Dobson)

Pull request description:

  After #21866 there are a few outdated comments referring to `::ChainActive()`, which should instead refer to `ChainstateManager::ActiveChain()`.

ACKs for top commit:
  jamesob:
    ACK https://github.com/bitcoin/bitcoin/pull/23258/commits/a0efe529e4fd053b890450413b9ca5e1bcd8f2c2

Tree-SHA512: 80da19c105ed29ac247e6df4c8e916c3bf3f37230b63f07302114eef9c115add673e9649f0bbe237295be0c6da7b1030b5b93e14daf6768f17ce5de7cf2c9ff2
2021-10-20 13:28:28 +08:00
0xb10c
53c9fa9e62
tracing: drop block_connected hash.toString() arg
The tracepoint `validation:block_connected` was introduced in #22006.
The first argument was the hash of the connected block as a pointer
to a C-like String. The last argument passed the hash of the
connected block as a pointer to 32 bytes. The hash was only passed as
string to allow `bpftrace` scripts to print the hash. It was
(incorrectly) assumed that `bpftrace` cannot hex-format and print the
block hash given only the hash as bytes.

The block hash can be printed in `bpftrace` by calling
`printf("%02x")` for each byte of the hash in an `unroll () {...}`.
By starting from the last byte of the hash, it can be printed in
big-endian (the block-explorer format).

```C
  $p = $hash + 31;
  unroll(32) {
      $b = *(uint8*)$p;
      printf("%02x", $b);
      $p -= 1;
  }
```

See also: https://github.com/bitcoin/bitcoin/pull/22902#discussion_r705176691

This is a breaking change to the block_connected tracepoint API, however
this tracepoint has not yet been included in a release.
2021-10-18 14:35:25 +02:00
Samuel Dobson
a0efe529e4 Fix outdated comments referring to ::ChainActive() 2021-10-12 14:36:51 +13:00
Anthony Towns
b5950dd59c validation: put coins cache write log into bench debug log 2021-10-11 21:45:49 +10:00
Anthony Towns
da94ebc2fa validation: move header validation error logging to VALIDATION debug category 2021-10-11 21:45:29 +10:00