Merge pull request #3138

19ff243f wallets: reorg 61 more days on testnet (moneromooo-monero)
c70f03ca blockchain: move bulletproofs to v8 (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-02-14 12:49:57 +01:00
commit 370b43d12b
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
2 changed files with 12 additions and 13 deletions

View file

@ -127,7 +127,8 @@ static const struct {
{ 5, 802660, 0, 1472415036 + 86400*180 }, // add 5 months on testnet to shut the update warning up since there's a large gap to v6
{ 6, 971400, 0, 1501709789 },
{ 7, 1057028, 0, 1512211236 },
{ 7, 1057027, 0, 1512211236 },
{ 8, 1057058, 0, 1515967497 },
};
static const uint64_t testnet_hard_fork_version_1_till = 624633;
@ -2395,11 +2396,11 @@ bool Blockchain::check_tx_outputs(const transaction& tx, tx_verification_context
}
}
// from v7, allow bulletproofs
if (hf_version < 7 || !m_testnet) {
// from v8, allow bulletproofs
if (hf_version < 8) {
if (!tx.rct_signatures.p.bulletproofs.empty())
{
MERROR("Bulletproofs are not allowed before v7 or on mainnet");
MERROR("Bulletproofs are not allowed before v8");
tvc.m_invalid_output = true;
return false;
}

View file

@ -532,12 +532,9 @@ size_t estimate_tx_size(bool use_rct, int n_inputs, int mixin, int n_outputs, si
return n_inputs * (mixin+1) * APPROXIMATE_INPUT_BYTES + extra_size;
}
uint8_t get_bulletproof_fork(bool testnet)
uint8_t get_bulletproof_fork()
{
if (testnet)
return 7;
else
return 255; // TODO
return 8;
}
crypto::hash8 get_short_payment_id(const tools::wallet2::pending_tx &ptx)
@ -6642,7 +6639,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
uint64_t needed_fee, available_for_fee = 0;
uint64_t upper_transaction_size_limit = get_upper_transaction_size_limit();
const bool use_rct = use_fork_rules(4, 0);
const bool bulletproof = use_fork_rules(get_bulletproof_fork(m_testnet), 0);
const bool bulletproof = use_fork_rules(get_bulletproof_fork(), 0);
const uint64_t fee_per_kb = get_per_kb_fee();
const uint64_t fee_multiplier = get_fee_multiplier(priority, get_fee_algorithm());
@ -7151,7 +7148,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_from(const crypton
std::vector<std::vector<get_outs_entry>> outs;
const bool use_rct = fake_outs_count > 0 && use_fork_rules(4, 0);
const bool bulletproof = use_fork_rules(get_bulletproof_fork(m_testnet), 0);
const bool bulletproof = use_fork_rules(get_bulletproof_fork(), 0);
const uint64_t fee_per_kb = get_per_kb_fee();
const uint64_t fee_multiplier = get_fee_multiplier(priority, get_fee_algorithm());
@ -8354,8 +8351,9 @@ uint64_t wallet2::get_approximate_blockchain_height() const
// Calculated blockchain height
uint64_t approx_blockchain_height = fork_block + (time(NULL) - fork_time)/seconds_per_block;
// testnet got some huge rollbacks, so the estimation is way off
if (m_testnet && approx_blockchain_height > 105000)
approx_blockchain_height -= 105000;
static const uint64_t approximate_testnet_rolled_back_blocks = 148540;
if (m_testnet && approx_blockchain_height > approximate_testnet_rolled_back_blocks)
approx_blockchain_height -= approximate_testnet_rolled_back_blocks;
LOG_PRINT_L2("Calculated blockchain height: " << approx_blockchain_height);
return approx_blockchain_height;
}