mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
make it work with master and release-v0.13 branches
This commit is contained in:
parent
f9596d14f5
commit
4bdb7b8b13
3 changed files with 119 additions and 24 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -8,3 +8,4 @@
|
|||
tests/
|
||||
build/
|
||||
cmake-build-debug/
|
||||
.ycm_extra_conf.py
|
||||
|
|
|
@ -93,7 +93,7 @@ Note: `devel` branch of the explorer follows `master` branch of the monero.
|
|||
|
||||
## Compilation on Ubuntu 16.04/18.04
|
||||
|
||||
##### Compile latest Monero version (0.14.0.0)
|
||||
##### Compile latest Monero version (0.14.0.2)
|
||||
|
||||
Download and compile recent Monero into your home folder:
|
||||
|
||||
|
@ -106,8 +106,8 @@ sudo apt install git build-essential cmake libboost-all-dev miniupnpc libunbound
|
|||
# go to home folder
|
||||
cd ~
|
||||
|
||||
# download monero sourced for branch release-v0.13
|
||||
git clone --recursive -b release-v0.13 https://github.com/monero-project/monero.git
|
||||
# download monero sourced for master branch
|
||||
git clone --recursive https://github.com/monero-project/monero.git
|
||||
|
||||
cd monero/
|
||||
|
||||
|
|
136
src/page.h
136
src/page.h
|
@ -35,7 +35,7 @@
|
|||
#include <limits>
|
||||
#include <ctime>
|
||||
#include <future>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
|
||||
#define TMPL_DIR "./templates"
|
||||
|
@ -103,6 +103,43 @@ struct tx_info_cache
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
// helper to ignore any number of template parametrs
|
||||
template<typename...> using VoidT = void;
|
||||
|
||||
// primary template;
|
||||
template<typename, typename = VoidT<>>
|
||||
struct HasSpanInGetOutputKeyT: std::false_type
|
||||
{};
|
||||
|
||||
//partial specialization (myy be SFINAEed away)
|
||||
template <typename T>
|
||||
struct HasSpanInGetOutputKeyT<
|
||||
T,
|
||||
VoidT<decltype(std::declval<T>()
|
||||
.get_output_key(
|
||||
std::declval<const epee::span<const uint64_t>&>(),
|
||||
std::declval<const std::vector<uint64_t>&>(),
|
||||
std::declval<std::vector<cryptonote::output_data_t>&>()))
|
||||
>>: std::true_type
|
||||
{};
|
||||
|
||||
|
||||
// primary template;
|
||||
template<typename, typename = VoidT<>>
|
||||
struct OutputIndicesReturnVectOfVectT : std::false_type
|
||||
{};
|
||||
|
||||
template<typename T>
|
||||
struct OutputIndicesReturnVectOfVectT<
|
||||
T,
|
||||
VoidT<decltype(std::declval<T>()
|
||||
.get_tx_amount_output_indices(
|
||||
uint64_t{}, size_t{})
|
||||
.front().front())
|
||||
>>: std::true_type
|
||||
{};
|
||||
|
||||
// indect overload of hash for tx_info_cache::key
|
||||
namespace std
|
||||
{
|
||||
|
@ -466,7 +503,6 @@ page(MicroCore* _mcore,
|
|||
testnet = nettype == cryptonote::network_type::TESTNET;
|
||||
stagenet = nettype == cryptonote::network_type::STAGENET;
|
||||
|
||||
|
||||
no_of_mempool_tx_of_frontpage = 25;
|
||||
|
||||
// read template files for all the pages
|
||||
|
@ -1720,9 +1756,12 @@ show_ringmembers_hex(string const& tx_hash_str)
|
|||
== false)
|
||||
continue;
|
||||
|
||||
core_storage->get_db().get_output_key(in_key.amount,
|
||||
absolute_offsets,
|
||||
mixin_outputs);
|
||||
//core_storage->get_db().get_output_key(in_key.amount,
|
||||
// absolute_offsets,
|
||||
// mixin_outputs);
|
||||
get_output_key<BlockchainDB>(in_key.amount,
|
||||
absolute_offsets,
|
||||
mixin_outputs);
|
||||
}
|
||||
catch (OUTPUT_DNE const& e)
|
||||
{
|
||||
|
@ -2008,10 +2047,14 @@ show_ringmemberstx_jsonhex(string const& tx_hash_str)
|
|||
in_key.amount, absolute_offsets, indices);
|
||||
|
||||
// get mining ouput info
|
||||
core_storage->get_db().get_output_key(
|
||||
in_key.amount,
|
||||
absolute_offsets,
|
||||
mixin_outputs);
|
||||
//core_storage->get_db().get_output_key(
|
||||
//in_key.amount,
|
||||
//absolute_offsets,
|
||||
//mixin_outputs);
|
||||
|
||||
get_output_key<BlockchainDB>(in_key.amount,
|
||||
absolute_offsets,
|
||||
mixin_outputs);
|
||||
}
|
||||
catch (exception const& e)
|
||||
{
|
||||
|
@ -2524,9 +2567,13 @@ show_my_outputs(string tx_hash_str,
|
|||
if (are_absolute_offsets_good(absolute_offsets, in_key) == false)
|
||||
continue;
|
||||
|
||||
core_storage->get_db().get_output_key(in_key.amount,
|
||||
absolute_offsets,
|
||||
mixin_outputs);
|
||||
//core_storage->get_db().get_output_key(in_key.amount,
|
||||
//absolute_offsets,
|
||||
//mixin_outputs);
|
||||
|
||||
get_output_key<BlockchainDB>(in_key.amount,
|
||||
absolute_offsets,
|
||||
mixin_outputs);
|
||||
}
|
||||
catch (const OUTPUT_DNE& e)
|
||||
{
|
||||
|
@ -4687,9 +4734,13 @@ json_transaction(string tx_hash_str)
|
|||
if (are_absolute_offsets_good(absolute_offsets, in_key) == false)
|
||||
continue;
|
||||
|
||||
core_storage->get_db().get_output_key(in_key.amount,
|
||||
absolute_offsets,
|
||||
outputs);
|
||||
//core_storage->get_db().get_output_key(in_key.amount,
|
||||
//absolute_offsets,
|
||||
//outputs);
|
||||
|
||||
get_output_key<BlockchainDB>(in_key.amount,
|
||||
absolute_offsets,
|
||||
outputs);
|
||||
}
|
||||
catch (const OUTPUT_DNE &e)
|
||||
{
|
||||
|
@ -6363,9 +6414,13 @@ construct_tx_context(transaction tx, uint16_t with_ring_signatures = 0)
|
|||
|
||||
// offsets seems good, so try to get the outputs for the amount and
|
||||
// offsets given
|
||||
core_storage->get_db().get_output_key(in_key.amount,
|
||||
absolute_offsets,
|
||||
outputs);
|
||||
//core_storage->get_db().get_output_key(in_key.amount,
|
||||
//absolute_offsets,
|
||||
//outputs);
|
||||
|
||||
get_output_key<BlockchainDB>(in_key.amount,
|
||||
absolute_offsets,
|
||||
outputs);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
@ -6575,8 +6630,11 @@ construct_tx_context(transaction tx, uint16_t with_ring_signatures = 0)
|
|||
|
||||
if (core_storage->get_db().tx_exists(txd.hash, tx_index))
|
||||
{
|
||||
out_amount_indices = core_storage->get_db()
|
||||
.get_tx_amount_output_indices(tx_index);
|
||||
//out_amount_indices = core_storage->get_db()
|
||||
//.get_tx_amount_output_indices(tx_index).front();
|
||||
get_tx_amount_output_indices<BlockchainDB>(
|
||||
out_amount_indices,
|
||||
tx_index);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -7080,9 +7138,45 @@ add_js_files(mstch::map& context)
|
|||
}};
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
typename std::enable_if<
|
||||
HasSpanInGetOutputKeyT<T>::value, void>::type
|
||||
get_output_key(uint64_t amount, Args&&... args)
|
||||
{
|
||||
core_storage->get_db().get_output_key(
|
||||
epee::span<const uint64_t>(&amount, 1),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
typename std::enable_if<
|
||||
!HasSpanInGetOutputKeyT<T>::value, void>::type
|
||||
get_output_key(uint64_t amount, Args&&... args)
|
||||
{
|
||||
core_storage->get_db().get_output_key(
|
||||
amount, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
typename std::enable_if<
|
||||
!OutputIndicesReturnVectOfVectT<T>::value, void>::type
|
||||
get_tx_amount_output_indices(vector<uint64_t>& out_amount_indices, Args&&... args)
|
||||
{
|
||||
out_amount_indices = core_storage->get_db()
|
||||
.get_tx_amount_output_indices(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
typename std::enable_if<
|
||||
OutputIndicesReturnVectOfVectT<T>::value, void>::type
|
||||
get_tx_amount_output_indices(vector<uint64_t>& out_amount_indices, Args&&... args)
|
||||
{
|
||||
out_amount_indices = core_storage->get_db()
|
||||
.get_tx_amount_output_indices(std::forward<Args>(args)...).front();
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#endif //CROWXMR_PAGE_H
|
||||
|
||||
|
|
Loading…
Reference in a new issue