mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-14 15:25:51 +02:00
kernel: keep range iterators tied to their owner
`Range` iterators point to the view, so iterators saved from temporary views dangle. Point them to the underlying container, use the range's getter for element access, and remove `operator->`, which returned elements by value and could not support arrow expressions. Co-authored-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
This commit is contained in:
@@ -747,8 +747,8 @@ BOOST_AUTO_TEST_CASE(btck_block)
|
||||
CheckRange(block_tx.Transactions(), block_tx.CountTransactions());
|
||||
auto transactions{block_tx.Transactions()};
|
||||
auto transactions_copy{transactions};
|
||||
BOOST_CHECK(transactions.begin() != transactions_copy.begin()); // TODO: Iterators over the same underlying block should compare equal.
|
||||
BOOST_CHECK(transactions.begin() != block_tx.Transactions().begin()); // TODO: Iterators over the same underlying block should compare equal.
|
||||
BOOST_CHECK(transactions.begin() == transactions_copy.begin());
|
||||
BOOST_CHECK(transactions.begin() == block_tx.Transactions().begin());
|
||||
auto transaction_it{transactions.begin()};
|
||||
BOOST_CHECK((*transaction_it).Txid() == block_tx.GetTransaction(0).Txid());
|
||||
auto invalid_data = hex_string_to_byte_vec("012300");
|
||||
|
||||
Reference in New Issue
Block a user