Browse Source

Run silent

etomic
jl777 8 years ago
parent
commit
ecc9a8db65
  1. 13
      basilisk/basilisk.c
  2. 27
      basilisk/jumblr.c
  3. 9
      iguana/dpow/dpow_rpc.c
  4. 2
      iguana/iguana777.h
  5. 2
      includes/iguana_apideclares.h

13
basilisk/basilisk.c

@ -1395,6 +1395,18 @@ STRING_ARG(jumblr,setpassphrase,passphrase)
}
}
ZERO_ARGS(jumblr,runsilent)
{
myinfo->runsilent = 1;
return(clonestr("{\"result\":\"success\",\"mode\":\"runsilent\"}"));
}
ZERO_ARGS(jumblr,totransparent)
{
myinfo->runsilent = 0;
return(clonestr("{\"result\":\"success\",\"mode\":\"totransparent\"}"));
}
ZERO_ARGS(jumblr,status)
{
cJSON *retjson; char KMDaddr[64],BTCaddr[64]; struct jumblr_item *ptr,*tmp; struct iguana_info *coinbtc; int64_t received,deposited,jumblred,step_t2z,step_z2z,step_z2t,finished,pending,maxval,minval;
@ -1404,6 +1416,7 @@ ZERO_ARGS(jumblr,status)
retjson = cJSON_CreateObject();
step_t2z = step_z2z = step_z2t = deposited = finished = pending = 0;
jumblr_privkey(myinfo,BTCaddr,0,KMDaddr,JUMBLR_DEPOSITPREFIX);
jaddstr(retjson,"mode",myinfo->runsilent == 0 ? "totransparent" : "runsilent");
jaddstr(retjson,"KMDdeposit",KMDaddr);
jaddstr(retjson,"BTCdeposit",BTCaddr);
if ( (coinbtc= iguana_coinfind("BTC")) != 0 )

27
basilisk/jumblr.c

@ -697,11 +697,11 @@ void jumblr_CMCname(char *CMCname,char *symbol)
void jumblr_DEXcheck(struct supernet_info *myinfo,struct iguana_info *coin,int32_t toKMD)
{
double vol,avail; int32_t enabled = 0; struct iguana_info *kmdcoin,*coinbtc = 0;
kmdcoin = iguana_coinfind("KMD");
coinbtc = iguana_coinfind("BTC");
//printf("jumblr_DEXcheck numswaps.%d notary.%d IAMLP.%d %p %p %f\n",myinfo->numswaps,myinfo->IAMNOTARY,myinfo->IAMLP,kmdcoin,coinbtc,kmdcoin->DEXinfo.btcprice);
if ( myinfo->IAMNOTARY != 0 || myinfo->IAMLP != 0 || myinfo->secret[0] == 0 )
return;
kmdcoin = iguana_coinfind("KMD");
coinbtc = iguana_coinfind("BTC");
if ( kmdcoin == 0 || coinbtc == 0 )
return;
jumblr_DEXupdate(myinfo,kmdcoin,"KMD","komodo",0.,0.);
@ -847,21 +847,24 @@ void jumblr_iteration(struct supernet_info *myinfo,struct iguana_info *coin,int3
}
break;
case 2: // z -> public
jumblr_opidsupdate(myinfo,coin);
HASH_ITER(hh,myinfo->jumblrs,ptr,tmp)
if ( myinfo->runsilent == 0 )
{
if ( jumblr_addresstype(myinfo,coin,ptr->src) == 'z' && jumblr_addresstype(myinfo,coin,ptr->dest) == 'z' )
jumblr_opidsupdate(myinfo,coin);
HASH_ITER(hh,myinfo->jumblrs,ptr,tmp)
{
if ( (r & 1) == 0 && ptr->spent == 0 && (total= jumblr_balance(myinfo,coin,ptr->dest)) >= (fee + JUMBLR_FEE)*SATOSHIDEN )
if ( jumblr_addresstype(myinfo,coin,ptr->src) == 'z' && jumblr_addresstype(myinfo,coin,ptr->dest) == 'z' )
{
privkey = jumblr_privkey(myinfo,BTCaddr,0,KMDaddr,"");
if ( (retstr= jumblr_sendz_to_t(myinfo,coin,ptr->dest,KMDaddr,dstr(total))) != 0 )
if ( (r & 1) == 0 && ptr->spent == 0 && (total= jumblr_balance(myinfo,coin,ptr->dest)) >= (fee + JUMBLR_FEE)*SATOSHIDEN )
{
printf("sendz_to_t.(%s)\n",retstr);
free(retstr);
privkey = jumblr_privkey(myinfo,BTCaddr,0,KMDaddr,"");
if ( (retstr= jumblr_sendz_to_t(myinfo,coin,ptr->dest,KMDaddr,dstr(total))) != 0 )
{
printf("sendz_to_t.(%s)\n",retstr);
free(retstr);
}
ptr->spent = (uint32_t)time(NULL);
break;
}
ptr->spent = (uint32_t)time(NULL);
break;
}
}
}

9
iguana/dpow/dpow_rpc.c

@ -772,7 +772,7 @@ int32_t dpow_vini_ismine(struct supernet_info *myinfo,struct dpow_info *dp,cJSON
int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits256 *txidp,int32_t *voutp,char *coinaddr)
{
int32_t i,j,n,vout,haveutxo = 0; uint32_t r; bits256 txid; cJSON *unspents,*item; uint64_t satoshis; char *str,*address; uint8_t script[35];
int32_t vout,haveutxo = 0; uint32_t i,j,n,r; bits256 txid; cJSON *unspents,*item; uint64_t satoshis; char *str,*address; uint8_t script[35];
memset(txidp,0,sizeof(*txidp));
*voutp = -1;
if ( (unspents= dpow_listunspent(myinfo,coin,coinaddr)) != 0 )
@ -788,9 +788,10 @@ int32_t dpow_haveutxo(struct supernet_info *myinfo,struct iguana_info *coin,bits
"confirmations" : 4282,
"spendable" : true
},*/
r = 0;
memcpy(&r,coin->symbol,3);
r = calc_crc32(0,(void *)&r,sizeof(r));
//r = 0;
//memcpy(&r,coin->symbol,3);
//r = calc_crc32(0,(void *)&r,sizeof(r));
OS_randombytes((uint8_t *)&r,sizeof(r));
for (j=0; j<n; j++)
{
i = (r + j) % n;

2
iguana/iguana777.h

@ -173,7 +173,7 @@ struct supernet_info
uint16_t psockport,numpsocks; struct psock *PSOCKS; portable_mutex_t psockmutex;
uint8_t notaries[64][33]; int32_t numnotaries,DEXEXPLORER;
FILE *swapsfp;
struct smartaddress smartaddrs[64]; int32_t numsmartaddrs,cancelrefresh;
struct smartaddress smartaddrs[64]; int32_t numsmartaddrs,cancelrefresh,runsilent;
};
struct basilisk_swapmessage

2
includes/iguana_apideclares.h

@ -198,6 +198,8 @@ STRING_ARG(iguana,stakers,activecoin);
STRING_ARG(jumblr,setpassphrase,passphrase);
ZERO_ARGS(jumblr,status);
ZERO_ARGS(jumblr,runsilent);
ZERO_ARGS(jumblr,totransparent);
ZERO_ARGS(InstantDEX,allcoins);
STRING_ARG(InstantDEX,available,source);

Loading…
Cancel
Save