Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
f363394df9
  1. 2
      basilisk/basilisk.c
  2. 10
      basilisk/basilisk_bitcoin.c
  3. 2
      basilisk/basilisk_swap.c
  4. 2
      includes/iguana_structs.h

2
basilisk/basilisk.c

@ -910,7 +910,7 @@ void basilisks_loop(void *arg)
basilisk_unspents_update(myinfo,coin); basilisk_unspents_update(myinfo,coin);
} }
} }
if ( (myinfo->RELAYID >= 0 || time(NULL) < myinfo->DEXactive) ) //if ( (myinfo->RELAYID >= 0 || time(NULL) < myinfo->DEXactive) )
basilisk_requests_poll(myinfo); basilisk_requests_poll(myinfo);
now = (uint32_t)time(NULL); now = (uint32_t)time(NULL);
portable_mutex_lock(&myinfo->messagemutex); portable_mutex_lock(&myinfo->messagemutex);

10
basilisk/basilisk_bitcoin.c

@ -496,8 +496,8 @@ void *basilisk_bitcoinrawtx(struct basilisk_item *Lptr,struct supernet_info *myi
addresses = iguana_getaddressesbyaccount(myinfo,coin,"*"); addresses = iguana_getaddressesbyaccount(myinfo,coin,"*");
jadd(valsobj,"addresses",addresses); jadd(valsobj,"addresses",addresses);
} }
//printf("use addresses.(%s)\n",jprint(addresses,0)); printf("use addresses.(%s)\n",jprint(addresses,0));
//printf("vals.(%s) change.(%s) spend.%s\n",jprint(valsobj,0),changeaddr,spendscriptstr); printf("vals.(%s) change.(%s) spend.%s\n",jprint(valsobj,0),changeaddr,spendscriptstr);
if ( changeaddr == 0 || changeaddr[0] == 0 || spendscriptstr == 0 || spendscriptstr[0] == 0 )//|| amount == 0 || addresses == 0 ) if ( changeaddr == 0 || changeaddr[0] == 0 || spendscriptstr == 0 || spendscriptstr[0] == 0 )//|| amount == 0 || addresses == 0 )
{ {
Lptr->retstr = clonestr("{\"error\":\"invalid changeaddr or spendscript or addresses\"}"); Lptr->retstr = clonestr("{\"error\":\"invalid changeaddr or spendscript or addresses\"}");
@ -818,6 +818,8 @@ HASH_ARRAY_STRING(basilisk,rawtx,hash,vals,hexstr)
if ( (symbol= jstr(vals,"symbol")) != 0 || (symbol= jstr(vals,"coin")) != 0 ) if ( (symbol= jstr(vals,"symbol")) != 0 || (symbol= jstr(vals,"coin")) != 0 )
coin = iguana_coinfind(symbol); coin = iguana_coinfind(symbol);
} }
if ( jobj(vals,"numrequired") == 0 )
jaddnum(vals,"numrequired",myinfo->numrelays);
if ( jobj(vals,"fanout") == 0 ) if ( jobj(vals,"fanout") == 0 )
jaddnum(vals,"fanout",8); jaddnum(vals,"fanout",8);
if ( coin != 0 ) if ( coin != 0 )
@ -947,7 +949,7 @@ HASH_ARRAY_STRING(basilisk,history,hash,vals,hexstr)
{ {
bitcoin_address(waddr->coinaddr,coin->chain->pubtype,waddr->rmd160,sizeof(waddr->rmd160)); bitcoin_address(waddr->coinaddr,coin->chain->pubtype,waddr->rmd160,sizeof(waddr->rmd160));
jaddi(array,basilisk_history_item(&total,waddr->coinaddr,bu->value,bu->timestamp,bu->txid,"vout",bu->vout,bu->height,"spentheight",bu->spentheight,bu->relaymask,-1)); jaddi(array,basilisk_history_item(&total,waddr->coinaddr,bu->value,bu->timestamp,bu->txid,"vout",bu->vout,bu->height,"spentheight",bu->spentheight,bu->relaymask,-1));
//printf("%s numunspents.%d\n",waddr->coinaddr,waddr->numunspents); //printf("%s %s i.%d numunspents.%d\n",coin->symbol,waddr->coinaddr,i,waddr->numunspents);
} }
} }
} }
@ -959,6 +961,7 @@ HASH_ARRAY_STRING(basilisk,history,hash,vals,hexstr)
{ {
s = &myinfo->spends[i]; s = &myinfo->spends[i];
//struct basilisk_spend { bits256 txid; uint64_t relaymask,value; uint32_t timestamp; int32_t vini,height,unspentheight,ismine; char destaddr[64]; }; //struct basilisk_spend { bits256 txid; uint64_t relaymask,value; uint32_t timestamp; int32_t vini,height,unspentheight,ismine; char destaddr[64]; };
if ( strcmp(s->symbol,coin->symbol) == 0 )
jaddi(spends,basilisk_history_item(&totalspent,s->destaddr,s->value,s->timestamp,s->txid,"vin",s->vini,s->height,"unspentheight",s->unspentheight,s->relaymask,s->ismine)); jaddi(spends,basilisk_history_item(&totalspent,s->destaddr,s->value,s->timestamp,s->txid,"vin",s->vini,s->height,"unspentheight",s->unspentheight,s->relaymask,s->ismine));
} }
} }
@ -1065,6 +1068,7 @@ void basilisk_unspent_update(struct supernet_info *myinfo,struct iguana_info *co
struct basilisk_spend s; struct basilisk_spend s;
//{"txid":"cd4fb72f871d481c534f15d7f639883958936d49e965f58276f0925798e762df","vin":1,"height":<spentheight>,"unspentheight":<bu.height>,"relays":2}}, //{"txid":"cd4fb72f871d481c534f15d7f639883958936d49e965f58276f0925798e762df","vin":1,"height":<spentheight>,"unspentheight":<bu.height>,"relays":2}},
s.vini = jint(dest,"vin"); s.vini = jint(dest,"vin");
strcpy(s.symbol,coin->symbol);
s.txid = jbits256(dest,"spentfrom"); s.txid = jbits256(dest,"spentfrom");
s.height = spentheight; s.height = spentheight;
s.timestamp = juint(dest,"timestamp"); s.timestamp = juint(dest,"timestamp");

2
basilisk/basilisk_swap.c

@ -1271,7 +1271,7 @@ struct basilisk_swap *basilisk_request_started(struct supernet_info *myinfo,uint
for (i=0; i<myinfo->numswaps; i++) for (i=0; i<myinfo->numswaps; i++)
if ( myinfo->swaps[i]->req.requestid == requestid ) if ( myinfo->swaps[i]->req.requestid == requestid )
{ {
//printf("REQUEST STARTED.[%d] <- req.%u\n",i,requestid); printf("REQUEST STARTED.[%d] <- req.%u\n",i,requestid);
active = myinfo->swaps[i]; active = myinfo->swaps[i];
break; break;
} }

2
includes/iguana_structs.h

@ -364,7 +364,7 @@ struct iguana_bundlereq
struct iguana_bitmap { int32_t width,height,amplitude; char name[52]; uint8_t data[IGUANA_WIDTH*IGUANA_HEIGHT*3]; }; struct iguana_bitmap { int32_t width,height,amplitude; char name[52]; uint8_t data[IGUANA_WIDTH*IGUANA_HEIGHT*3]; };
struct basilisk_spend { bits256 txid; uint64_t relaymask,value; uint32_t timestamp; int32_t vini,height,unspentheight,ismine; char destaddr[64]; }; struct basilisk_spend { bits256 txid; uint64_t relaymask,value; uint32_t timestamp; int32_t vini,height,unspentheight,ismine; char destaddr[64],symbol[16]; };
struct basilisk_unspent { bits256 txid; uint64_t value,relaymask; uint32_t unspentind,timestamp; int32_t RTheight,height,spentheight; int16_t status,hdrsi,vout,spendlen; char symbol[16]; uint8_t script[256]; }; struct basilisk_unspent { bits256 txid; uint64_t value,relaymask; uint32_t unspentind,timestamp; int32_t RTheight,height,spentheight; int16_t status,hdrsi,vout,spendlen; char symbol[16]; uint8_t script[256]; };

Loading…
Cancel
Save