fix coinbase txs

master
moneroexamples 5 years ago
parent 143018b5aa
commit afca5e9dd6

@ -142,8 +142,18 @@ MicroCore::get_tx(const crypto::hash& tx_hash, transaction& tx)
tx = m_blockchain_storage.get_db().get_tx(tx_hash); tx = m_blockchain_storage.get_db().get_tx(tx_hash);
} }
catch (TX_DNE const& e) catch (TX_DNE const& e)
{
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; cerr << "MicroCore::get_tx: " << e.what() << endl;
}
return false; return false;
} }
} }

@ -4506,11 +4506,6 @@ json_transaction(string tx_hash_str)
no_confirmations = txd.no_confirmations; 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 // get basic tx info
j_data = get_tx_json(tx, txd); j_data = get_tx_json(tx, txd);
@ -6490,7 +6485,15 @@ get_tx_details(const transaction& tx,
tx_details txd; tx_details txd;
// get tx hash // get tx hash
if (!tx.pruned)
{
txd.hash = get_transaction_hash(tx); txd.hash = get_transaction_hash(tx);
}
else
{
txd.hash = get_pruned_transaction_hash(tx, tx.prunable_hash);
}
// get tx public key from extra // get tx public key from extra
// this check if there are two public keys // this check if there are two public keys

Loading…
Cancel
Save