Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
6541ce01ff
  1. 1
      basilisk/basilisk_bitcoin.c
  2. 31
      iguana/iguana_wallet.c

1
basilisk/basilisk_bitcoin.c

@ -1097,6 +1097,7 @@ void basilisk_unspent_update(struct supernet_info *myinfo,struct iguana_info *co
printf("new unspent.%s %d script.%p [%d]\n",waddr->coinaddr,waddr->numunspents,bu.script,bu.spendlen);
}
waddr->unspents[i] = bu;
//PREVENT DOUBLE SPENDS!!! and use p2sh
if ( i == n && bu.spentheight != 0 && (dest= jobj(item,"dest")) != 0 )
{
struct basilisk_spend *s;

31
iguana/iguana_wallet.c

@ -56,25 +56,32 @@ struct iguana_waddress *iguana_waddressalloc(uint8_t addrtype,char *symbol,char
struct iguana_waccount *iguana_waccountfind(struct supernet_info *myinfo,struct iguana_info *coin,char *account)
{
struct iguana_waccount *wacct;
HASH_FIND(hh,myinfo->wallet,account,strlen(account)+1,wacct);
struct iguana_waccount *wacct = 0;
if ( account != 0 && wacct != 0 )
HASH_FIND(hh,myinfo->wallet,account,strlen(account)+1,wacct);
//printf("waccountfind.(%s) -> wacct.%p\n",account,wacct);
return(wacct);
}
struct iguana_waccount *iguana_waccountcreate(struct supernet_info *myinfo,struct iguana_info *coin,char *account)
{
struct iguana_waccount *wacct,*ptr; int32_t len = (int32_t)strlen(account)+1;
HASH_FIND(hh,myinfo->wallet,account,len,wacct);
if ( wacct == 0 )
struct iguana_waccount *wacct=0,*ptr; int32_t len;
if ( account != 0 )
{
wacct = mycalloc('w',1,sizeof(*wacct));
strcpy(wacct->account,account);
HASH_ADD_KEYPTR(hh,myinfo->wallet,wacct->account,len,wacct);
printf("waccountcreate.(%s) -> wacct.%p\n",account,wacct);
myinfo->dirty = (uint32_t)time(NULL);
if ( (ptr= iguana_waccountfind(myinfo,coin,account)) != wacct )
printf("iguana_waccountcreate verify error %p vs %p\n",ptr,wacct);
if ( account[0] == 0 )
account = "default";
len = (int32_t)strlen(account)+1;
HASH_FIND(hh,myinfo->wallet,account,len,wacct);
if ( wacct == 0 )
{
wacct = mycalloc('w',1,sizeof(*wacct));
strcpy(wacct->account,account);
HASH_ADD_KEYPTR(hh,myinfo->wallet,wacct->account,len,wacct);
printf("waccountcreate.(%s) -> wacct.%p\n",account,wacct);
myinfo->dirty = (uint32_t)time(NULL);
if ( (ptr= iguana_waccountfind(myinfo,coin,account)) != wacct )
printf("iguana_waccountcreate verify error %p vs %p\n",ptr,wacct);
}
}
return(wacct);
}

Loading…
Cancel
Save