Fix segfault in get_block

Only `.reserve()` was called here, so assigning into `.begin()` isn't
valid (we either need to `.resize()`, or use `std::back_inserter`).
This commit is contained in:
Jason Rhinelander 2022-12-21 15:21:59 -04:00
parent 165b545975
commit 883658fbda
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
1 changed files with 1 additions and 1 deletions

View File

@ -1552,7 +1552,7 @@ namespace cryptonote::rpc {
get_block.response["block_header"] = header;
std::vector<std::string> tx_hashes;
tx_hashes.reserve(blk.tx_hashes.size());
std::transform(blk.tx_hashes.begin(), blk.tx_hashes.end(), tx_hashes.begin(), [](const auto& x) { return tools::type_to_hex(x); });
std::transform(blk.tx_hashes.begin(), blk.tx_hashes.end(), std::back_inserter(tx_hashes), [](const auto& x) { return tools::type_to_hex(x); });
get_block.response["tx_hashes"] = tx_hashes;
get_block.response["blob"] = oxenc::to_hex(t_serializable_object_to_blob(blk));
get_block.response["json"] = obj_to_json_str(blk);