From 11b017903894b20c5a3ff9f014b3cf8990cd4d6c Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 3 Nov 2018 10:59:28 +0800 Subject: [PATCH] Add is_STAKED function, set staked chains to suppress = 3. --- iguana/dpow/dpow_rpc.c | 2 +- iguana/iguana_notary.c | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/iguana/dpow/dpow_rpc.c b/iguana/dpow/dpow_rpc.c index c1c982622..9c7b5818a 100755 --- a/iguana/dpow/dpow_rpc.c +++ b/iguana/dpow/dpow_rpc.c @@ -289,7 +289,7 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz MoMdepth = (MoMdepth & 0xffff) | ((uint32_t)CCid<<16); n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth); //( ) - if ( ( (strncmp(bp->srccoin->symbol, "STKD", 4) == 0) || (strncmp(bp->srccoin->symbol, "STAKED", 6) == 0) ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) + if ( ( is_STAKED() != 0 ) && src_or_dest == 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) { kmdcoin = bp->destcoin; if ( (infojson= dpow_getinfo(myinfo,kmdcoin)) != 0 ) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index 6dfbb1453..934f3b038 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -58,6 +58,18 @@ void dpow_checkpointset(struct supernet_info *myinfo,struct dpow_checkpoint *che checkpoint->blockhash.height = height; } +int is_STAKED(const char *chain_name) { + int STAKED = 0; + if ( (strcmp(chain_name, "STAKED") == 0) || (strncmp(chain_name, "STAKED", 6) == 0) ) + STAKED = 1; + else if ( (strcmp(chain_name, "STKD") == 0) || (strncmp(chain_name, "STKD", 4) == 0) ) + STAKED = 2; + else if ( (strcmp(chain_name, "CFEK") == 0) || (strncmp(chain_name, "CFEK", 4) == 0) ) + STAKED = 3; + //fprintf(stderr, "This chains is: %s which is: %d\n", chain_name,STAKED); + return(STAKED); +}; + void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t height,bits256 hash,uint32_t timestamp,uint32_t blocktime) { //struct komodo_ccdataMoMoM mdata; cJSON *blockjson; uint64_t signedmask; struct iguana_info *coin; @@ -67,11 +79,12 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he dpow_fifoupdate(myinfo,dp->srcfifo,dp->last); if ( strcmp(dp->dest,"KMD") == 0 ) { - if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+DPOW_CHECKPOINTFREQ ) + int supressfreq = DPOW_CHECKPOINTFREQ; + if ( is_STAKED() != 0 ) { + supressfreq = 3; + } + if ( dp->DESTHEIGHT < dp->prevDESTHEIGHT+supressfreq ) { - if ( (strncmp(dp->symbol, "STKD", 4) == 0) || (strncmp(dp->symbol, "STAKED", 6) == 0) ) - suppress = 0; - else suppress = 1; //fprintf(stderr,"suppress %s -> KMD freq KMD blocks.%d\n",dp->symbol,checkpointfreq); }