Various improvements to the ZMQ JSON-RPC handling:

- Finding handling function in ZMQ JSON-RPC now uses binary search
  - Temporary `std::vector`s in JSON output now use `epee::span` to
    prevent allocations.
  - Binary -> hex in JSON output no longer allocates temporary buffer
  - C++ structs -> JSON skips intermediate DOM creation, and instead
    write directly to an output stream.
This commit is contained in:
Lee Clagett 2019-11-07 05:45:06 +00:00
parent b4e1dc83d2
commit 0f78b06e8c
12 changed files with 832 additions and 1029 deletions

View file

@ -850,6 +850,17 @@ TEST(ToHex, Array)
);
}
TEST(ToHex, ArrayFromPod)
{
std::array<char, 64> expected{{'5', 'f', '2', 'b', '0', '1'}};
std::fill(expected.begin() + 6, expected.end(), '0');
EXPECT_EQ(
expected,
(epee::to_hex::array(crypto::ec_point{{0x5F, 0x2B, 0x01, 0x00}}))
);
}
TEST(ToHex, Ostream)
{
std::stringstream out;