forked from lthn/blockchain
hf4 mandatory check for decoy size
This commit is contained in:
parent
f874a5f7a2
commit
90c7b5d02d
4 changed files with 26 additions and 0 deletions
|
|
@ -5814,6 +5814,7 @@ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transacti
|
|||
|
||||
// TODO @#@# consider: 1) tx.proofs, 2) new proof data structures
|
||||
|
||||
|
||||
if (var_is_after_hardfork_4_zone)
|
||||
{
|
||||
CHECK_AND_ASSERT_MES(tx.version > TRANSACTION_VERSION_PRE_HF4, false, "HF4: tx with version " << tx.version << " is not allowed");
|
||||
|
|
@ -5825,6 +5826,10 @@ bool blockchain_storage::validate_tx_for_hardfork_specific_terms(const transacti
|
|||
{
|
||||
return false;
|
||||
}
|
||||
uint64_t keys_count = get_hf4_inputs_key_offsets_count(tx);
|
||||
if (keys_count != 0 && keys_count - 1 < CURRENCY_HF4_MANDATORY_DECOY_SET_SIZE)
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#define CURRENT_BLOCK_MAJOR_VERSION 3
|
||||
|
||||
#define CURRENCY_DEFAULT_DECOY_SET_SIZE 10
|
||||
#define CURRENCY_HF4_MANDATORY_DECOY_SET_SIZE 15
|
||||
|
||||
#define CURRENT_BLOCK_MINOR_VERSION 0
|
||||
#define CURRENCY_BLOCK_FUTURE_TIME_LIMIT 60*60*2
|
||||
|
|
|
|||
|
|
@ -3751,6 +3751,25 @@ namespace currency
|
|||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
//if return 0 -> no txin_zc_input seen
|
||||
uint64_t get_hf4_inputs_key_offsets_count(const transaction& tx)
|
||||
{
|
||||
uint64_t key_offsets_count = 0;
|
||||
|
||||
for (const auto& e : tx.vin)
|
||||
{
|
||||
if (e.type() != typeid(txin_zc_input))
|
||||
continue;
|
||||
|
||||
if (boost::get<txin_zc_input>(e).key_offsets.size() > key_offsets_count)
|
||||
{
|
||||
key_offsets_count = boost::get<txin_zc_input>(e).key_offsets.size();
|
||||
}
|
||||
}
|
||||
|
||||
return key_offsets_count;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
bool check_native_coins_amount_burnt_in_outs(const transaction& tx, const uint64_t amount, uint64_t* p_amount_burnt /* = nullptr */)
|
||||
{
|
||||
if (tx.version <= TRANSACTION_VERSION_PRE_HF4)
|
||||
|
|
|
|||
|
|
@ -421,6 +421,7 @@ namespace currency
|
|||
bool add_padding_to_tx(transaction& tx, size_t count);
|
||||
bool is_service_tx(const transaction& tx);
|
||||
bool does_tx_have_only_mixin_inputs(const transaction& tx);
|
||||
uint64_t get_hf4_inputs_key_offsets_count(const transaction& tx);
|
||||
bool is_showing_sender_addres(const transaction& tx);
|
||||
bool check_native_coins_amount_burnt_in_outs(const transaction& tx, const uint64_t amount, uint64_t* p_amount_burnt = nullptr);
|
||||
std::string print_stake_kernel_info(const stake_kernel& sk);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue