1
0
Fork 0
forked from lthn/blockchain

fixed bug with wrong handling coinbase for auditable wallets

This commit is contained in:
cryptozoidberg 2020-07-22 01:43:01 +02:00
parent fc1e5dfe31
commit 28f8f86860
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
4 changed files with 16 additions and 3 deletions

View file

@ -1739,7 +1739,12 @@ namespace currency
{
CHECK_AND_ASSERT_MES(bl_entry.tx_global_outs.size() == bl_entry.txs.size(), false, "tx_global_outs count " << bl_entry.tx_global_outs.size() << " count missmatch with bl_entry.txs count " << bl_entry.txs.size());
}
if (bl_entry.coinbase_global_outs.size())
{
std::shared_ptr<currency::transaction_chain_entry> tche_ptr(new currency::transaction_chain_entry());
tche_ptr->m_global_output_indexes = bl_entry.coinbase_global_outs;
bdde.coinbase_ptr = tche_ptr;
}
for (const auto& tx_blob : bl_entry.txs)
{
std::shared_ptr<currency::transaction_chain_entry> tche_ptr(new currency::transaction_chain_entry());

View file

@ -29,11 +29,13 @@ namespace currency
{
blobdata block;
std::list<blobdata> txs;
std::vector<uint64_t> coinbase_global_outs;
std::vector<struct_with_one_t_type<std::vector<uint64_t> > > tx_global_outs;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(block)
KV_SERIALIZE(txs)
KV_SERIALIZE(coinbase_global_outs)
KV_SERIALIZE(tx_global_outs)
END_KV_SERIALIZE_MAP()
};

View file

@ -316,7 +316,7 @@ namespace currency
}
blockchain_storage::blocks_direct_container bs;
if (!m_core.get_blockchain_storage().find_blockchain_supplement(req.block_ids, bs, res.current_height, res.start_height, COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT, req.minimum_height))
if (!m_core.get_blockchain_storage().find_blockchain_supplement(req.block_ids, bs, res.current_height, res.start_height, COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT, req.minimum_height, req.need_global_indexes))
{
res.status = API_RETURN_CODE_FAIL;
return false;
@ -328,6 +328,8 @@ namespace currency
res.blocks.back().block = block_to_blob(b.first->bl);
if (req.need_global_indexes)
{
CHECK_AND_ASSERT_MES(b.third.get(), false, "Internal error on handling COMMAND_RPC_GET_BLOCKS_FAST: b.third is empty, ie coinbase info is not prepared");
res.blocks.back().coinbase_global_outs = b.third->m_global_output_indexes;
res.blocks.back().tx_global_outs.resize(b.second.size());
}
size_t i = 0;

View file

@ -11,7 +11,11 @@
#include "core_rpc_proxy.h"
#include "storages/http_abstract_invoke.h"
#define WALLET_RCP_CONNECTION_TIMEOUT 3000
#ifdef NDEBUG
#define WALLET_RCP_CONNECTION_TIMEOUT 5000
#else
#define WALLET_RCP_CONNECTION_TIMEOUT 100000
#endif
#define WALLET_RCP_COUNT_ATTEMNTS 3