Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
4f0087bd28
  1. 11
      basilisk/basilisk_CMD.c
  2. 8
      iguana/iguana_instantdex.c
  3. 8
      iguana/iguana_unspents.c

11
basilisk/basilisk_CMD.c

@ -126,9 +126,14 @@ void basilisk_request_goodbye(struct supernet_info *myinfo)
char *basilisk_respond_instantdex(struct supernet_info *myinfo,char *CMD,void *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 hash,int32_t from_basilisk)
{
char *retstr=0;
printf("from.(%s) DEX.(%s) datalen.%d\n",remoteaddr,jprint(valsobj,0),datalen);
instantdex_quotep2p(myinfo,0,addr,data,datalen);
char *dest,*src,*retstr=0; uint64_t satoshis;
if ( (dest= jstr(valsobj,"dest")) != 0 && (src= jstr(valsobj,"src")) != 0 && (satoshis= j64bits(valsobj,"satoshis")) != 0 )
{
char str[65]; printf("DEX.(%s %.8f) -> %s %s\n",src,dstr(satoshis),dest,bits256_str(str,hash));
retstr = clonestr("{\"result\":\"DEX quote added\"}");
}
//instantdex_quotep2p(myinfo,0,addr,data,datalen);
return(retstr);
}

8
iguana/iguana_instantdex.c

@ -1735,7 +1735,13 @@ STRING_ARG(InstantDEX,available,source)
THREE_STRINGS_AND_DOUBLE(InstantDEX,request,message,dest,source,amount)
{
return(clonestr("{\"result\":\"this will request converting amount worth of source into dest\"}"));
char *retstr; cJSON *vals = cJSON_CreateObject();
jaddstr(vals,"dest",dest);
jaddstr(vals,"src",source);
jadd64bits(vals,"satoshis",amount * SATOSHIDEN);
retstr = basilisk_standardservice("DEX",myinfo,0,myinfo->myaddr.persistent,vals,"",1);
free_json(vals);
return(retstr);
}
INT_ARG(InstantDEX,incoming,requestid)

8
iguana/iguana_unspents.c

@ -40,7 +40,7 @@ int32_t iguana_unspentindfind(struct iguana_info *coin,char *coinaddr,uint8_t *s
{
RTspend = 0;
flag++;
if ( iguana_spentflag(coin,&RTspend,&spentheight,&bp->ramchain,bp->hdrsi,unspentind,0,1,coin->longestchain,U[unspentind].value) == 0 ) //bp == coin->current ? &coin->RTramchain :
if ( iguana_spentflag(coin,&RTspend,&spentheight,bp == coin->current ? &coin->RTramchain : &bp->ramchain,bp->hdrsi,unspentind,0,1,coin->longestchain,U[unspentind].value) == 0 ) //
{
if ( valuep != 0 )
*valuep = U[unspentind].value;
@ -161,7 +161,7 @@ struct iguana_pkhash *iguana_pkhashfind(struct iguana_info *coin,struct iguana_r
printf("iguana_pkhashfind: unexpected access when RTramchain_busy\n");
return(0);
}
ramchain = &bp->ramchain;//(bp != coin->current) ? &bp->ramchain : &coin->RTramchain;
ramchain = (bp != coin->current) ? &bp->ramchain : &coin->RTramchain;
if ( (rdata= ramchain->H.data) != 0 )
{
numpkinds = rdata->numpkinds;
@ -457,7 +457,7 @@ int32_t iguana_uvaltxid(struct supernet_info *myinfo,bits256 *txidp,struct iguan
struct iguana_bundle *bp; struct iguana_unspent *U,*u; struct iguana_txid *T; struct iguana_ramchain *ramchain; struct iguana_ramchaindata *rdata;
if ( (bp= coin->bundles[hdrsi]) == 0 )
return(-1);
ramchain = &bp->ramchain;//(bp == coin->current) ? &coin->RTramchain : &bp->ramchain;
ramchain = (bp == coin->current) ? &coin->RTramchain : &bp->ramchain;
if ( (rdata= ramchain->H.data) != 0 )
{
U = RAMCHAIN_PTR(rdata,Uoffset);
@ -482,7 +482,7 @@ int64_t iguana_unspentavail(struct iguana_info *coin,uint64_t hdrsi_unspentind,i
return(-1);
hdrsi = (int16_t)(hdrsi_unspentind >> 32);
unspentind = (uint32_t)hdrsi_unspentind;
ramchain = &bp->ramchain;//(bp == coin->current) ? &coin->RTramchain : &bp->ramchain;
ramchain = (bp == coin->current) ? &coin->RTramchain : &bp->ramchain;
if ( (rdata= ramchain->H.data) == 0 )
return(0);
if ( (spentflag= iguana_spentflag(coin,&RTspend,&spentheight,ramchain,hdrsi,unspentind,0,minconf,maxconf,0)) > 0 )

Loading…
Cancel
Save