1
0
Fork 0
forked from lthn/blockchain

Merge branch 'master' into release

This commit is contained in:
sowle 2022-12-22 20:22:37 +01:00
commit 4eacfa8305
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
8 changed files with 90 additions and 28 deletions

View file

@ -108,7 +108,7 @@ For instance, by adding the following lines to `~/.bashrc`
1. Build GUI:
cd zano
utils/build_sript_linux.sh
utils/build_script_linux.sh
7. Look for the binaries in `build` folder

View file

@ -174,7 +174,7 @@ ENABLE_SHARED_PCH_EXECUTABLE(connectivity_tool)
add_executable(simplewallet ${SIMPLEWALLET})
add_dependencies(simplewallet version)
target_link_libraries(simplewallet wallet rpc currency_core crypto common zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} dl)
target_link_libraries(simplewallet wallet rpc currency_core crypto common zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
ENABLE_SHARED_PCH(simplewallet SIMPLEWALLET)
ENABLE_SHARED_PCH_EXECUTABLE(simplewallet)

View file

@ -3373,11 +3373,11 @@ bool wallet2::is_transfer_okay_for_pos(const transfer_details& tr, uint64_t& sta
return true;
}
//----------------------------------------------------------------------------------------------------
void wallet2::get_mining_history(wallet_public::mining_history& hist)
void wallet2::get_mining_history(wallet_public::mining_history& hist, uint64_t timestamp_from)
{
for (auto& tr : m_transfer_history)
{
if (currency::is_coinbase(tr.tx) && tr.tx.vin.size() == 2)
if (currency::is_coinbase(tr.tx) && tr.tx.vin.size() == 2 && tr.timestamp > timestamp_from)
{
tools::wallet_public::mining_history_entry mhe = AUTO_VAL_INIT(mhe);
mhe.a = tr.amount;

View file

@ -819,7 +819,7 @@ namespace tools
bool reset_history();
bool is_transfer_unlocked(const transfer_details& td) const;
bool is_transfer_unlocked(const transfer_details& td, bool for_pos_mining, uint64_t& stake_lock_time) const;
void get_mining_history(wallet_public::mining_history& hist);
void get_mining_history(wallet_public::mining_history& hist, uint64_t timestamp_from = 0);
void set_core_runtime_config(const currency::core_runtime_config& pc);
currency::core_runtime_config& get_core_runtime_config();
bool backup_keys(const std::string& path);

View file

@ -318,6 +318,12 @@ namespace wallet_public
END_KV_SERIALIZE_MAP()
};
struct COMMAND_RPC_GET_MINING_HISTORY
{
typedef currency::struct_with_one_t_type<uint64_t> request;
typedef wallet_public::mining_history response;
};
#define ORDER_FROM_BEGIN_TO_END "FROM_BEGIN_TO_END"
#define ORDER_FROM_FROM_END_TO_BEGIN "FROM_END_TO_BEGIN"

View file

@ -741,6 +741,11 @@ namespace tools
return true;
}
bool wallet_rpc_server::on_get_mining_history(const wallet_public::COMMAND_RPC_GET_MINING_HISTORY::request& req, wallet_public::COMMAND_RPC_GET_MINING_HISTORY::response& res, epee::json_rpc::error& er, connection_context& cntx)
{
m_wallet.get_mining_history(res, req.v);
return true;
}
//------------------------------------------------------------------------------------------------------------------------------
bool wallet_rpc_server::on_contracts_send_proposal(const wallet_public::COMMAND_CONTRACTS_SEND_PROPOSAL::request& req, wallet_public::COMMAND_CONTRACTS_SEND_PROPOSAL::response& res, epee::json_rpc::error& er, connection_context& cntx)
{

View file

@ -53,6 +53,7 @@ namespace tools
MAP_JON_RPC_WE("search_for_transactions", on_search_for_transactions, wallet_public::COMMAND_RPC_SEARCH_FOR_TRANSACTIONS)
MAP_JON_RPC_WE("get_restore_info", on_getwallet_restore_info, wallet_public::COMMAND_RPC_GET_WALLET_RESTORE_INFO)
MAP_JON_RPC_WE("get_seed_phrase_info", on_get_seed_phrase_info, wallet_public::COMMAND_RPC_GET_SEED_PHRASE_INFO)
MAP_JON_RPC_WE("get_mining_history", on_get_mining_history, wallet_public::COMMAND_RPC_GET_MINING_HISTORY)
//contracts API
MAP_JON_RPC_WE("contracts_send_proposal", on_contracts_send_proposal, wallet_public::COMMAND_CONTRACTS_SEND_PROPOSAL)
MAP_JON_RPC_WE("contracts_accept_proposal", on_contracts_accept_proposal, wallet_public::COMMAND_CONTRACTS_ACCEPT_PROPOSAL)
@ -91,6 +92,7 @@ namespace tools
bool on_sign_transfer(const wallet_public::COMMAND_SIGN_TRANSFER::request& req, wallet_public::COMMAND_SIGN_TRANSFER::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_submit_transfer(const wallet_public::COMMAND_SUBMIT_TRANSFER::request& req, wallet_public::COMMAND_SUBMIT_TRANSFER::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_search_for_transactions(const wallet_public::COMMAND_RPC_SEARCH_FOR_TRANSACTIONS::request& req, wallet_public::COMMAND_RPC_SEARCH_FOR_TRANSACTIONS::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_get_mining_history(const wallet_public::COMMAND_RPC_GET_MINING_HISTORY::request& req, wallet_public::COMMAND_RPC_GET_MINING_HISTORY::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_contracts_send_proposal(const wallet_public::COMMAND_CONTRACTS_SEND_PROPOSAL::request& req, wallet_public::COMMAND_CONTRACTS_SEND_PROPOSAL::response& res, epee::json_rpc::error& er, connection_context& cntx);
bool on_contracts_accept_proposal(const wallet_public::COMMAND_CONTRACTS_ACCEPT_PROPOSAL::request& req, wallet_public::COMMAND_CONTRACTS_ACCEPT_PROPOSAL::response& res, epee::json_rpc::error& er, connection_context& cntx);

View file

@ -17,12 +17,19 @@
# To stop container:
# docker stop zanod
#
# To build with different lib versions, pass through --build-arg's
# docker build --build-arg OPENSSL_VERSION_DOT=1.1.1n --build-arg OPENSSL_HASH=40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a -f utils/docker/Dockerfile .
#
# Available Build Args
# - CMake Version: CMAKE_VERSION_DOT, CMAKE_HASH
# - Boost Version: BOOST_VERSION, BOOST_VERSION_DOT, BOOST_HASH
# - OpenSSL Version: OPENSSL_VERSION_DOT, OPENSSL_HASH
#
# Build Zano
#
FROM ubuntu:18.04 as zano-build
FROM ubuntu:18.04 as build-prep
RUN apt update && \
apt install -y build-essential \
@ -34,28 +41,71 @@ RUN apt update && \
WORKDIR /root
# CMake 3.15.5
# Lib Settings
ARG CMAKE_VERSION_DOT=3.15.5
ARG CMAKE_HASH=62e3e7d134a257e13521e306a9d3d1181ab99af8fcae66699c8f98754fc02dda
RUN curl https://github.com/Kitware/CMake/releases/download/v3.15.5/cmake-3.15.5-Linux-x86_64.sh -OL &&\
echo '62e3e7d134a257e13521e306a9d3d1181ab99af8fcae66699c8f98754fc02dda cmake-3.15.5-Linux-x86_64.sh' | sha256sum -c - &&\
mkdir /opt/cmake &&\
sh cmake-3.15.5-Linux-x86_64.sh --prefix=/opt/cmake --skip-license &&\
ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake &&\
cmake --version &&\
rm cmake-3.15.5-Linux-x86_64.sh
ARG BOOST_VERSION=1_70_0
ARG BOOST_VERSION_DOT=1.70.0
ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778
# Boost 1.68
ARG OPENSSL_VERSION_DOT=1.1.1n
ARG OPENSSL_HASH=40dceb51a4f6a5275bde0e6bf20ef4b91bfc32ed57c0552e2e8e15463372b17a
RUN curl https://boostorg.jfrog.io/artifactory/main/release/1.68.0/source/boost_1_68_0.tar.bz2 -OL &&\
echo '7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7 boost_1_68_0.tar.bz2' | sha256sum -c - &&\
tar -xjf boost_1_68_0.tar.bz2 &&\
rm boost_1_68_0.tar.bz2 &&\
cd boost_1_68_0 &&\
./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer &&\
./b2 &&\
cd ..
# Environment Variables
ENV BOOST_ROOT /root/boost_${BOOST_VERSION}
ENV OPENSSL_ROOT_DIR=/root/openssl
ENV BOOST_ROOT=/root/boost_1_68_0
##########################################################
# Split download & compile to use dockers caching layers #
##########################################################
# Download CMake
RUN set -ex \
&& curl https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION_DOT}/cmake-${CMAKE_VERSION_DOT}-Linux-x86_64.sh -OL\
&& echo "${CMAKE_HASH} cmake-${CMAKE_VERSION_DOT}-Linux-x86_64.sh" | sha256sum -c
# Download Boost
RUN set -ex \
&& curl -L -o boost_${BOOST_VERSION}.tar.bz2 https://downloads.sourceforge.net/project/boost/boost/${BOOST_VERSION_DOT}/boost_${BOOST_VERSION}.tar.bz2 \
&& sha256sum boost_${BOOST_VERSION}.tar.bz2 \
&& echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c\
&& tar -xvf boost_${BOOST_VERSION}.tar.bz2
# Download OpenSSL
RUN curl https://www.openssl.org/source/openssl-${OPENSSL_VERSION_DOT}.tar.gz -OL \
&& sha256sum openssl-${OPENSSL_VERSION_DOT}.tar.gz \
&& echo "${OPENSSL_HASH} openssl-${OPENSSL_VERSION_DOT}.tar.gz" | sha256sum -c
# Compile CMake
RUN set -ex \
&& mkdir /opt/cmake \
&& sh cmake-3.15.5-Linux-x86_64.sh --prefix=/opt/cmake --skip-license\
&& ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake\
&& cmake --version\
&& rm cmake-3.15.5-Linux-x86_64.sh
# Compile Boost
RUN set -ex \
&& cd boost_${BOOST_VERSION} \
&& ./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer,log \
&& ./b2
# Compile OpenSSL
RUN set -ex \
&& tar xaf openssl-${OPENSSL_VERSION_DOT}.tar.gz \
&& rm openssl-${OPENSSL_VERSION_DOT}.tar.gz \
&& cd openssl-${OPENSSL_VERSION_DOT} \
&& ./config --prefix=/root/openssl --openssldir=/root/openssl shared zlib \
&& make \
&& make test \
&& make install \
&& cd .. \
&& rm -rf openssl-${OPENSSL_VERSION_DOT}
FROM build-prep as build
# Zano
@ -63,9 +113,8 @@ RUN pwd && mem_avail_gb=$(( $(getconf _AVPHYS_PAGES) * $(getconf PAGE_SIZE) / (1
make_job_slots=$(( $mem_avail_gb < 4 ? 1 : $mem_avail_gb / 4)) &&\
echo make_job_slots=$make_job_slots &&\
set -x &&\
git clone --single-branch https://github.com/hyle-team/zano.git &&\
git clone --single-branch --recursive https://github.com/hyle-team/zano.git &&\
cd zano &&\
git submodule update --init --recursive &&\
mkdir build && cd build &&\
cmake -D STATIC=TRUE .. &&\
make -j $make_job_slots daemon simplewallet
@ -84,8 +133,8 @@ RUN useradd -ms /bin/bash zano &&\
USER zano:zano
WORKDIR /home/zano
COPY --chown=zano:zano --from=zano-build /root/zano/build/src/zanod .
COPY --chown=zano:zano --from=zano-build /root/zano/build/src/simplewallet .
COPY --chown=zano:zano --from=build /root/zano/build/src/zanod .
COPY --chown=zano:zano --from=build /root/zano/build/src/simplewallet .
# blockchain loaction
VOLUME /home/zano/.Zano