1
0
Fork 0
forked from lthn/blockchain

minor improvement to transition_convert, daemon_commands_handler fixed

This commit is contained in:
sowle 2022-05-26 22:25:19 +02:00
parent 57a65cee3e
commit fdadd238b4
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
3 changed files with 15 additions and 6 deletions

View file

@ -100,11 +100,12 @@ bool transition_convert(const transaction_current_t& from, transaction_v1& to)
}
return true;
}
template<typename transaction_current_t>
bool transition_convert(const transaction_v1& from, transaction_current_t& to)
{
// TODO: consider using move semantic for 'from'
to.attachment = from.attachment;
to.signature = NLSAG_sig();
boost::get<NLSAG_sig>(to.signature).s = from.signatures;
to.signature = NLSAG_sig({from.signatures});
return true;
}
}

View file

@ -663,11 +663,18 @@ private:
auto ptx = bcs.get_tx(h);
CHECK_AND_ASSERT_MES(ptx != nullptr, false, "failed to find transaction " << h << " in blockchain index, in block on height = " << height);
if (ptx->signatures.size() == 0)
pruned_txs += 1;
VARIANT_SWITCH_BEGIN(ptx->signature);
VARIANT_CASE(currency::NLSAG_sig, nlsag)
{
if (nlsag.s.size() == 0)
pruned_txs += 1;
signatures += nlsag.s.size();
}
VARIANT_CASE(currency::zarcanum_sig, zs);
// @#@
VARIANT_SWITCH_END();
txs += 1;
signatures += ptx->signatures.size();
attachments += ptx->attachment.size();
}
}

View file

@ -235,6 +235,7 @@ struct transition_t<false, destination_t>
template <typename archive, typename origin_type>
static bool chain_serialize(archive &ar, origin_type& origin_tx)
{
// TODO: consider using move semantic for temporary 'dst_tx'
destination_t dst_tx = AUTO_VAL_INIT(dst_tx);
bool r = dst_tx.do_serialize(ar);
if (!r) return r;