Merge pull request #214 from jmacxx/add_tx_timestamp

Add tx_timestamp to resultset in api/outputs
This commit is contained in:
moneroexamples 2020-08-22 11:19:16 +08:00 committed by GitHub
commit 38f2700fd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5406,6 +5406,14 @@ json_outputs(string tx_hash_str,
} // for (pair<txout_to_key, uint64_t>& outp: txd.output_pub_keys) } // for (pair<txout_to_key, uint64_t>& outp: txd.output_pub_keys)
// if we don't already have the tx_timestamp from the mempool
// then read it from the block that the transaction is in
if (!tx_timestamp && txd.blk_height > 0) {
block blk;
mcore->get_block_by_height(txd.blk_height, blk);
tx_timestamp = blk.timestamp;
}
// return parsed values. can be use to double // return parsed values. can be use to double
// check if submited data in the request // check if submited data in the request
// matches to what was used to produce response. // matches to what was used to produce response.
@ -5414,6 +5422,7 @@ json_outputs(string tx_hash_str,
j_data["viewkey"] = pod_to_hex(prv_view_key); j_data["viewkey"] = pod_to_hex(prv_view_key);
j_data["tx_prove"] = tx_prove; j_data["tx_prove"] = tx_prove;
j_data["tx_confirmations"] = txd.no_confirmations; j_data["tx_confirmations"] = txd.no_confirmations;
j_data["tx_timestamp"] = tx_timestamp;
j_response["status"] = "success"; j_response["status"] = "success";