reconstruction of mainnet txs from json is good now.

This commit is contained in:
moneroexamples 2016-12-03 12:05:31 +08:00
parent 13f2505f88
commit 6141f92311
3 changed files with 109 additions and 44 deletions

View File

@ -480,14 +480,14 @@ public:
// @TODO need to make this tx from _tx_info.tx_json
transaction tx;
if (!xmreg::make_tx_from_json(string{}, tx))
{
cerr << "Cant make tx from _tx_info.tx_json" << endl;
return string {"Cant make tx from _tx_info.tx_json"};
}
// // @TODO need to make this tx from _tx_info.tx_json
// transaction tx;
//
// if (!xmreg::make_tx_from_json(string{}, tx))
// {
// cerr << "Cant make tx from _tx_info.tx_json" << endl;
// //return string {"Cant make tx from _tx_info.tx_json"};
// }
// number of last blocks to show

File diff suppressed because one or more lines are too long

View File

@ -275,6 +275,29 @@ get_real_output_for_key_image(const key_image& ki,
uint64_t output_idx,
public_key output_pub_key);
// based on http://stackoverflow.com/a/9943098/248823
template<typename Iterator, typename Func>
void chunks(Iterator begin,
Iterator end,
iterator_traits<string::iterator>::difference_type k,
Func f)
{
Iterator chunk_begin;
Iterator chunk_end;
chunk_end = chunk_begin = begin;
do
{
if(std::distance(chunk_end, end) < k)
chunk_end = end;
else
std::advance(chunk_end, k);
f(chunk_begin,chunk_end);
chunk_begin = chunk_end;
}
while(std::distance(chunk_begin,end) > 0);
}
bool
make_tx_from_json(const string& json_str, transaction& tx);