Skip to content

Commit

Permalink
Add "base" dataType support
Browse files Browse the repository at this point in the history
  • Loading branch information
Spl3en committed Nov 1, 2019
1 parent 6b0117e commit 3c6dd0d
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
2 changes: 1 addition & 1 deletion icon-sdk-cpp
2 changes: 1 addition & 1 deletion src/aegis/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "sdk/sdk.h"
#include "blockdownloader.h"

#define APP_VERSION "1.2"
#define APP_VERSION "1.3"

namespace ICONation::Aegis
{
Expand Down
4 changes: 2 additions & 2 deletions src/aegis/blockdownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void Client::download(Block::Height current, Block::Height target)
}
catch (std::exception &e)
{
Common::Dbg::error("Application exception :");
Common::Dbg::error("Downloader exception :");
Common::Dbg::error(" - Type : {}", typeid(e).name());
Common::Dbg::error(" - Reason : {}", e.what());
Common::Dbg::warn("Retrying to download block {} ...", current);
Expand Down Expand Up @@ -103,7 +103,7 @@ void Client::download(Block::Height current, Block::Height target)
}
catch (std::exception &e)
{
Common::Dbg::error("Application exception :");
Common::Dbg::error("Downloader exception :");
Common::Dbg::error(" - Type : {}", typeid(e).name());
Common::Dbg::error(" - Reason : {}", e.what());
Common::Dbg::warn("Retrying to insert block in cache {} ...", lastBlockDownloaded);
Expand Down
4 changes: 0 additions & 4 deletions src/db/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ Db::Db(const std::string &host, const int port, const std::string &user, const s
m_sql = std::make_unique<SQL>(host, port, user, password, schema);
}

static void reset_table(std::unique_ptr<SQL> &sql, const std::string &table)
{
}

void Db::disable_foreign_checks(void)
{
m_sql->session()->sql("SET FOREIGN_KEY_CHECKS=0;").execute();
Expand Down
41 changes: 41 additions & 0 deletions tests/set_fake_block_height.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

function mysql {
/mnt/c/Program\ Files/MySQL/MySQL\ Server\ 8.0/bin/mysql.exe -u icon -picon < <(echo "use iconation; SET FOREIGN_KEY_CHECKS=0;" ; echo "${1};"; echo "SET FOREIGN_KEY_CHECKS=1;")
}

function disable_foreign_checks {
mysql "SET FOREIGN_KEY_CHECKS=0"
}

function enable_foreign_checks {
mysql "SET FOREIGN_KEY_CHECKS=1"
}

function get_block {
tbears blockbyheight ${1} -u https://ctz.solidwallet.io/api/v3 | sed "s/block info : //g"
}

function get_block_hash {
echo ${1} | jq '.result.block_hash'
}

function get_prev_block_hash {
echo ${1} | jq '.result.prev_block_hash'
}

function get_time_stamp {
echo ${1} | jq '.result.time_stamp'
}

function get_height {
echo ${1} | jq '.result.height'
}

block=$(get_block ${1})
hash=$(get_block_hash "$block")
prev_hash=$(get_prev_block_hash "$block")
timestamp=$(get_time_stamp "$block")
height=$(get_height "$block")

mysql "INSERT INTO block (previous_block, hash, timestamp, height) VALUES (${prev_hash}, ${hash}, '${timestamp}', '${height}')"

0 comments on commit 3c6dd0d

Please sign in to comment.