(gdb) where
#0 0x000056544951f972 in __gnu_cxx::new_allocator<unsigned char>::_M_max_size (this=0x0) at /usr/include/c++/10.3.1/ext/new_allocator.h:185
#1 0x000056544951ec0b in __gnu_cxx::new_allocator<unsigned char>::allocate (this=0x7ff0995d0230, __n=32) at /usr/include/c++/10.3.1/ext/new_allocator.h:105
#2 0x000056544951dde3 in std::allocator_traits<std::allocator<unsigned char> >::allocate (__a=..., __n=32) at /usr/include/c++/10.3.1/bits/alloc_traits.h:460
#3 0x000056544951c489 in std::_Vector_base<unsigned char, std::allocator<unsigned char> >::_M_allocate (this=0x7ff0995d0230, __n=32) at /usr/include/c++/10.3.1/bits/stl_vector.h:346
#4 0x000056544951c3b8 in std::_Vector_base<unsigned char, std::allocator<unsigned char> >::_M_create_storage (this=0x7ff0995d0230, __n=32) at /usr/include/c++/10.3.1/bits/stl_vector.h:361
#5 0x000056544951a768 in std::_Vector_base<unsigned char, std::allocator<unsigned char> >::_Vector_base (this=0x7ff0995d0230, __n=32, __a=...) at /usr/include/c++/10.3.1/bits/stl_vector.h:305
#6 0x00005654495a893b in std::vector<unsigned char, std::allocator<unsigned char> >::vector (this=0x7ff0995d0230, __x=std::vector of length 32, capacity 32 = {...}) at /usr/include/c++/10.3.1/bits/stl_vector.h:555
#7 0x00005654499314dd in altintegration::AltBlock::AltBlock (this=0x7ff0995d0230) at /usr/local/include/veriblock/pop/entities/altblock.hpp:28
#8 0x0000565449b6d3b0 in VeriBlock::AltChainParamsVBTC::getBootstrapBlock (this=0x7ff0a3ff30e0) at vbk/params.hpp:75
#9 0x0000565449f0b951 in altintegration::AltBlockTree::BlockPayloadMutator::BlockPayloadMutator (this=0x7ff0995d0460, tree=..., block=...) at /opt/alt-integration-cpp-03e5d066369030c36d5dd22c2628817b829f0218/src/pop/blockchain/alt_block_tree.cpp:398
#10 0x0000565449f0c775 in altintegration::AltBlockTree::makeConnectedLeafPayloadMutator (this=this@entry=0x7ff0a3ef3550, block=...) at /opt/alt-integration-cpp-03e5d066369030c36d5dd22c2628817b829f0218/src/pop/blockchain/alt_block_tree.cpp:499
#11 0x0000565449f0c830 in altintegration::AltBlockTree::connectBlock (this=0x7ff0a3ef3550, index=..., state=...) at /opt/alt-integration-cpp-03e5d066369030c36d5dd22c2628817b829f0218/src/pop/blockchain/alt_block_tree.cpp:195
#12 0x0000565449f0d680 in altintegration::AltBlockTree::connectBlock (this=0x7ff0a3ef3550, index=..., state=...) at /opt/alt-integration-cpp-03e5d066369030c36d5dd22c2628817b829f0218/src/pop/blockchain/alt_block_tree.cpp:211
#13 0x0000565449f0d680 in altintegration::AltBlockTree::connectBlock (this=0x7ff0a3ef3550, index=..., state=...) at /opt/alt-integration-cpp-03e5d066369030c36d5dd22c2628817b829f0218/src/pop/blockchain/alt_block_tree.cpp:211
[... frame repeats until ...]
#315 0x0000565449f0d680 in altintegration::AltBlockTree::connectBlock (this=0x7ff0a3ef3550, index=..., state=...) at /opt/alt-integration-cpp-03e5d066369030c36d5dd22c2628817b829f0218/src/pop/blockchain/alt_block_tree.cpp:211
#316 0x0000565449f0d680 in altintegration::AltBlockTree::connectBlock (this=this@entry=0x7ff0a3ef3550, index=..., state=...) at /opt/alt-integration-cpp-03e5d066369030c36d5dd22c2628817b829f0218/src/pop/blockchain/alt_block_tree.cpp:211
#317 0x0000565449f0dc06 in altintegration::AltBlockTree::acceptBlock (this=this@entry=0x7ff0a3ef3550, index=..., payloads=..., state=...) at /opt/alt-integration-cpp-03e5d066369030c36d5dd22c2628817b829f0218/src/pop/blockchain/alt_block_tree.cpp:110
#318 0x0000565449f0dca7 in altintegration::AltBlockTree::acceptBlock (this=this@entry=0x7ff0a3ef3550, index=..., payloads=...) at /opt/alt-integration-cpp-03e5d066369030c36d5dd22c2628817b829f0218/src/pop/blockchain/alt_block_tree.cpp:101
#319 0x0000565449f0e18b in altintegration::AltBlockTree::acceptBlock (this=0x7ff0a3ef3550, block=std::vector of length 32, capacity 32 = {...}, payloads=...) at /opt/alt-integration-cpp-03e5d066369030c36d5dd22c2628817b829f0218/src/pop/blockchain/alt_block_tree.cpp:93
#320 0x0000565449911a62 in VeriBlock::addAllBlockPayloads (block=..., state=...) at vbk/pop_service.cpp:114
#321 0x000056544985692d in CChainState::AcceptBlock (this=0x7ff0a40c4960, pblock=std::shared_ptr<const CBlock> (use count 2, weak count 0) = {...}, state=..., chainparams=..., ppindex=0x7ff0995ed788, fRequested=true, dbp=0x0, fNewBlock=0x7ff0995ed96f) at validation.cpp:3894
#322 0x0000565449856f89 in ProcessNewBlock (chainparams=..., pblock=std::shared_ptr<const CBlock> (use count 2, weak count 0) = {...}, fForceProcessing=true, fNewBlock=0x7ff0995ed96f) at validation.cpp:3945
#323 0x00005654495877a2 in ProcessMessage (pfrom=0x7ff0995a9520, strCommand="block", vRecv=..., nTimeReceived=1631627288765281, chainparams=..., connman=0x7ff09c3c6300, banman=0x7ff0a3ef2580, interruptMsgProc=...) at net_processing.cpp:3027
#324 0x000056544958a801 in PeerLogicValidation::ProcessMessages (this=0x7ff0a4087e60, pfrom=0x7ff0995a9520, interruptMsgProc=...) at net_processing.cpp:3403
#325 0x000056544952a66c in CConnman::ThreadMessageHandler (this=0x7ff09c3c6300) at net.cpp:2023
#326 0x0000565449574754 in std::__invoke_impl<void, void (CConnman::*&)(), CConnman*&> (__f=@0x7ff099740640: (void (CConnman::*)(CConnman * const)) 0x56544952a46c <CConnman::ThreadMessageHandler()>, __t=@0x7ff099740650: 0x7ff09c3c6300) at /usr/include/c++/10.3.1/bits/invoke.h:73
#327 0x0000565449572501 in std::__invoke<void (CConnman::*&)(), CConnman*&> (__fn=@0x7ff099740640: (void (CConnman::*)(CConnman * const)) 0x56544952a46c <CConnman::ThreadMessageHandler()>) at /usr/include/c++/10.3.1/bits/invoke.h:95
#328 0x000056544956f285 in std::_Bind<void (CConnman::*(CConnman*))()>::__call<void, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) (this=0x7ff099740640, __args=...) at /usr/include/c++/10.3.1/functional:416
#329 0x000056544956a4e3 in std::_Bind<void (CConnman::*(CConnman*))()>::operator()<, void>() (this=0x7ff099740640) at /usr/include/c++/10.3.1/functional:499
#330 0x00005654495642c9 in std::__invoke_impl<void, std::_Bind<void (CConnman::*(CConnman*))()>&>(std::__invoke_other, std::_Bind<void (CConnman::*(CConnman*))()>&) (__f=...) at /usr/include/c++/10.3.1/bits/invoke.h:60
#331 0x000056544955a91d in std::__invoke_r<void, std::_Bind<void (CConnman::*(CConnman*))()>&>(std::_Bind<void (CConnman::*(CConnman*))()>&) (__fn=...) at /usr/include/c++/10.3.1/bits/invoke.h:153
#332 0x000056544954d4c4 in std::_Function_handler<void (), std::_Bind<void (CConnman::*(CConnman*))()> >::_M_invoke(std::_Any_data const&) (__functor=...) at /usr/include/c++/10.3.1/bits/std_function.h:291
#333 0x00005654494abf6b in std::function<void ()>::operator()() const (this=0x7ff0995f06b0) at /usr/include/c++/10.3.1/bits/std_function.h:622
#334 0x00005654494b2075 in TraceThread<std::function<void ()> >(char const*, std::function<void ()>) (name=0x56544a10387c "msghand", func=...) at ./util/system.h:365
#335 0x0000565449576632 in std::__invoke_impl<void, void (*)(char const*, std::function<void ()>), char const*, std::function<void ()> >(std::__invoke_other, void (*&&)(char const*, std::function<void ()>), char const*&&, std::function<void ()>&&) (
__f=@0x7ff099734170: 0x5654494b1fef <TraceThread<std::function<void ()> >(char const*, std::function<void ()>)>) at /usr/include/c++/10.3.1/bits/invoke.h:60
#336 0x0000565449576452 in std::__invoke<void (*)(char const*, std::function<void ()>), char const*, std::function<void ()> >(void (*&&)(char const*, std::function<void ()>), char const*&&, std::function<void ()>&&) (
__fn=@0x7ff099734170: 0x5654494b1fef <TraceThread<std::function<void ()> >(char const*, std::function<void ()>)>) at /usr/include/c++/10.3.1/bits/invoke.h:95
#337 0x00005654495762d2 in std::thread::_Invoker<std::tuple<void (*)(char const*, std::function<void ()>), char const*, std::function<void ()> > >::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) (this=0x7ff099734148) at /usr/include/c++/10.3.1/thread:264
#338 0x000056544957624d in std::thread::_Invoker<std::tuple<void (*)(char const*, std::function<void ()>), char const*, std::function<void ()> > >::operator()() (this=0x7ff099734148) at /usr/include/c++/10.3.1/thread:271
#339 0x000056544957620f in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(char const*, std::function<void ()>), char const*, std::function<void ()> > > >::_M_run() (this=0x7ff099734140) at /usr/include/c++/10.3.1/thread:215
#340 0x00007ff0a4489713 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::swap(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) () from /usr/lib/libstdc++.so.6
$ ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 514782
max locked memory (kbytes, -l) 16384
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 514782
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
~/.vbitcoin $ ulimit -a
core file size (blocks) (-c) unlimited
data seg size (kb) (-d) unlimited
scheduling priority (-e) 0
file size (blocks) (-f) unlimited
pending signals (-i) 514782
max locked memory (kb) (-l) 64
max memory size (kb) (-m) unlimited
open files (-n) 1048576
POSIX message queues (bytes) (-q) 819200
real-time priority (-r) 0
stack size (kb) (-s) 8192
cpu time (seconds) (-t) unlimited
max user processes (-u) unlimited
virtual memory (kb) (-v) unlimited
file locks (-x) unlimited
---
src/pop/blockchain/alt_block_tree.cpp | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/src/pop/blockchain/alt_block_tree.cpp b/src/pop/blockchain/alt_block_tree.cpp
index 14ae9ef3..f31f8201 100644
--- a/src/pop/blockchain/alt_block_tree.cpp
+++ b/src/pop/blockchain/alt_block_tree.cpp
@@ -108,6 +108,26 @@ void AltBlockTree::acceptBlock(index_t& index,
if (index.pprev->isConnected()) {
connectBlock(index, state);
+ // connect the descendants
+ std::stack<altintegration::BlockIndex<altintegration::AltBlock>*> stack;
+ for(auto pos = index.pnext.rbegin(); pos != index.pnext.rend(); pos++) {
+ auto* next = *pos;
+ stack.push(next);
+ }
+
+ while(!stack.empty()) {
+ auto* toProcess = stack.top();
+ stack.pop();
+ if (toProcess->hasFlags(BLOCK_HAS_PAYLOADS)) {
+ ValidationState dummy;
+ connectBlock(*toProcess, dummy);
+ // fill stack
+ for(auto pos = toProcess->pnext.rbegin(); pos != toProcess->pnext.rend(); pos++) {
+ auto* next = *pos;
+ stack.push(next);
+ }
+ }
+ }
}
}
@@ -204,13 +224,6 @@ bool AltBlockTree::connectBlock(index_t& index, ValidationState& state) {
if (index.isValid()) {
onBlockConnected.emit(index);
- // connect the descendants
- for (auto* successor : index.pnext) {
- if (successor->hasFlags(BLOCK_HAS_PAYLOADS)) {
- ValidationState dummy;
- connectBlock(*successor, dummy);
- }
- }
} else {
onInvalidBlockConnected.emit(index, state);
};
--
2.31.1