aboutsummaryrefslogtreecommitdiff
path: root/src/blockencodings.h
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2024-07-01 14:11:34 +0100
committerglozow <gloriajzhao@gmail.com>2024-07-01 14:11:52 +0100
commit0bd2bd1efb4b88d7f9eb9a1203560d69e07d97c3 (patch)
tree46db31e5fe0ccabd811bb3d8be5c613ab9f56dc1 /src/blockencodings.h
parent4c573e57184314c6dace54f7cd04786d1a99c940 (diff)
parent55eea003af24169c883e1761beb997e151845225 (diff)
Merge bitcoin/bitcoin#30237: test: Add Compact Block Encoding test `ReceiveWithExtraTransactions` covering non-empty `extra_txn`
55eea003af24169c883e1761beb997e151845225 test: Make blockencodings_tests deterministic (AngusP) 4c99301220ab44e98d0d0e1cc8d774d96a25b7aa test: Add ReceiveWithExtraTransactions Compact Block receive test. (AngusP) 4621e7cc8f8e2b71393a2b30d5dbe56165bfb854 test: refactor: Rename extra_txn to const empty_extra_txn as it is empty in all test cases (AngusP) Pull request description: This test uses the `extra_txn` (`vExtraTxnForCompact`) vector of optional orphan/conflicted/etc. transactions to provide transactions to a PartiallyDownloadedBlock that are not otherwise present in the mempool, and check that they are used. This also covers a former nullptr deref bug that was fixed in #29752 (bf031a517c79cec5b43420bcd40291ab0e9f68a8) where the `extra_txn` vec/circular-buffer was null-initialized and not yet filled when dereferenced in `PartiallyDownloadedBlock::InitData`. ACKs for top commit: marcofleon: Code review ACK 55eea003af24169c883e1761beb997e151845225. I ran the `blockencodings` unit test and no issues with the new test case. dergoegge: Code review ACK 55eea003af24169c883e1761beb997e151845225 glozow: ACK 55eea003af24169c883e1761beb997e151845225 Tree-SHA512: d7909c212bb069e1f6184b26390a5000dcc5f2b18e49b86cceccb9f1ec4f874dd43bc9bc92abd4207c71dd78112ba58400042c230c42e93afe55ba51b943262c
Diffstat (limited to 'src/blockencodings.h')
-rw-r--r--src/blockencodings.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/blockencodings.h b/src/blockencodings.h
index 2b1fabadd6..bc1d08ba5a 100644
--- a/src/blockencodings.h
+++ b/src/blockencodings.h
@@ -106,10 +106,15 @@ public:
CBlockHeader header;
- // Dummy for deserialization
+ /**
+ * Dummy for deserialization
+ */
CBlockHeaderAndShortTxIDs() {}
- CBlockHeaderAndShortTxIDs(const CBlock& block);
+ /**
+ * @param[in] nonce This should be randomly generated, and is used for the siphash secret key
+ */
+ CBlockHeaderAndShortTxIDs(const CBlock& block, const uint64_t nonce);
uint64_t GetShortID(const Wtxid& wtxid) const;
@@ -141,7 +146,7 @@ public:
explicit PartiallyDownloadedBlock(CTxMemPool* poolIn) : pool(poolIn) {}
- // extra_txn is a list of extra transactions to look at, in <witness hash, reference> form
+ // extra_txn is a list of extra orphan/conflicted/etc transactions to look at
ReadStatus InitData(const CBlockHeaderAndShortTxIDs& cmpctblock, const std::vector<CTransactionRef>& extra_txn);
bool IsTxAvailable(size_t index) const;
ReadStatus FillBlock(CBlock& block, const std::vector<CTransactionRef>& vtx_missing);