From c02de15ef2dcb255f62edefd7ed88a780c9dc6d1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 2 Jul 2019 09:37:20 -1100 Subject: [PATCH] NSPV --- src/komodo_defs.h | 6 +++--- src/komodo_nSPV.h | 6 +++--- src/main.cpp | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/komodo_defs.h b/src/komodo_defs.h index 8f32306d9..784502dc8 100644 --- a/src/komodo_defs.h +++ b/src/komodo_defs.h @@ -336,13 +336,13 @@ int32_t komodo_priceget(int64_t *buf64,int32_t ind,int32_t height,int32_t numblo uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight); int32_t komodo_currentheight(); -struct nSPV_spentinfo +struct NSPV_spentinfo { uint256 txid,spenttxid; int32_t vout,height,spentvin,spentheight; }; -void komodo_nSPV_spentinfoclear(); -struct nSPV_spentinfo komodo_nSPV_spentinfo(uint256 txid,int32_t vout); +void komodo_NSPV_spentinfoclear(); +struct NSPV_spentinfo komodo_NSPV_spentinfo(uint256 txid,int32_t vout); #endif diff --git a/src/komodo_nSPV.h b/src/komodo_nSPV.h index 95ddcd4d6..4fde5b5e0 100644 --- a/src/komodo_nSPV.h +++ b/src/komodo_nSPV.h @@ -199,14 +199,14 @@ void komodo_nSPVresp(CNode *pfrom,std::vector response) // received a r } } -void komodo_nSPV_spentinfoclear() +void komodo_NSPV_spentinfoclear() { NSPV_spends.resize(0); } -struct nSPV_spentinfo komodo_nSPV_spentinfo(uint256 txid,int32_t vout) // just a primitive example of how to add new rpc to p2p msg +struct NSPV_spentinfo komodo_NSPV_spentinfo(uint256 txid,int32_t vout) // just a primitive example of how to add new rpc to p2p msg { - std::vector request; struct nSPV_spentinfo I; int32_t i,numsent = 0; uint32_t timestamp = (uint32_t)time(NULL); + std::vector request; struct NSPV_spentinfo I; int32_t i,numsent = 0; uint32_t timestamp = (uint32_t)time(NULL); // lookup spentinfo for (i=0; iSetRecvVersion(min(pfrom->nVersion, PROTOCOL_VERSION)); + if ( KOMODO_NSPV != 0 && (pfrom->nServices & NODE_NSPV) == 0 ) + { + fprintf(stderr,"invalid nSPV peer.%d\n",pfrom->id); + pfrom->fDisconnect = true; + return false; + } // Mark this node as currently connected, so we update its timestamp later. if (pfrom->fNetworkNode) { LOCK(cs_main);