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:
Lőrinc
2026-08-11 11:51:13 -07:00
parent 0936c55f62
commit fc0dcf950f
2 changed files with 8 additions and 9 deletions

View File

@@ -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");