31 #include <boost/range/adaptor/transformed.hpp> 32 #include <boost/variant/apply_visitor.hpp> 34 #include <type_traits> 45 template<
typename Source,
typename Destination>
46 constexpr
bool precision_loss()
49 std::numeric_limits<Destination>::is_signed != std::numeric_limits<Source>::is_signed ||
50 std::numeric_limits<Destination>::min() > std::numeric_limits<Source>::min() ||
51 std::numeric_limits<Destination>::max() < std::numeric_limits<Source>::max();
54 template<
typename Source,
typename Type>
58 (std::is_same<Type, char>() && std::is_same<Source, int>()) ||
59 std::numeric_limits<Source>::is_signed == std::numeric_limits<Type>::is_signed,
60 "comparisons below may have undefined behavior" 62 if (
source < std::numeric_limits<Type>::min())
66 if (std::numeric_limits<Type>::max() <
source)
73 template<
typename Type>
80 convert_numeric(val.GetInt(), i);
82 template<
typename Type>
89 convert_numeric(val.GetInt64(), i);
92 template<
typename Type>
99 convert_numeric(val.GetUint(), i);
101 template<
typename Type>
108 convert_numeric(val.GetUint64(), i);
124 str = val.GetString();
188 static_assert(!precision_loss<unsigned long long, std::uint64_t>(),
"precision loss");
199 static_assert(!precision_loss<long long, std::int64_t>(),
"precision loss");
284 using result_type = void;
310 boost::apply_visitor(add_input{doc, val}, txin);
321 if (val.MemberCount() != 1)
326 for (
auto const& elem : val.GetObject())
328 if (elem.name ==
"to_key")
334 else if (elem.name ==
"gen")
340 else if (elem.name ==
"to_script")
346 else if (elem.name ==
"to_scripthash")
543 using result_type = void;
565 boost::apply_visitor(add_output{doc, val}, txout.
target);
575 if (val.MemberCount() != 2)
580 for (
auto const& elem : val.GetObject())
582 if (elem.name ==
"amount")
587 if (elem.name ==
"to_key")
593 else if (elem.name ==
"to_key_public")
599 else if (elem.name ==
"to_script")
605 else if (elem.name ==
"to_scripthash")
1012 using boost::adaptors::transform;
1029 prunable.SetObject();
1036 val.AddMember(
"prunable", prunable, doc.GetAllocator());
1042 using boost::adaptors::transform;
1044 if (!val.IsObject())
1049 std::vector<rct::key> commitments;
1059 const auto& prunable = val[
"prunable"];
1071 sig.
outPk.reserve(commitments.size());
1072 for (
rct::key const& commitment : commitments)
1074 sig.
outPk.push_back({{}, commitment});
1088 if (!val.IsObject())
1103 std::vector<rct::key> keyVector(sig.
Ci, std::end(sig.
Ci));
1109 if (!val.IsObject())
1114 const auto ci = val.FindMember(
"Ci");
1115 if (ci == val.MemberEnd())
1122 std::vector<rct::key> keyVector;
1124 if (!(keyVector.size() == 64))
1128 for (
size_t i=0; i < 64; i++)
1130 sig.
Ci[i] = keyVector[i];
1154 if (!val.IsObject())
1177 std::vector<rct::key> keyVector(sig.
s0, std::end(sig.
s0));
1180 keyVector.assign(sig.
s1, std::end(sig.
s1));
1188 if (!val.IsObject())
1194 std::vector<rct::key> keyVector;
1196 if (!(keyVector.size() == 64))
1200 for (
size_t i=0; i < 64; i++)
1202 sig.
s0[i] = keyVector[i];
1208 if (!(keyVector.size() == 64))
1212 for (
size_t i=0; i < 64; i++)
1214 sig.
s1[i] = keyVector[i];
1230 if (!val.IsObject())
1269 if (!val.IsObject())
1310 if (!val.IsObject())
crypto::hash max_used_block_hash
#define INSERT_INTO_JSON_OBJECT(jsonVal, doc, key, source)
std::vector< crypto::hash > tx_hashes
const CharType(& source)[N]
std::vector< std::uint64_t > distribution
epee::misc_utils::struct_init< response_t > response
std::vector< rangeSig > rangeSigs
boost::variant< txin_gen, txin_to_script, txin_to_scripthash, txin_to_key, txin_to_key_public > txin_v
std::vector< blobdata > txs
cryptonote::account_public_address address
std::vector< uint64_t > key_offsets
#define GET_FROM_JSON_OBJECT(source, dst, key)
cryptonote::transaction tx
std::vector< uint8_t > extra
output_distribution_data data
std::vector< ecdhTuple > ecdhInfo
uint64_t max_used_block_height
std::vector< tx_out > vout
Holds cryptonote related classes and helpers.
std::vector< txin_v > vin
std::vector< uint8_t > script
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
#define OBJECT_HAS_MEMBER_OR_THROW(val, key)
rct::rctSig rct_signatures
uint64_t last_failed_block_height
unsigned __int64 uint64_t
GenericDocument< UTF8<> > Document
GenericDocument with UTF8 encoding.
version
Supported socks variants.
std::string message("Message requiring signing")
uint64_t last_relayed_time
boost::endian::big_uint32_t ip
boost::endian::big_uint16_t port
std::vector< std::vector< crypto::signature > > signatures
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
void toJsonValue(rapidjson::Document &doc, const std::string &i, rapidjson::Value &val)
std::vector< uint8_t > sigset
void fromJsonValue(const rapidjson::Value &val, std::string &str)
const T & move(const T &t)
crypto::hash last_failed_block_hash
std::vector< uint8_t > sigset
crypto::key_image k_image
bool nonexistent_utxo_seen
uint64_t m_address_prefix
std::vector< crypto::public_key > keys
error
Tracks LMDB error codes.
std::vector< Bulletproof > bulletproofs
std::uint64_t start_height
std::vector< cryptonote::transaction > transactions