Browse Source

Test

etomic
jl777 8 years ago
parent
commit
889018be37
  1. 12
      basilisk/jumblr.c
  2. 17
      iguana/main.c
  3. 1
      includes/iguana_funcs.h

12
basilisk/jumblr.c

@ -395,22 +395,14 @@ void jumblr_DEXcheck(struct supernet_info *myinfo,struct iguana_info *coinkmd,ch
free(retstr);
}
// curl --url "http://127.0.0.1:7778" --data "{\"agent\":\"InstantDEX\",\"method\":\"request\",\"vals\":{\"source\":\"KMD\",\"amount\":20,\"dest\":\"USD\",\"minprice\":0.08}}"
} else printf("btcavail %.8f\n",btcavail);
}
} else printf("btcavail %.8f pending %.8f\n",btcavail,pending);
} else printf("null kmdprice %.8f\n",kmdprice);
}
void jumblr_iteration(struct supernet_info *myinfo,struct iguana_info *coin,int32_t selector,int32_t modval)
{
static uint32_t lasttime;
char BTCaddr[64],KMDaddr[64],*zaddr,*retstr; bits256 privkey; uint64_t amount=0,total=0; double fee; struct jumblr_item *ptr,*tmp; uint8_t r;
privkey = jumblr_privkey(myinfo,BTCaddr,KMDaddr,JUMBLR_DEPOSITPREFIX);
if ( time(NULL) > lasttime+60 )
{
// if BTC has arrived in deposit address, invoke DEX -> KMD
// if BTC has arrived in destination address, invoke DEX -> BTC
jumblr_DEXcheck(myinfo,coin,BTCaddr,KMDaddr,privkey);
lasttime = (uint32_t)time(NULL);
}
fee = JUMBLR_INCR * JUMBLR_FEE;
OS_randombytes(&r,sizeof(r));
//r = 0;

17
iguana/main.c

@ -747,16 +747,23 @@ void iguana_urlinit(struct supernet_info *myinfo,int32_t ismainnet,int32_t usess
void jumblr_loop(void *ptr)
{
struct iguana_info *coin; uint32_t t; struct supernet_info *myinfo = ptr; int32_t mult = 10;
struct iguana_info *coin; char BTCaddr[64],KMDaddr[64]; bits256 privkey; uint32_t t; struct supernet_info *myinfo = ptr; int32_t mult = 10;
printf("JUMBLR loop\n");
while ( 1 )
{
t = (uint32_t)time(NULL);
if ( (coin= iguana_coinfind("KMD")) != 0 && coin->FULLNODE < 0 && myinfo->jumblr_passphrase[0] != 0 && (t % (120 * mult)) < 60 )
if ( (coin= iguana_coinfind("KMD")) != 0 && coin->FULLNODE < 0 )
{
jumblr_iteration(myinfo,coin,(t % (360 * mult)) / (120 * mult),t % (120 * mult));
privkey = jumblr_privkey(myinfo,BTCaddr,KMDaddr,JUMBLR_DEPOSITPREFIX);
// if BTC has arrived in deposit address, invoke DEX -> KMD
// if BTC has arrived in destination address, invoke DEX -> BTC
jumblr_DEXcheck(myinfo,coin,BTCaddr,KMDaddr,privkey);
t = (uint32_t)time(NULL);
if ( myinfo->jumblr_passphrase[0] != 0 && (t % (120 * mult)) < 60 )
{
jumblr_iteration(myinfo,coin,(t % (360 * mult)) / (120 * mult),t % (120 * mult));
}
//printf("t.%u %p.%d %s\n",t,coin,coin!=0?coin->FULLNODE:0,myinfo->jumblr_passphrase);
}
//printf("t.%u %p.%d %s\n",t,coin,coin!=0?coin->FULLNODE:0,myinfo->jumblr_passphrase);
sleep(55);
}
}

1
includes/iguana_funcs.h

@ -615,6 +615,7 @@ int32_t iguana_staker_sort(struct iguana_info *coin,bits256 *hash2p,uint8_t *ref
bits256 mpz_div64(bits256 hash,uint64_t divval);
void iguana_walletinitcheck(struct supernet_info *myinfo,struct iguana_info *coin);
void jumblr_iteration(struct supernet_info *myinfo,struct iguana_info *coin,int32_t selector,int32_t modval);
void jumblr_DEXcheck(struct supernet_info *myinfo,struct iguana_info *coinkmd,char *BTCaddr,char *KMDaddr,bits256 privkey);
bits256 jumblr_privkey(struct supernet_info *myinfo,char *BTCaddr,char *KMDaddr,char *prefix);
char *jumblr_importprivkey(struct supernet_info *myinfo,struct iguana_info *coin,char *wifstr);
int64_t iguana_esttxfee(struct supernet_info *myinfo,struct iguana_info *coin,char *rawtx,char *signedtx,int32_t numvins);

Loading…
Cancel
Save