mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
json rpc for wallet and bugfix
This commit is contained in:
parent
8efa1313f3
commit
29c2859a3e
43 changed files with 2299 additions and 845 deletions
|
|
@ -16,7 +16,7 @@ namespace
|
|||
const account_public_address& miner_address, std::vector<size_t>& block_sizes, size_t target_tx_size,
|
||||
size_t target_block_size, uint64_t fee = 0)
|
||||
{
|
||||
if (!construct_miner_tx(height, already_generated_coins, miner_address, miner_tx, fee, block_sizes, target_block_size))
|
||||
if (!construct_miner_tx(height, misc_utils::median(block_sizes), already_generated_coins, target_block_size, fee, miner_address, miner_tx))
|
||||
return false;
|
||||
|
||||
size_t current_size = get_object_blobsize(miner_tx);
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ uint64_t test_generator::get_already_generated_coins(const cryptonote::block& bl
|
|||
void test_generator::add_block(const cryptonote::block& blk, size_t tsx_size, std::vector<size_t>& block_sizes, uint64_t already_generated_coins)
|
||||
{
|
||||
const size_t block_size = tsx_size + get_object_blobsize(blk.miner_tx);
|
||||
bool block_too_big;
|
||||
uint64_t block_reward = get_block_reward(block_sizes, block_size, block_too_big, already_generated_coins);
|
||||
uint64_t block_reward;
|
||||
get_block_reward(misc_utils::median(block_sizes), block_size, already_generated_coins, block_reward);
|
||||
m_blocks_info[get_block_hash(blk)] = block_info(blk.prev_id, already_generated_coins + block_reward, block_size);
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ bool test_generator::construct_block(cryptonote::block& blk, uint64_t height, co
|
|||
size_t target_block_size = txs_size + get_object_blobsize(blk.miner_tx);
|
||||
while (true)
|
||||
{
|
||||
if (!construct_miner_tx(height, already_generated_coins, miner_acc.get_keys().m_account_address, blk.miner_tx, total_fee, block_sizes, target_block_size, 10))
|
||||
if (!construct_miner_tx(height, misc_utils::median(block_sizes), already_generated_coins, target_block_size, total_fee, miner_acc.get_keys().m_account_address, blk.miner_tx, blobdata(), 10))
|
||||
return false;
|
||||
|
||||
size_t actual_block_size = txs_size + get_object_blobsize(blk.miner_tx);
|
||||
|
|
@ -209,7 +209,7 @@ bool test_generator::construct_block_manually(block& blk, const block& prev_bloc
|
|||
{
|
||||
size_t current_block_size = txs_sizes + get_object_blobsize(blk.miner_tx);
|
||||
// TODO: This will work, until size of constructed block is less then CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE
|
||||
if (!construct_miner_tx(height, already_generated_coins, miner_acc.get_keys().m_account_address, blk.miner_tx, 0, block_sizes, current_block_size, 1))
|
||||
if (!construct_miner_tx(height, misc_utils::median(block_sizes), already_generated_coins, current_block_size, 0, miner_acc.get_keys().m_account_address, blk.miner_tx, blobdata(), 1))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -496,14 +496,13 @@ bool construct_miner_tx_manually(size_t height, uint64_t already_generated_coins
|
|||
tx.vin.push_back(in);
|
||||
|
||||
// This will work, until size of constructed block is less then CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE
|
||||
std::vector<size_t> block_sizes;
|
||||
bool block_too_big = false;
|
||||
uint64_t block_reward = get_block_reward(block_sizes, 0, block_too_big, already_generated_coins) + fee;
|
||||
if (block_too_big)
|
||||
uint64_t block_reward;
|
||||
if (!get_block_reward(0, 0, already_generated_coins, block_reward))
|
||||
{
|
||||
LOG_PRINT_L0("Block is too big");
|
||||
return false;
|
||||
}
|
||||
block_reward += fee;
|
||||
|
||||
crypto::key_derivation derivation;
|
||||
crypto::public_key out_eph_public_key;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "cryptonote_core/cryptonote_basic_impl.h"
|
||||
#include "cryptonote_core/account.h"
|
||||
#include "cryptonote_core/cryptonote_format_utils.h"
|
||||
#include "misc_language.h"
|
||||
|
||||
using namespace cryptonote;
|
||||
|
||||
|
|
@ -35,19 +36,18 @@ bool test_transaction_generation_and_ring_signature()
|
|||
rv_acc.generate();
|
||||
account_base rv_acc2;
|
||||
rv_acc2.generate();
|
||||
std::vector<size_t> b;
|
||||
transaction tx_mine_1;
|
||||
construct_miner_tx(0, 0, miner_acc1.get_keys().m_account_address, tx_mine_1, 0, b, 10);
|
||||
construct_miner_tx(0, 0, 0, 10, 0, miner_acc1.get_keys().m_account_address, tx_mine_1);
|
||||
transaction tx_mine_2;
|
||||
construct_miner_tx(0, 0, miner_acc2.get_keys().m_account_address, tx_mine_2, 0, b, 0);
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc2.get_keys().m_account_address, tx_mine_2);
|
||||
transaction tx_mine_3;
|
||||
construct_miner_tx(0, 0, miner_acc3.get_keys().m_account_address, tx_mine_3, 0, b, 0);
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc3.get_keys().m_account_address, tx_mine_3);
|
||||
transaction tx_mine_4;
|
||||
construct_miner_tx(0, 0, miner_acc4.get_keys().m_account_address, tx_mine_4, 0, b, 0);
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc4.get_keys().m_account_address, tx_mine_4);
|
||||
transaction tx_mine_5;
|
||||
construct_miner_tx(0, 0, miner_acc5.get_keys().m_account_address, tx_mine_5, 0, b, 0);
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc5.get_keys().m_account_address, tx_mine_5);
|
||||
transaction tx_mine_6;
|
||||
construct_miner_tx(0, 0, miner_acc6.get_keys().m_account_address, tx_mine_6, 0, b, 0);
|
||||
construct_miner_tx(0, 0, 0, 0, 0, miner_acc6.get_keys().m_account_address, tx_mine_6);
|
||||
|
||||
//fill inputs entry
|
||||
typedef tx_source_entry::output_entry tx_output_entry;
|
||||
|
|
@ -111,7 +111,7 @@ bool test_transaction_generation_and_ring_signature()
|
|||
|
||||
std::vector<size_t> outs;
|
||||
uint64_t money = 0;
|
||||
|
||||
|
||||
r = lookup_acc_outs(rv_acc.get_keys(), tx_rc1, get_tx_pub_key_from_extra(tx_rc1), outs, money);
|
||||
CHECK_AND_ASSERT_MES(r, false, "failed to lookup_acc_outs");
|
||||
CHECK_AND_ASSERT_MES(td.amount == money, false, "wrong money amount in new transaction");
|
||||
|
|
@ -130,7 +130,7 @@ bool test_block_creation()
|
|||
bool r = get_account_address_from_str(adr, "0099be99c70ef10fd534c43c88e9d13d1c8853213df7e362afbec0e4ee6fec4948d0c190b58f4b356cd7feaf8d9d0a76e7c7e5a9a0a497a6b1faf7a765882dd08ac2");
|
||||
CHECK_AND_ASSERT_MES(r, false, "failed to import");
|
||||
block b;
|
||||
r = construct_miner_tx(90, 3553616528562147, adr, b.miner_tx, 10000000, szs, 33094, 11);
|
||||
r = construct_miner_tx(90, epee::misc_utils::median(szs), 3553616528562147, 33094, 10000000, adr, b.miner_tx, blobdata(), 11);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue