From 914349db60539f386eb6d6dcb8155a6c2c980423 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Mon, 29 Jul 2019 00:46:56 +0800 Subject: [PATCH] add timestamp to getinfo notarizations --- src/komodo_nSPV.h | 1 + src/komodo_nSPV_defs.h | 1 + src/komodo_nSPV_fullnode.h | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index 9b23cb018..337a61c7f 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -255,6 +255,7 @@ int32_t NSPV_rwntz(int32_t rwflag,uint8_t *serialized,struct NSPV_ntz *ptr) len += iguana_rwbignum(rwflag,&serialized[len],sizeof(ptr->othertxid),(uint8_t *)&ptr->othertxid); len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->height),&ptr->height); len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->txidheight),&ptr->txidheight); + len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->timestamp),&ptr->timestamp); return(len); } diff --git a/src/komodo_nSPV_defs.h b/src/komodo_nSPV_defs.h index 8eeed8292..164ea081a 100644 --- a/src/komodo_nSPV_defs.h +++ b/src/komodo_nSPV_defs.h @@ -110,6 +110,7 @@ struct NSPV_ntz { uint256 blockhash,txid,othertxid; int32_t height,txidheight; + uint32_t timestamp; }; struct NSPV_ntzsresp diff --git a/src/komodo_nSPV_fullnode.h b/src/komodo_nSPV_fullnode.h index 5e4ec0b25..00bd099b3 100644 --- a/src/komodo_nSPV_fullnode.h +++ b/src/komodo_nSPV_fullnode.h @@ -121,7 +121,7 @@ int32_t NSPV_setequihdr(struct NSPV_equihdr *hdr,int32_t height) int32_t NSPV_getinfo(struct NSPV_inforesp *ptr,int32_t reqheight) { - int32_t prevMoMheight,len = 0; CBlockIndex *pindex; struct NSPV_ntzsresp pair; + int32_t prevMoMheight,len = 0; CBlockIndex *pindex, *pindex2; struct NSPV_ntzsresp pair; if ( (pindex= chainActive.LastTip()) != 0 ) { ptr->height = pindex->GetHeight(); @@ -130,6 +130,9 @@ int32_t NSPV_getinfo(struct NSPV_inforesp *ptr,int32_t reqheight) if ( NSPV_getntzsresp(&pair,ptr->height-1) < 0 ) return(-1); ptr->notarization = pair.prevntz; + if ( (pindex2= komodo_chainactive(ptr->notarization.txidheight)) != 0 ) + ptr->notarization.timestamp = pindex->nTime; + fprintf(stderr, "timestamp.%i\n", ptr->notarization.timestamp ); if ( reqheight == 0 ) reqheight = ptr->height; ptr->hdrheight = reqheight;