Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
501}502},503[&] {504// insert (in middle, range)505if (cdeq.size() < limitlen) {506size_t count = provider.ConsumeIntegralInRange<size_t>(0, maxlen);507size_t before = provider.ConsumeIntegralInRange<size_t>(0, cdeq.size());508bool val = ctx.randbool();509auto it = deq.insert(cdeq.begin() + before, count, val);510auto bitit = bitdeq.insert(cbitdeq.begin() + before, count, val);511assert(it == deq.begin() + before);512assert(bitit == bitdeq.begin() + before);513}514},515[&] {516// insert (in middle, begin/end)517if (cdeq.size() < limitlen) {518size_t count = provider.ConsumeIntegralInRange<size_t>(0, maxlen);519size_t before = provider.ConsumeIntegralInRange<size_t>(0, cdeq.size());520auto rand_begin = RANDDATA.begin() + ctx.randbits(RANDDATA_BITS);521auto rand_end = rand_begin + count;522auto it = deq.insert(cdeq.begin() + before, rand_begin, rand_end);523auto bitit = bitdeq.insert(cbitdeq.begin() + before, rand_begin, rand_end);524assert(it == deq.begin() + before);525assert(bitit == bitdeq.begin() + before);526}527});528}529{530assert(deq.size() == bitdeq.size());531auto it = deq.begin();532auto bitit = bitdeq.begin();533auto itend = deq.end();534while (it != itend) {535assert(*it == *bitit);536++it;537++bitit;538}539}540}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.