src/cryptonote_core/uptime_proof.cpp
//Deserialize from a btencoded string into our Proof instance
Deserialize from a btencoded string into our Proof instance
Deserialize from a btencoded string into our Proof instance
Proof::Proof(const std::string& serialized_proof)
{
  try {
    using namespace oxenmq;
    const bt_dict bt_proof = bt_deserialize<bt_dict>(serialized_proof);
    const bt_list& bt_version = var::get<bt_list>(bt_proof.at("v"));
    int k = 0;
    for (bt_value const &i: bt_version){
      version[k++] = static_cast<uint16_t>(get_int<unsigned>(i));
    }
    timestamp = get_int<unsigned>(bt_proof.at("t"));
    bool succeeded = epee::string_tools::get_ip_int32_from_string(public_ip, var::get<std::string>(bt_proof.at("ip")));
    storage_https_port = static_cast<uint16_t>(get_int<unsigned>(bt_proof.at("shp")));
    pubkey_ed25519 = tools::make_from_guts<crypto::ed25519_public_key>(var::get<std::string>(bt_proof.at("pke")));
    if (auto it = bt_proof.find("pk"); it != bt_proof.end())
      pubkey = tools::make_from_guts<crypto::public_key>(var::get<std::string>(bt_proof.at("pk")));
    else
      std::memcpy(pubkey.data, pubkey_ed25519.data, 32);
    qnet_port = get_int<unsigned>(bt_proof.at("q"));
    storage_omq_port = get_int<unsigned>(bt_proof.at("sop"));
    const bt_list& bt_storage_version = var::get<bt_list>(bt_proof.at("sv"));
    k = 0;
    for (bt_value const &i: bt_storage_version){
      storage_server_version[k++] = static_cast<uint16_t>(get_int<unsigned>(i));
    }
    const bt_list& bt_belnet_version = var::get<bt_list>(bt_proof.at("lv"));
    k = 0;
    for (bt_value const &i: bt_belnet_version){
      belnet_version[k++] = static_cast<uint16_t>(get_int<unsigned>(i));
    }
  } catch (const std::exception& e) {
    MWARNING("deserialization failed: " <<  e.what());
    throw;
  }
}
Proof :: Proof ( const std :: string & serialized_proof ) { try { using namespace oxenmq ; const bt_dict bt_proof = bt_deserialize < bt_dict > ( serialized_proof ) ; const bt_list & bt_version = var :: get < bt_list > ( bt_proof . at ( " " ) ) ; int k = 0 ; for ( bt_value const & i : bt_version ) { version [ k ++ ] = static_cast < uint16_t > ( get_int < unsigned > ( i ) ) ; } timestamp = get_int < unsigned > ( bt_proof . at ( " " ) ) ; bool succeeded = epee :: string_tools :: get_ip_int32_from_string ( public_ip , var :: get < std :: string > ( bt_proof . at ( " " ) ) ) ; storage_https_port = static_cast < uint16_t > ( get_int < unsigned > ( bt_proof . at ( " " ) ) ) ; pubkey_ed25519 = tools :: make_from_guts < crypto :: ed25519_public_key > ( var :: get < std :: string > ( bt_proof . at ( " " ) ) ) ; if ( auto it = bt_proof . find ( " " ) ; it != bt_proof . end ( ) ) pubkey = tools :: make_from_guts < crypto :: public_key > ( var :: get < std :: string > ( bt_proof . at ( " " ) ) ) ; else std :: memcpy ( pubkey . data , pubkey_ed25519 . data , 32 ) ; qnet_port = get_int < unsigned > ( bt_proof . at ( " " ) ) ; storage_omq_port = get_int < unsigned > ( bt_proof . at ( " " ) ) ; const bt_list & bt_storage_version = var :: get < bt_list > ( bt_proof . at ( " " ) ) ; k = 0 ; for ( bt_value const & i : bt_storage_version ) { storage_server_version [ k ++ ] = static_cast < uint16_t > ( get_int < unsigned > ( i ) ) ; } const bt_list & bt_belnet_version = var :: get < bt_list > ( bt_proof . at ( " " ) ) ; k = 0 ; for ( bt_value const & i : bt_belnet_version ) { belnet_version [ k ++ ] = static_cast < uint16_t > ( get_int < unsigned > ( i ) ) ; } } catch ( const std :: exception & e ) { MWARNING ( " " << e . what ( ) ) ; throw ; } }
Deserialize from a btencoded string into our Proof instance
Deserialize from a btencoded string into our Proof instance
//mnode_version <X,X,X> //timestamp //public_ip //storage_port //pubkey_ed25519 //pubkey //qnet_port //storage_omq_port //storage_version //belnet_version