From 0c8f9b372921e1aa37a94b40ac35181b5583a831 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 25 Jul 2019 04:29:07 -1100 Subject: [PATCH] Add version field --- src/komodo_nSPV.h | 1 + src/komodo_nSPV_defs.h | 2 ++ src/komodo_nSPV_fullnode.h | 1 + src/komodo_nSPV_superlite.h | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index 9b23cb018..f88afd6c1 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -286,6 +286,7 @@ int32_t NSPV_rwinforesp(int32_t rwflag,uint8_t *serialized,struct NSPV_inforesp len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->height),&ptr->height); len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->hdrheight),&ptr->hdrheight); len += NSPV_rwequihdr(rwflag,&serialized[len],&ptr->H); + len += iguana_rwnum(rwflag,&serialized[len],sizeof(ptr->version),&ptr->version); //fprintf(stderr,"hdr rwlen.%d\n",len); return(len); } diff --git a/src/komodo_nSPV_defs.h b/src/komodo_nSPV_defs.h index 8eeed8292..a27af170b 100644 --- a/src/komodo_nSPV_defs.h +++ b/src/komodo_nSPV_defs.h @@ -17,6 +17,7 @@ #ifndef KOMODO_NSPV_DEFSH #define KOMODO_NSPV_DEFSH +#define NSPV_PROTOCOL_VERSION 0x0001 #define NSPV_POLLITERS 100 #define NSPV_POLLMICROS 30000 #define NSPV_MAXVINS 64 @@ -124,6 +125,7 @@ struct NSPV_inforesp uint256 blockhash; int32_t height,hdrheight; struct NSPV_equihdr H; + uint32_t version; }; struct NSPV_txproof diff --git a/src/komodo_nSPV_fullnode.h b/src/komodo_nSPV_fullnode.h index 5e4ec0b25..897762c3a 100644 --- a/src/komodo_nSPV_fullnode.h +++ b/src/komodo_nSPV_fullnode.h @@ -133,6 +133,7 @@ int32_t NSPV_getinfo(struct NSPV_inforesp *ptr,int32_t reqheight) if ( reqheight == 0 ) reqheight = ptr->height; ptr->hdrheight = reqheight; + ptr->version = NSPV_PROTOCOL_VERSION; if ( NSPV_setequihdr(&ptr->H,reqheight) < 0 ) return(-1); return(sizeof(*ptr)); diff --git a/src/komodo_nSPV_superlite.h b/src/komodo_nSPV_superlite.h index d7f11c41b..316a51e45 100644 --- a/src/komodo_nSPV_superlite.h +++ b/src/komodo_nSPV_superlite.h @@ -139,7 +139,7 @@ void komodo_nSPVresp(CNode *pfrom,std::vector response) // received a r switch ( response[0] ) { case NSPV_INFORESP: - //fprintf(stderr,"got info response %u size.%d height.%d\n",timestamp,(int32_t)response.size(),NSPV_inforesult.height); // update current height and ntrz status + fprintf(stderr,"got version.%d info response %u size.%d height.%d\n",NSPV_inforesult.version,timestamp,(int32_t)response.size(),NSPV_inforesult.height); // update current height and ntrz status I = NSPV_inforesult; NSPV_inforesp_purge(&NSPV_inforesult); NSPV_rwinforesp(0,&response[1],&NSPV_inforesult);