From 596bce229509cfd681023fb2e366bb6ebc94250e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 3 Jul 2016 02:38:49 -0300 Subject: [PATCH] test --- basilisk/basilisk.c | 6 +++--- basilisk/basilisk_swap.c | 11 ++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index 22a6d112d..4c7b3ca3f 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -384,7 +384,7 @@ char *basilisk_standardservice(char *CMD,struct supernet_info *myinfo,void *_add } ptr->finished = (uint32_t)time(NULL); } - if ( strcmp("RID",CMD) != 0 ) + if ( 0 && strcmp("RID",CMD) != 0 ) printf("%s.(%s) -> (%s)\n",CMD,jprint(valsobj,0),retstr!=0?retstr:""); return(retstr); } @@ -508,7 +508,7 @@ void basilisk_result(struct supernet_info *myinfo,char *remoteaddr,uint32_t basi { retstr = jprint(vals,0); safecopy(CMD,jstr(vals,"origcmd"),sizeof(CMD)); - if ( strcmp("RID",CMD) != 0 ) + if ( 0 && strcmp("RID",CMD) != 0 ) printf("(%s) -> Q.%u results vals.(%s)\n",CMD,basilisktag,retstr); if ( strcmp(CMD,"GET") == 0 ) basilisk_geckoresult(myinfo,remoteaddr,retstr,data,datalen); @@ -637,7 +637,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende CMD[i] = toupper((int32_t)CMD[i]); cmd[i] = tolower((int32_t)CMD[i]); } - if ( strcmp(CMD,"RID") != 0 ) + if ( 0 && strcmp(CMD,"RID") != 0 ) printf("MSGPROCESS %s.(%s) tag.%d\n",CMD,(char *)data,basilisktag); myinfo->basilisk_busy = 1; if ( valsobj != 0 ) diff --git a/basilisk/basilisk_swap.c b/basilisk/basilisk_swap.c index 148a37fb9..12957b2c7 100755 --- a/basilisk/basilisk_swap.c +++ b/basilisk/basilisk_swap.c @@ -386,7 +386,9 @@ int32_t basilisk_verify_choosei(struct supernet_info *myinfo,struct basilisk_swa { swap->otherchoosei = otherchoosei; return(0); - } else return(-1); + } + printf("illegal otherchoosei.%d\n",otherchoosei); + return(-1); } int32_t basilisk_swapdata_deck(struct supernet_info *myinfo,struct basilisk_swap *swap,uint8_t *data,int32_t maxlen) @@ -400,6 +402,7 @@ int32_t basilisk_swapdata_deck(struct supernet_info *myinfo,struct basilisk_swap int32_t basilisk_verify_otherdeck(struct supernet_info *myinfo,struct basilisk_swap *swap,uint8_t *data,int32_t datalen) { int32_t i,len = 0; + printf("verify otherdeck\n"); for (i=0; iotherdeck)/sizeof(swap->otherdeck[0][0]); i++) len += iguana_rwnum(0,&data[len],sizeof(swap->otherdeck[i>>1][i&1]),&swap->otherdeck[i>>1][i&1]); return(0); @@ -429,6 +432,7 @@ int32_t basilisk_verify_pubpair(int32_t *wrongfirstbytep,struct basilisk_swap *s int32_t basilisk_verify_privkeys(struct supernet_info *myinfo,struct basilisk_swap *swap,uint8_t *data,int32_t datalen) { int32_t i,j,wrongfirstbyte,errs=0,len = 0; bits256 otherpriv,pubi; uint8_t secret160[20],otherpubkey[33],pubkey[33]; uint64_t txid; + printf("verify privkeys\n"); if ( swap->cutverified == 0 && swap->choosei >= 0 && datalen == sizeof(swap->privkeys) ) { for (i=wrongfirstbyte=errs=0; iprivkeys)/sizeof(*swap->privkeys); i++) @@ -527,13 +531,18 @@ void basilisk_swaploop(void *_swap) fprintf(stderr,"swapstate.%x\n",swap->statebits); if ( (swap->statebits & 0x01) == 0 ) // wait for pubkeys { + printf("send deck\n"); datalen = basilisk_swapdata_deck(myinfo,swap,data,maxlen); swap->statebits |= basilisk_swapsend(myinfo,swap,0x02,data,datalen,0x01); } else if ( (swap->statebits & 0x02) == 0 ) // send pubkeys { + printf("send deck again\n"); + datalen = basilisk_swapdata_deck(myinfo,swap,data,maxlen); + basilisk_swapsend(myinfo,swap,0x02,data,datalen,0x01); if ( basilisk_swapget(myinfo,swap,0x02,data,maxlen,basilisk_verify_otherdeck) == 0 ) swap->statebits |= 0x02; + else printf("msg.2 not there\n"); } else if ( (swap->statebits & 0x04) == 0 ) // send choosei {