aboutsummaryrefslogtreecommitdiff
path: root/tests/core_tests/chaingen.h
diff options
context:
space:
mode:
authorLee Clagett <code@leeclagett.com>2021-01-24 07:42:57 +0000
committerLee Clagett <code@leeclagett.com>2021-01-23 06:23:39 +0000
commit08e4497c6e3b3f434c0bb255c3942648f153fe66 (patch)
tree2564f4214e9e66b2dc03ce3c788bb080b963be56 /tests/core_tests/chaingen.h
parentMerge pull request #7669 (diff)
downloadmonero-08e4497c6e3b3f434c0bb255c3942648f153fe66.tar.xz
Improve cryptonote (block and tx) binary read performance
Diffstat (limited to 'tests/core_tests/chaingen.h')
-rw-r--r--tests/core_tests/chaingen.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h
index a5fd35028..af12b6006 100644
--- a/tests/core_tests/chaingen.h
+++ b/tests/core_tests/chaingen.h
@@ -648,11 +648,9 @@ public:
bvc.m_verifivation_failed = true;
cryptonote::block blk;
- std::stringstream ss;
- ss << sr_block.data;
- binary_archive<false> ba(ss);
+ binary_archive<false> ba{epee::strspan<std::uint8_t>(sr_block.data)};
::serialization::serialize(ba, blk);
- if (!ss.good())
+ if (!ba.good())
{
blk = cryptonote::block();
}
@@ -671,11 +669,9 @@ public:
bool tx_added = pool_size + 1 == m_c.get_pool_transactions_count();
cryptonote::transaction tx;
- std::stringstream ss;
- ss << sr_tx.data;
- binary_archive<false> ba(ss);
+ binary_archive<false> ba{epee::strspan<std::uint8_t>(sr_tx.data)};
::serialization::serialize(ba, tx);
- if (!ss.good())
+ if (!ba.good())
{
tx = cryptonote::transaction();
}