aboutsummaryrefslogtreecommitdiff
path: root/tests/core_tests
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2019-04-16 22:30:40 +0200
committerRiccardo Spagni <ric@spagni.net>2019-04-16 22:30:40 +0200
commit46c477ab308f0c051b13e3356c24ebc2257bf0a6 (patch)
treef805eef0733c7d2da03535fb9bb1bcf799d276af /tests/core_tests
parentMerge pull request #5440 (diff)
parentblockchain_db: fix db txn ending too early (diff)
downloadmonero-46c477ab308f0c051b13e3356c24ebc2257bf0a6.tar.xz
Merge pull request #5400
5e673c03 blockchain_db: fix db txn ending too early (moneromooo-monero)
Diffstat (limited to 'tests/core_tests')
-rw-r--r--tests/core_tests/chaingen.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h
index f2bcb7787..2ecbdc436 100644
--- a/tests/core_tests/chaingen.h
+++ b/tests/core_tests/chaingen.h
@@ -643,7 +643,15 @@ public:
log_event("cryptonote::block");
cryptonote::block_verification_context bvc = AUTO_VAL_INIT(bvc);
- m_c.handle_incoming_block(t_serializable_object_to_blob(b), &b, bvc);
+ cryptonote::blobdata bd = t_serializable_object_to_blob(b);
+ std::vector<cryptonote::block> pblocks;
+ if (m_c.prepare_handle_incoming_blocks(std::vector<cryptonote::block_complete_entry>(1, {bd, {}}), pblocks))
+ {
+ m_c.handle_incoming_block(bd, &b, bvc);
+ m_c.cleanup_handle_incoming_blocks();
+ }
+ else
+ bvc.m_verifivation_failed = true;
bool r = check_block_verification_context(bvc, m_ev_index, b, m_validator);
CHECK_AND_NO_ASSERT_MES(r, false, "block verification context check failed");
return r;
@@ -666,7 +674,14 @@ public:
log_event("serialized_block");
cryptonote::block_verification_context bvc = AUTO_VAL_INIT(bvc);
- m_c.handle_incoming_block(sr_block.data, NULL, bvc);
+ std::vector<cryptonote::block> pblocks;
+ if (m_c.prepare_handle_incoming_blocks(std::vector<cryptonote::block_complete_entry>(1, {sr_block.data, {}}), pblocks))
+ {
+ m_c.handle_incoming_block(sr_block.data, NULL, bvc);
+ m_c.cleanup_handle_incoming_blocks();
+ }
+ else
+ bvc.m_verifivation_failed = true;
cryptonote::block blk;
std::stringstream ss;