From fcee4d1518b8c1dd19928d4ce6efab3db413c286 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 3 Dec 2017 23:58:34 +0400 Subject: [PATCH] Test --- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_instantdex.c | 4 ++++ iguana/exchanges/LP_stats.c | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 55f97fe19..218dc7867 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -292,7 +292,7 @@ struct iguana_info portable_mutex_t txmutex,addrmutex; struct LP_transaction *transactions; struct LP_address *addresses; uint64_t txfee; int32_t numutxos,notarized,longestchain,firstrefht,firstscanht,lastscanht,bussock,height; uint16_t busport; - uint32_t loadedcache,electrumlist,lastunspent,importedprivkey,lastpushtime,lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime; + uint32_t dPoWtime,loadedcache,electrumlist,lastunspent,importedprivkey,lastpushtime,lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime; uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag,userconfirms,isassetchain,maxconfirms; char symbol[128],smartaddr[64],userpass[1024],serverport[128]; // portfolio diff --git a/iguana/exchanges/LP_instantdex.c b/iguana/exchanges/LP_instantdex.c index 043d6b50f..2737a0c9e 100644 --- a/iguana/exchanges/LP_instantdex.c +++ b/iguana/exchanges/LP_instantdex.c @@ -468,6 +468,8 @@ cJSON *LP_swapstats_item(struct LP_swapstats *sp,int32_t iambob) jaddnum(item,"bob_dPoWheight",bob->notarized); if ( sp->bobneeds_dPoW == 1 ) flag = 1; + if ( bob->notarized == 0 ) + LP_dPoW_request(bob); } if ( sp->aliceneeds_dPoW != 0 && (alice= LP_coinfind(sp->Q.destcoin)) != 0 ) { @@ -475,6 +477,8 @@ cJSON *LP_swapstats_item(struct LP_swapstats *sp,int32_t iambob) jaddnum(item,"alice_dPoWheight",alice->notarized); if ( sp->aliceneeds_dPoW == 1 ) flag = 1; + if ( alice->notarized == 0 ) + LP_dPoW_request(alice); } if ( flag != 0 ) { diff --git a/iguana/exchanges/LP_stats.c b/iguana/exchanges/LP_stats.c index 5b483d6b5..ab3744c60 100644 --- a/iguana/exchanges/LP_stats.c +++ b/iguana/exchanges/LP_stats.c @@ -42,7 +42,7 @@ void LP_dPoW_request(struct iguana_info *coin) void LP_dPoW_broadcast(struct iguana_info *coin) { bits256 zero; cJSON *reqjson; - if ( coin->isassetchain != 0 || strcmp(coin->symbol,"KMD") == 0 ) + if ( time(NULL) > coin->dPoWtime+60 && (coin->isassetchain != 0 || strcmp(coin->symbol,"KMD") == 0) ) { reqjson = cJSON_CreateObject(); jaddstr(reqjson,"method","dPoW"); @@ -53,6 +53,7 @@ void LP_dPoW_broadcast(struct iguana_info *coin) memset(zero.bytes,0,sizeof(zero)); printf("broadcast %s\n",jprint(reqjson,0)); LP_reserved_msg(0,coin->symbol,coin->symbol,zero,jprint(reqjson,1)); + coin->dPoWtime = (uint32_t)time(NULL); } }