6#ifndef VERIBLOCK_POP_CPP_MEMPOOL_RESULT_HPP
7#define VERIBLOCK_POP_CPP_MEMPOOL_RESULT_HPP
9#include "entities/atv.hpp"
10#include "entities/vbkblock.hpp"
11#include "entities/vtb.hpp"
12#include "validation_state.hpp"
20 std::vector<std::pair<VbkBlock::id_t, ValidationState>> context;
21 std::vector<std::pair<VTB::id_t, ValidationState>> vtbs;
22 std::vector<std::pair<ATV::id_t, ValidationState>> atvs;
29template <
typename JsonValue,
typename ID>
30JsonValue putArrayOfPairs(
33 const std::vector<std::pair<ID, ValidationState>>& pairs) {
34 auto arr = json::makeEmptyArray<JsonValue>();
35 for (
auto& v : pairs) {
36 auto o = json::makeEmptyObject<JsonValue>();
37 json::putStringKV(o,
"id",
HexStr(v.first));
38 auto state = ToJSON<JsonValue>(v.second);
39 json::putKV(o,
"validity", state);
40 json::arrayPushBack(arr, o);
43 json::putKV(obj, key, arr);
50template <
typename JsonValue>
52 auto obj = json::makeEmptyObject<JsonValue>();
53 detail::putArrayOfPairs(obj,
"vbkblocks", r.context);
54 detail::putArrayOfPairs(obj,
"vtbs", r.vtbs);
55 detail::putArrayOfPairs(obj,
"atvs", r.atvs);
std::string HexStr(const T itbegin, const T itend)
Convert bytes to hex.
An entity which is returned from MemPool on call to submitAll.