Skip to content

Commit

Permalink
fix #348 Wrong recive height for pending transaciton, should be 0 as …
Browse files Browse the repository at this point in the history
…before.
  • Loading branch information
xiaozongyuan committed Feb 2, 2019
1 parent 8eebbba commit fa2648b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/metaverse/blockchain/block_chain_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ class BCB_API block_chain_impl
void fired() override;
organizer& get_organizer() override;
bool get_transaction_consider_pool(
chain::transaction& tx, uint64_t& tx_height, const hash_digest& hash);
chain::transaction& tx, uint64_t& tx_height, const hash_digest& hash, bool* is_in_pool=nullptr);
bool get_history(const wallet::payment_address& address,
uint64_t limit, uint64_t from_height, chain::history_compact::list& history);
code validate_transaction(const chain::transaction& tx);
Expand Down
7 changes: 5 additions & 2 deletions src/lib/blockchain/block_chain_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2544,7 +2544,7 @@ organizer& block_chain_impl::get_organizer()
}

bool block_chain_impl::get_transaction_consider_pool(
chain::transaction& tx, uint64_t& tx_height, const hash_digest& hash)
chain::transaction& tx, uint64_t& tx_height, const hash_digest& hash, bool* is_in_pool)
{

bool ret = false;
Expand Down Expand Up @@ -2573,7 +2573,10 @@ bool block_chain_impl::get_transaction_consider_pool(
boost::unique_lock<boost::mutex> lock(mutex);
if(tx_ptr) {
tx = *tx_ptr;
tx_height = max_uint64;
tx_height = 0;
if (is_in_pool) {
*is_in_pool = true;
}
ret = true;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/lib/explorer/extensions/base_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,12 +1013,11 @@ bool base_transfer_common::get_spendable_output(

chain::transaction tx_temp;
uint64_t tx_height;
if (!blockchain_.get_transaction_consider_pool(tx_temp, tx_height, row.output.hash)) {
bool is_in_pool = false;
if (!blockchain_.get_transaction_consider_pool(tx_temp, tx_height, row.output.hash, &is_in_pool)) {
return false;
}

const auto is_in_pool = tx_height == max_uint64;

BITCOIN_ASSERT(row.output.index < tx_temp.outputs.size());
output = tx_temp.outputs.at(row.output.index);

Expand Down

0 comments on commit fa2648b

Please sign in to comment.