From 71f5f3ed24c3a47f8680ab3e33deac9d9db0b947 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 27 Aug 2016 17:41:14 -0300 Subject: [PATCH] test --- basilisk/basilisk.c | 20 ++++++++++++++------ iguana/iguana_unspents.c | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/basilisk/basilisk.c b/basilisk/basilisk.c index 520e9a91d..8926c9896 100755 --- a/basilisk/basilisk.c +++ b/basilisk/basilisk.c @@ -17,6 +17,13 @@ typedef char *basilisk_servicefunc(struct supernet_info *myinfo,char *CMD,void *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 hash,int32_t from_basilisk); +int32_t basilisk_specialcmd(char *cmd) +{ + if ( strcmp(cmd,"PIN") != 0 && strcmp(cmd,"DEX") != 0 && strcmp(cmd,"ACC") != 0 && strcmp(cmd,"RID") != 0 && strcmp(cmd,"OUT") != 0 && strcmp(cmd,"MSG") != 0 ) + return(0); + else return(1); +} + uint32_t basilisk_calcnonce(struct supernet_info *myinfo,uint8_t *data,int32_t datalen,uint32_t nBits) { int32_t i,numiters = 0; bits256 hash,hash2,threshold; uint32_t basilisktag; @@ -368,8 +375,8 @@ struct basilisk_item *basilisk_requestservice(struct supernet_info *myinfo,struc char *basilisk_standardservice(char *CMD,struct supernet_info *myinfo,void *_addr,bits256 hash,cJSON *valsobj,char *hexstr,int32_t blockflag) // client side { uint32_t nBits = 0; uint8_t space[4096],*allocptr=0,*data = 0; struct basilisk_item *ptr; int32_t datalen = 0; cJSON *retjson; char *retstr=0; - if ( (strcmp(CMD,"OUT") == 0 || strcmp(CMD,"MSG") == 0) && myinfo->RELAYID >= 0 ) - return(clonestr("{\"error\":\"special relays only do OUT and MSG\"}")); + if ( myinfo->RELAYID >= 0 && basilisk_specialcmd(CMD) == 0 ) + return(clonestr("{\"error\":\"unsupported special relay command\"}")); data = get_dataptr(BASILISK_HDROFFSET,&allocptr,&datalen,space,sizeof(space),hexstr); ptr = basilisk_requestservice(myinfo,_addr,CMD,blockflag,valsobj,hash,data,datalen,nBits); if ( allocptr != 0 ) @@ -563,6 +570,9 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende { { (void *)"OUT", &basilisk_respond_OUT }, // send MSG to hash/id/num { (void *)"MSG", &basilisk_respond_MSG }, // get MSG (hash, id, num) + { (void *)"DEX", &basilisk_respond_DEX }, + { (void *)"RID", &basilisk_respond_RID }, + { (void *)"ACC", &basilisk_respond_ACC }, { (void *)"BYE", &basilisk_respond_goodbye }, // disconnect @@ -574,9 +584,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende { (void *)"GTX", &basilisk_respond_geckotx }, // reports virtchain tx { (void *)"ADD", &basilisk_respond_addrelay }, // relays register with each other bus - { (void *)"DEX", &basilisk_respond_DEX }, - { (void *)"RID", &basilisk_respond_RID }, - { (void *)"ACC", &basilisk_respond_ACC }, + // encrypted data for jumblr { (void *)"HOP", &basilisk_respond_forward }, // message forwarding @@ -594,7 +602,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende { (void *)"VAL", &basilisk_respond_value }, { (void *)"BAL", &basilisk_respond_balances }, }; - if ( myinfo->RELAYID >= 0 && strcmp(type,"OUT") != 0 && strcmp(type,"MSG") != 0 ) + if ( myinfo->RELAYID >= 0 && basilisk_specialcmd(type) == 0 ) return; symbol = "BTCD"; if ( senderipbits == 0 ) diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 6a794bd7a..16fab440e 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1404,7 +1404,7 @@ continue; if ( iguana_utxoaddr_map(coin,fname) != 0 ) { printf("validating %s HIST BALANCE %s %.8f errs %d\n",fname2,bits256_str(str,coin->utxoaddrhash),dstr(coin->histbalance),errs); - errs = iguana_utxoaddr_validate(myinfo,coin,height); + errs = 0;//iguana_utxoaddr_validate(myinfo,coin,height); printf("gen %s HIST BALANCE %s %.8f errs %d\n",fname2,bits256_str(str,coin->utxoaddrhash),dstr(coin->histbalance),errs); if ( errs != 0 || height == 0 ) {