From f639419680ba0f7d25ff082e83769864e80139a5 Mon Sep 17 00:00:00 2001 From: jmacxx <47253594+jmacxx@users.noreply.github.com> Date: Fri, 21 Aug 2020 19:45:20 -0500 Subject: [PATCH] Add tx_timestamp to resultset in api/outputs This would enable the caller to validate that the trade date is not older than expected. --- src/page.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/page.h b/src/page.h index 7f9a5ce..77a047c 100644 --- a/src/page.h +++ b/src/page.h @@ -5406,6 +5406,14 @@ json_outputs(string tx_hash_str, } // for (pair& 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 // check if submited data in the request // 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["tx_prove"] = tx_prove; j_data["tx_confirmations"] = txd.no_confirmations; + j_data["tx_timestamp"] = tx_timestamp; j_response["status"] = "success";