From 3196f245df56e38796ad782bd6f80ff7009f6927 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 10 Apr 2017 16:37:54 +0300 Subject: [PATCH] Test --- .gitignore | 2 ++ basilisk/basilisk_swap.c | 16 +++++++++++----- iguana/iguana777.h | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 6c933d9cb..bab559bfd 100755 --- a/.gitignore +++ b/.gitignore @@ -302,3 +302,5 @@ iguana/DB/SWAPS/1505015888-2633757068 iguana/DB/SWAPS/3430299677-3087427598 iguana/DB/SWAPS/2275651697-591036515 + +iguana/DB/SWAPS/2180638961-896149751 diff --git a/basilisk/basilisk_swap.c b/basilisk/basilisk_swap.c index 8e8eb7319..7106a2c49 100755 --- a/basilisk/basilisk_swap.c +++ b/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; 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 ) { 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 ) { item = jitem(addresses,0); - printf("item.(%s)\n",jprint(item,0)); + //printf("item.(%s)\n",jprint(item,0)); if ( (addr= jstr(item,0)) != 0 ) { 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); 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++) if ( bits256_nonz(swap->I.myprivs[i]) != 0 ) fprintf(fp,"\",\"myprivs%d\":\"%s\"",i,bits256_str(str,swap->I.myprivs[i])); diff --git a/iguana/iguana777.h b/iguana/iguana777.h index d17555d43..f83fe19c5 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -189,6 +189,7 @@ struct basilisk_swap struct basilisk_rawtx bobdeposit,bobpayment,alicepayment,myfee,otherfee,aliceclaim,alicespend,bobreclaim,bobspend,bobrefund,alicereclaim; bits256 privkeys[INSTANTDEX_DECKSIZE]; struct basilisk_swapmessage *messages; int32_t nummessages; + char Bdeposit[64],Bpayment[64]; uint64_t otherdeck[INSTANTDEX_DECKSIZE][2],deck[INSTANTDEX_DECKSIZE][2]; uint8_t persistent_pubkey33[33],pad[15],verifybuf[65536];