fix coinbase txs

This commit is contained in:
moneroexamples 2019-10-20 06:48:22 +08:00
parent 143018b5aa
commit afca5e9dd6
2 changed files with 20 additions and 7 deletions

View file

@ -143,7 +143,17 @@ MicroCore::get_tx(const crypto::hash& tx_hash, transaction& tx)
}
catch (TX_DNE const& e)
{
cerr << "MicroCore::get_tx: " << e.what() << endl;
try
{
// coinbase txs are not considered pruned
tx = m_blockchain_storage.get_db().get_pruned_tx(tx_hash);
return true;
}
catch (TX_DNE const& e)
{
cerr << "MicroCore::get_tx: " << e.what() << endl;
}
return false;
}
}

View file

@ -4506,11 +4506,6 @@ json_transaction(string tx_hash_str)
no_confirmations = txd.no_confirmations;
}
// get tx from tx fetched. can be use to double check
// if what we return in the json response agrees with
// what tx_hash was requested
string tx_hash_str_again = pod_to_hex(get_transaction_hash(tx));
// get basic tx info
j_data = get_tx_json(tx, txd);
@ -6490,7 +6485,15 @@ get_tx_details(const transaction& tx,
tx_details txd;
// get tx hash
txd.hash = get_transaction_hash(tx);
if (!tx.pruned)
{
txd.hash = get_transaction_hash(tx);
}
else
{
txd.hash = get_pruned_transaction_hash(tx, tx.prunable_hash);
}
// get tx public key from extra
// this check if there are two public keys