Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
681f772843
  1. 5
      basilisk/basilisk_bitcoin.c
  2. 5
      iguana/main.c

5
basilisk/basilisk_bitcoin.c

@ -928,6 +928,8 @@ struct basilisk_spend *basilisk_addspend(struct supernet_info *myinfo,char *symb
{ {
int32_t i; struct basilisk_spend *s; int32_t i; struct basilisk_spend *s;
// mutex // mutex
if ( myinfo->numspends > 0 )
{
for (i=0; i<myinfo->numspends; i++) for (i=0; i<myinfo->numspends; i++)
{ {
if ( myinfo->spends[i].vout == vout && bits256_cmp(txid,myinfo->spends[i].txid) == 0 ) if ( myinfo->spends[i].vout == vout && bits256_cmp(txid,myinfo->spends[i].txid) == 0 )
@ -936,9 +938,12 @@ struct basilisk_spend *basilisk_addspend(struct supernet_info *myinfo,char *symb
return(&myinfo->spends[i]); return(&myinfo->spends[i]);
} }
} }
}
if ( addflag != 0 && i == myinfo->numspends ) if ( addflag != 0 && i == myinfo->numspends )
{ {
printf("realloc spends.[%d] %p\n",myinfo->numspends,myinfo->spends);
myinfo->spends = realloc(myinfo->spends,sizeof(*myinfo->spends) * (myinfo->numspends+1)); myinfo->spends = realloc(myinfo->spends,sizeof(*myinfo->spends) * (myinfo->numspends+1));
printf("allocated spends.[%d] %p\n",myinfo->numspends+1,myinfo->spends);
s = &myinfo->spends[myinfo->numspends++]; s = &myinfo->spends[myinfo->numspends++];
memset(s,0,sizeof(*s)); memset(s,0,sizeof(*s));
s->txid = txid; s->txid = txid;

5
iguana/main.c

@ -408,12 +408,15 @@ rm BTC.xz; mksquashfs DB/BTC BTC.xz -comp xz -b 1048576 -comp xz -Xdict-size 102
void mainloop(struct supernet_info *myinfo) void mainloop(struct supernet_info *myinfo)
{ {
struct iguana_info *coin,*tmp; int32_t i,depth; portable_mutex_t *stack[IGUANA_MAXCOINS]; struct iguana_info *coin,*tmp; int32_t i,depth; portable_mutex_t *stack[IGUANA_MAXCOINS];
uint32_t lasttime = 0;
sleep(3); sleep(3);
printf("mainloop\n"); printf("mainloop\n");
while ( 1 ) while ( 1 )
{ {
//printf("main iteration\n"); //printf("main iteration\n");
if ( 1 ) if ( 1 )
{
if ( time(NULL) > lasttime )
{ {
coin = 0; coin = 0;
depth = 0; depth = 0;
@ -428,6 +431,8 @@ void mainloop(struct supernet_info *myinfo)
for (i=depth-1; i>=0; i--) for (i=depth-1; i>=0; i--)
portable_mutex_unlock(stack[i]); portable_mutex_unlock(stack[i]);
} }
lasttime = (uint32_t)time(NULL);
}
} }
//pangea_queues(SuperNET_MYINFO(0)); //pangea_queues(SuperNET_MYINFO(0));
//if ( flag == 0 ) //if ( flag == 0 )

Loading…
Cancel
Save