Browse Source

Test

etomic
jl777 8 years ago
parent
commit
3196f245df
  1. 2
      .gitignore
  2. 16
      basilisk/basilisk_swap.c
  3. 1
      iguana/iguana777.h

2
.gitignore

@ -302,3 +302,5 @@ iguana/DB/SWAPS/1505015888-2633757068
iguana/DB/SWAPS/3430299677-3087427598 iguana/DB/SWAPS/3430299677-3087427598
iguana/DB/SWAPS/2275651697-591036515 iguana/DB/SWAPS/2275651697-591036515
iguana/DB/SWAPS/2180638961-896149751

16
basilisk/basilisk_swap.c

@ -690,19 +690,19 @@ void basilisk_swap_coinaddr(struct supernet_info *myinfo,struct basilisk_swap *s
cJSON *txobj,*vouts,*vout,*addresses,*item,*skey; uint8_t extraspace[8192]; bits256 signedtxid; struct iguana_msgtx msgtx; char *addr; int32_t n,m,suppress_pubkeys = 0; cJSON *txobj,*vouts,*vout,*addresses,*item,*skey; uint8_t extraspace[8192]; bits256 signedtxid; struct iguana_msgtx msgtx; char *addr; int32_t n,m,suppress_pubkeys = 0;
if ( (txobj= bitcoin_data2json(coin,coin->longestchain,&signedtxid,&msgtx,extraspace,sizeof(extraspace),data,datalen,0,suppress_pubkeys)) != 0 ) if ( (txobj= bitcoin_data2json(coin,coin->longestchain,&signedtxid,&msgtx,extraspace,sizeof(extraspace),data,datalen,0,suppress_pubkeys)) != 0 )
{ {
char str[65]; printf("got txid.%s (%s)\n",bits256_str(str,signedtxid),jprint(txobj,0)); //char str[65]; printf("got txid.%s (%s)\n",bits256_str(str,signedtxid),jprint(txobj,0));
if ( (vouts= jarray(&n,txobj,"vout")) != 0 && n > 0 ) if ( (vouts= jarray(&n,txobj,"vout")) != 0 && n > 0 )
{ {
vout = jitem(vouts,0); vout = jitem(vouts,0);
printf("VOUT.(%s)\n",jprint(vout,0)); //printf("VOUT.(%s)\n",jprint(vout,0));
if ( (skey= jobj(vout,"scriptPubKey")) != 0 && (addresses= jarray(&m,skey,"addresses")) != 0 ) if ( (skey= jobj(vout,"scriptPubKey")) != 0 && (addresses= jarray(&m,skey,"addresses")) != 0 )
{ {
item = jitem(addresses,0); item = jitem(addresses,0);
printf("item.(%s)\n",jprint(item,0)); //printf("item.(%s)\n",jprint(item,0));
if ( (addr= jstr(item,0)) != 0 ) if ( (addr= jstr(item,0)) != 0 )
{ {
safecopy(coinaddr,addr,64); safecopy(coinaddr,addr,64);
printf("extracted.(%s)\n",coinaddr); //printf("extracted.(%s)\n",coinaddr);
} }
} }
} }
@ -766,10 +766,16 @@ void basilisk_dontforget(struct supernet_info *myinfo,struct basilisk_swap *swap
basilisk_swap_coinaddr(myinfo,swap,swap->bobcoin,coinaddr,rawtx->txbytes,rawtx->I.datalen); basilisk_swap_coinaddr(myinfo,swap,swap->bobcoin,coinaddr,rawtx->txbytes,rawtx->I.datalen);
if ( coinaddr[0] != 0 ) if ( coinaddr[0] != 0 )
{ {
fprintf(fp,",\"%s\":\"%s\"",rawtx == &swap->bobdeposit ? "Bdeposit" : "Bpayment",coinaddr); if ( rawtx == &swap->bobdeposit )
safecopy(swap->Bdeposit,coinaddr,sizeof(swap->Bdeposit));
else safecopy(swap->Bpayment,coinaddr,sizeof(swap->Bpayment));
} }
} }
} }
if ( swap->Bdeposit[0] != 0 )
fprintf(fp,",\"%s\":\"%s\"","Bdeposit",swap->Bdeposit);
if ( swap->Bpayment[0] != 0 )
fprintf(fp,",\"%s\":\"%s\"","Bpayment",swap->Bpayment);
for (i=0; i<2; i++) for (i=0; i<2; i++)
if ( bits256_nonz(swap->I.myprivs[i]) != 0 ) if ( bits256_nonz(swap->I.myprivs[i]) != 0 )
fprintf(fp,"\",\"myprivs%d\":\"%s\"",i,bits256_str(str,swap->I.myprivs[i])); fprintf(fp,"\",\"myprivs%d\":\"%s\"",i,bits256_str(str,swap->I.myprivs[i]));

1
iguana/iguana777.h

@ -189,6 +189,7 @@ struct basilisk_swap
struct basilisk_rawtx bobdeposit,bobpayment,alicepayment,myfee,otherfee,aliceclaim,alicespend,bobreclaim,bobspend,bobrefund,alicereclaim; struct basilisk_rawtx bobdeposit,bobpayment,alicepayment,myfee,otherfee,aliceclaim,alicespend,bobreclaim,bobspend,bobrefund,alicereclaim;
bits256 privkeys[INSTANTDEX_DECKSIZE]; bits256 privkeys[INSTANTDEX_DECKSIZE];
struct basilisk_swapmessage *messages; int32_t nummessages; struct basilisk_swapmessage *messages; int32_t nummessages;
char Bdeposit[64],Bpayment[64];
uint64_t otherdeck[INSTANTDEX_DECKSIZE][2],deck[INSTANTDEX_DECKSIZE][2]; uint64_t otherdeck[INSTANTDEX_DECKSIZE][2],deck[INSTANTDEX_DECKSIZE][2];
uint8_t persistent_pubkey33[33],pad[15],verifybuf[65536]; uint8_t persistent_pubkey33[33],pad[15],verifybuf[65536];

Loading…
Cancel
Save