Skip to content

Commit

Permalink
Merge pull request #131 from jl777/dev
Browse files Browse the repository at this point in the history
Update from upstream repo jl777/SuperNET@dev
  • Loading branch information
jl777 authored Aug 10, 2018
2 parents a5816fa + 4f7a1ff commit c24e5e3
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 12 deletions.
2 changes: 1 addition & 1 deletion iguana/dPoW.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
5 changes: 5 additions & 0 deletions iguana/dpow/dpow_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down
22 changes: 15 additions & 7 deletions iguana/dpow/dpow_network.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ( 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 ( 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;
Expand Down
4 changes: 2 additions & 2 deletions iguana/exchanges/LP_ordermatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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 )
Expand Down
6 changes: 4 additions & 2 deletions iguana/exchanges/LP_swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions iguana/iguana_notary.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; i<myinfo->numdpowipbits; 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;
Expand Down
1 change: 1 addition & 0 deletions includes/iguana_apideclares.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c24e5e3

Please sign in to comment.