forked from lthn/blockchain
code clean-up and minor improvements
This commit is contained in:
parent
a12fd42a8e
commit
2e75597365
5 changed files with 11 additions and 12 deletions
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#define VARIANT_SWITCH_END() } }
|
||||
|
||||
#define VARIANT_OBJ_TYPENAME local_reference_eokcmeokmeokcm.type().name()
|
||||
|
||||
/*
|
||||
|
||||
|
|
|
|||
|
|
@ -1314,8 +1314,8 @@ wide_difficulty_type blockchain_storage::get_next_difficulty_for_alternative_cha
|
|||
//------------------------------------------------------------------
|
||||
bool blockchain_storage::prevalidate_miner_transaction(const block& b, uint64_t height, bool pos) const
|
||||
{
|
||||
CHECK_AND_ASSERT_MES((pos ? (b.miner_tx.vin.size() == 2) : (b.miner_tx.vin.size() == 1)), false, "coinbase transaction in the block has no inputs");
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.vin[0].type() == typeid(txin_gen), false, "coinbase transaction in the block has the wrong type");
|
||||
CHECK_AND_ASSERT_MES((pos ? (b.miner_tx.vin.size() == 2) : (b.miner_tx.vin.size() == 1)), false, "coinbase transaction in the block has incorrect inputs number: " << b.miner_tx.vin.size());
|
||||
CHECK_AND_ASSERT_MES(b.miner_tx.vin[0].type() == typeid(txin_gen), false, "input #0 of the coinbase transaction in the block has the wrong type : " << b.miner_tx.vin[0].type().name());
|
||||
if(boost::get<txin_gen>(b.miner_tx.vin[0]).height != height)
|
||||
{
|
||||
LOG_PRINT_RED_L0("The miner transaction in block has invalid height: " << boost::get<txin_gen>(b.miner_tx.vin[0]).height << ", expected: " << height);
|
||||
|
|
@ -1341,8 +1341,6 @@ bool blockchain_storage::prevalidate_miner_transaction(const block& b, uint64_t
|
|||
}
|
||||
else
|
||||
{
|
||||
//------------------------------------------------------------------
|
||||
//bool blockchain_storage::
|
||||
// pre-hard fork rules that don't allow different unlock time in coinbase outputs
|
||||
uint64_t max_unlock_time = 0;
|
||||
uint64_t min_unlock_time = 0;
|
||||
|
|
|
|||
|
|
@ -3118,12 +3118,12 @@ namespace currency
|
|||
return true;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool check_money_overflow(const transaction& tx)
|
||||
bool check_bare_money_overflow(const transaction& tx)
|
||||
{
|
||||
return check_inputs_overflow(tx) && check_outs_overflow(tx);
|
||||
return check_bare_inputs_overflow(tx) && check_bare_outs_overflow(tx);
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
bool check_inputs_overflow(const transaction& tx)
|
||||
bool check_bare_inputs_overflow(const transaction& tx)
|
||||
{
|
||||
uint64_t money = 0;
|
||||
for(const auto& in : tx.vin)
|
||||
|
|
@ -3160,7 +3160,7 @@ namespace currency
|
|||
return true;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
bool check_outs_overflow(const transaction& tx)
|
||||
bool check_bare_outs_overflow(const transaction& tx)
|
||||
{
|
||||
uint64_t money = 0;
|
||||
for(const auto& o : tx.vout)
|
||||
|
|
|
|||
|
|
@ -414,9 +414,9 @@ namespace currency
|
|||
uint64_t get_alias_coast_from_fee(const std::string& alias, uint64_t fee_median);
|
||||
//const crypto::public_key get_offer_secure_key_by_index_from_tx(const transaction& tx, size_t index);
|
||||
|
||||
bool check_money_overflow(const transaction& tx);
|
||||
bool check_outs_overflow(const transaction& tx);
|
||||
bool check_inputs_overflow(const transaction& tx);
|
||||
bool check_bare_money_overflow(const transaction& tx);
|
||||
bool check_bare_outs_overflow(const transaction& tx);
|
||||
bool check_bare_inputs_overflow(const transaction& tx);
|
||||
uint64_t get_block_height(const transaction& coinbase);
|
||||
uint64_t get_block_height(const block& b);
|
||||
std::vector<txout_ref_v> relative_output_offsets_to_absolute(const std::vector<txout_ref_v>& off);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ namespace currency
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!check_money_overflow(tx))
|
||||
if (!check_bare_money_overflow(tx))
|
||||
{
|
||||
LOG_PRINT_RED_L0("tx has money overflow, rejected for tx id= " << get_transaction_hash(tx));
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue