From 89175a6ed84b83cc44b151e1f2f52a22e9be2c95 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 10 Aug 2018 02:51:33 -1100 Subject: [PATCH 1/5] +print --- iguana/exchanges/LP_ordermatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 563277f4b..eb9f4766c 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -1611,7 +1611,7 @@ int32_t LP_tradecommand(int32_t from_mpnet,void *ctx,char *myipaddr,int32_t pubs if ( i == sizeof(rqs)/sizeof(*rqs) ) i = (rand() % (sizeof(rqs)/sizeof(*rqs))); rqs[i] = rq; -//printf("CONNECTED.(%s)\n",jprint(argjson,0)); +printf("CONNECTED.(%s)\n",jprint(argjson,0)); if ( (proof= jarray(&num,argjson,"proof")) != 0 && num > 0 ) Q.othercredits = LP_instantdex_proofcheck(Q.srccoin,Q.coinaddr,proof,num); if ( Qtrades == 0 ) @@ -1665,7 +1665,7 @@ int32_t LP_tradecommand(int32_t from_mpnet,void *ctx,char *myipaddr,int32_t pubs if ( i == sizeof(rqs)/sizeof(*rqs) ) i = (rand() % (sizeof(rqs)/sizeof(*rqs))); rqs[i] = rq; - //printf("CONNECT.(%s)\n",jprint(argjson,0)); + printf("CONNECT.(%s)\n",jprint(argjson,0)); if ( (proof= jarray(&num,argjson,"proof")) != 0 && num > 0 ) Q.othercredits = LP_instantdex_proofcheck(Q.destcoin,Q.destaddr,proof,num); if ( Qtrades == 0 ) From b22123504b378a5b0add7816a171eab663f1e33f Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 10 Aug 2018 03:05:00 -1100 Subject: [PATCH 2/5] Attempt to fix deckers 00 bug --- iguana/dpow/dpow_network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index a2b2bb01d..23ab5a9c5 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -1869,13 +1869,13 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru return; if ( bp->isratify == 0 && bp->state != 0xffffffff && senderind >= 0 && senderind < bp->numnotaries && bits256_nonz(srcutxo) != 0 && bits256_nonz(destutxo) != 0 ) { - if ( bits256_nonz(srcutxo) != 0 ) + if ( senderind != bp->myind && bits256_nonz(srcutxo) != 0 ) { bp->notaries[senderind].src.prev_hash = srcutxo; bp->notaries[senderind].src.prev_vout = srcvout; //char str[65]; printf("%s senderind.%d <- %s/v%d\n",dp->symbol,senderind,bits256_str(str,srcutxo),srcvout); } - if ( bits256_nonz(destutxo) != 0 ) + if ( senderind != bp->myind && bits256_nonz(destutxo) != 0 ) { bp->notaries[senderind].dest.prev_hash = destutxo; bp->notaries[senderind].dest.prev_vout = destvout; From 4c12f8623991b2dc941071bb1d1ff742457eb64b Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 10 Aug 2018 03:24:15 -1100 Subject: [PATCH 3/5] Mysrc/dest utxo --- iguana/dPoW.h | 2 +- iguana/dpow/dpow_fsm.c | 5 +++++ iguana/dpow/dpow_network.c | 22 +++++++++++++++------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/iguana/dPoW.h b/iguana/dPoW.h index f4cb5ebed..bc343f144 100755 --- a/iguana/dPoW.h +++ b/iguana/dPoW.h @@ -109,7 +109,7 @@ struct dpow_recvdata { uint64_t recvmask,bestmask; int8_t bestk; }; struct dpow_block { - bits256 hashmsg,desttxid,srctxid,beacon,commit,MoM; + bits256 hashmsg,desttxid,srctxid,beacon,commit,MoM,mysrcutxo,mydestutxo; struct iguana_info *srccoin,*destcoin; char *opret_symbol; uint64_t destsigsmasks[DPOW_MAXRELAYS],srcsigsmasks[DPOW_MAXRELAYS]; uint64_t recvmask,bestmask,ratifybestmask,ratifyrecvmask,pendingbestmask,pendingratifybestmask,ratifysigmasks[2]; diff --git a/iguana/dpow/dpow_fsm.c b/iguana/dpow/dpow_fsm.c index 4301f8c3a..c531c27a7 100755 --- a/iguana/dpow/dpow_fsm.c +++ b/iguana/dpow/dpow_fsm.c @@ -488,6 +488,11 @@ void dpow_statemachinestart(void *ptr) bp->notaries[myind].ratifydestutxo = ep->dest.prev_hash; bp->notaries[myind].ratifydestvout = ep->dest.prev_vout; } + else + { + bp->mysrcutxo = ep->src.prev_hash; + bp->mydestutxo = ep->dest.prev_hash; + } } /*if ( strcmp(dp->symbol,"CHIPS") == 0 && myind == 0 ) { diff --git a/iguana/dpow/dpow_network.c b/iguana/dpow/dpow_network.c index 23ab5a9c5..fb8300d80 100755 --- a/iguana/dpow/dpow_network.c +++ b/iguana/dpow/dpow_network.c @@ -1869,16 +1869,24 @@ void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,stru return; if ( bp->isratify == 0 && bp->state != 0xffffffff && senderind >= 0 && senderind < bp->numnotaries && bits256_nonz(srcutxo) != 0 && bits256_nonz(destutxo) != 0 ) { - if ( senderind != bp->myind && bits256_nonz(srcutxo) != 0 ) + if ( bp->myind != senderind ) { - bp->notaries[senderind].src.prev_hash = srcutxo; - bp->notaries[senderind].src.prev_vout = srcvout; - //char str[65]; printf("%s senderind.%d <- %s/v%d\n",dp->symbol,senderind,bits256_str(str,srcutxo),srcvout); + if ( bits256_nonz(srcutxo) != 0 ) + { + bp->notaries[senderind].src.prev_hash = srcutxo; + bp->notaries[senderind].src.prev_vout = srcvout; + //char str[65]; printf("%s senderind.%d <- %s/v%d\n",dp->symbol,senderind,bits256_str(str,srcutxo),srcvout); + } + if ( bits256_nonz(destutxo) != 0 ) + { + bp->notaries[senderind].dest.prev_hash = destutxo; + bp->notaries[senderind].dest.prev_vout = destvout; + } } - if ( senderind != bp->myind && bits256_nonz(destutxo) != 0 ) + else { - bp->notaries[senderind].dest.prev_hash = destutxo; - bp->notaries[senderind].dest.prev_vout = destvout; + bp->notaries[bp->myind].src.prev_hash = bp->mysrcutxo; + bp->notaries[bp->myind].dest.prev_hash = bp->mydestutxo; } if ( bestmask != 0 ) bp->notaries[senderind].bestmask = bestmask; From cacf5457b83821107584721cb0463f30f922e553 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 10 Aug 2018 04:04:55 -1100 Subject: [PATCH 4/5] Remove 13 second sleep for 0conf --- iguana/exchanges/LP_swap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index 746f9e1cd..e5de198db 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -945,7 +945,8 @@ void LP_bobloop(void *_swap) LP_swap_endcritical = (uint32_t)time(NULL); if ( err < 0 ) LP_failedmsg(swap->I.req.requestid,swap->I.req.quoteid,err,swap->uuidstr); - sleep(13); + if ( swap->I.aliceconfirms > 0 ) + sleep(13); LP_pendswap_add(swap->I.expiration,swap->I.req.requestid,swap->I.req.quoteid); //swap->I.finished = LP_swapwait(swap->I.expiration,swap->I.req.requestid,swap->I.req.quoteid,LP_atomic_locktime(swap->I.bobstr,swap->I.alicestr)*3,swap->I.aliceconfirms == 0 ? 3 : 30); basilisk_swap_finished(swap); @@ -1041,7 +1042,8 @@ void LP_aliceloop(void *_swap) LP_swap_endcritical = (uint32_t)time(NULL); if ( err < 0 ) LP_failedmsg(swap->I.req.requestid,swap->I.req.quoteid,err,swap->uuidstr); - sleep(13); + if ( swap->I.bobconfirms > 0 ) + sleep(13); LP_pendswap_add(swap->I.expiration,swap->I.req.requestid,swap->I.req.quoteid); //swap->I.finished = LP_swapwait(swap->I.expiration,swap->I.req.requestid,swap->I.req.quoteid,LP_atomic_locktime(swap->I.bobstr,swap->I.alicestr)*3,swap->I.aliceconfirms == 0 ? 3 : 30); basilisk_swap_finished(swap); From 3090fd0d9c6c153c98a6899a9ec6fc41641901de Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 10 Aug 2018 04:15:30 -1100 Subject: [PATCH 5/5] dpow ipaddrs --- iguana/iguana_notary.c | 12 ++++++++++++ includes/iguana_apideclares.h | 1 + 2 files changed, 13 insertions(+) diff --git a/iguana/iguana_notary.c b/iguana/iguana_notary.c index db3808263..d51d6de0d 100755 --- a/iguana/iguana_notary.c +++ b/iguana/iguana_notary.c @@ -956,6 +956,18 @@ ZERO_ARGS(dpow,cancelratify) return(clonestr("{\"result\":\"queued dpow cancel ratify\"}")); } +ZERO_ARGS(dpow,ipaddrs) +{ + char ipaddr[64]; cJSON *array; int32_t i; + array = cJSON_CreateArray(); + for (i=0; inumdpowipbits; i++) + { + expand_ipbits(ipaddr,myinfo->dpowipbits[i]); + jaddistr(array,ipaddr); + } + return(jprint(array,1)); +} + TWOINTS_AND_ARRAY(dpow,ratify,minsigs,timestamp,ratified) { void **ptrs; bits256 zero; int32_t i; char *source; struct dpow_checkpoint checkpoint; diff --git a/includes/iguana_apideclares.h b/includes/iguana_apideclares.h index 46db910d3..e8111a12a 100755 --- a/includes/iguana_apideclares.h +++ b/includes/iguana_apideclares.h @@ -27,6 +27,7 @@ TWOINTS_AND_ARRAY(dpow,ratify,minsigs,timestamp,ratified); ZERO_ARGS(dpow,cancelratify); STRING_ARG(dpow,bindaddr,ipaddr); STRING_AND_INT(dpow,fundnotaries,symbol,numblocks); +ZERO_ARGS(dpow,ipaddrs); ZERO_ARGS(pax,start); INT_ARG(passthru,paxfiats,mask);