diff --git a/basilisk/basilisk_swap.c b/basilisk/basilisk_swap.c index a1440e4a3..3c8002c0d 100755 --- a/basilisk/basilisk_swap.c +++ b/basilisk/basilisk_swap.c @@ -345,14 +345,10 @@ int32_t basilisk_rawtx_sign(struct supernet_info *myinfo,int32_t height,struct b txobj = bitcoin_txoutput(txobj,dest->spendscript,dest->spendlen,dest->amount); if ( (rawtxbytes= bitcoin_json2hex(myinfo,rawtx->coin,&dest->txid,txobj,V)) != 0 ) { - if ( rawtx == &swap->bobpayment || rawtx == &swap->alicepayment || rawtx == &swap->bobreclaim ) - printf("needsig.%d (%s) spend.%s rawtx.(%s) userdatalen.%d p2shlen.%d\n",needsig,jprint(txobj,0),rawtx->name,rawtxbytes,userdatalen,dest->redeemlen); if ( needsig == 0 ) signedtx = rawtxbytes; if ( signedtx != 0 || (signedtx= iguana_signrawtx(myinfo,rawtx->coin,height,&dest->signedtxid,&dest->completed,vins,rawtxbytes,privkeys,V)) != 0 ) { - if ( rawtx == &swap->bobpayment || rawtx == &swap->alicepayment || rawtx == &swap->bobreclaim ) - printf("rawtx spend signedtx.(%s)\n",signedtx); dest->datalen = (int32_t)strlen(signedtx) >> 1; dest->txbytes = calloc(1,dest->datalen); decode_hex(dest->txbytes,dest->datalen,signedtx); @@ -399,7 +395,7 @@ int32_t basilisk_rawtx_spendscript(struct supernet_info *myinfo,struct basilisk_ data = &recvbuf[3]; if ( rawtx->redeemlen > 0 && rawtx->redeemlen < 0x100 ) memcpy(rawtx->redeemscript,&data[datalen],rawtx->redeemlen); - printf("recvlen.%d datalen.%d redeemlen.%d\n",recvlen,datalen,rawtx->redeemlen); + //printf("recvlen.%d datalen.%d redeemlen.%d\n",recvlen,datalen,rawtx->redeemlen); if ( rawtx->txbytes == 0 ) { rawtx->txbytes = calloc(1,datalen); @@ -519,14 +515,16 @@ int32_t basilisk_bobpayment_reclaim(struct supernet_info *myinfo,struct basilisk int32_t basilisk_verify_bobpaid(struct supernet_info *myinfo,void *ptr,uint8_t *data,int32_t datalen) { - uint8_t userdata[512]; int32_t retval,len = 0; struct basilisk_swap *swap = ptr; + uint8_t userdata[512]; int32_t i,retval,len = 0; struct basilisk_swap *swap = ptr; if ( basilisk_rawtx_spendscript(myinfo,swap,swap->bobcoin->blocks.hwmchain.height,&swap->bobpayment,0,data,datalen,0) == 0 ) { - //basilisk_bobscripts_set(myinfo,swap,0,0); len = basilisk_swapuserdata(swap,userdata,swap->privAm,0,swap->myprivs[0],swap->bobpayment.redeemscript,swap->bobpayment.redeemlen); char str[65]; printf("bobpaid.(%s)\n",bits256_str(str,swap->privAm)); if ( (retval= basilisk_rawtx_sign(myinfo,swap->bobcoin->blocks.hwmchain.height,swap,&swap->alicespend,&swap->bobpayment,swap->myprivs[0],0,userdata,len)) == 0 ) { + for (i=0; ialicespend.datalen; i++) + printf("%02x",swap->alicespend.txbytes[i]); + printf(" <- alicespend\n\n"); basilisk_txlog(myinfo,swap,&swap->alicespend,-1); return(retval); } @@ -706,7 +704,7 @@ int32_t basilisk_rawtx_gen(char *str,struct supernet_info *myinfo,int32_t iambob void basilisk_bobscripts_set(struct supernet_info *myinfo,struct basilisk_swap *swap,int32_t depositflag,int32_t genflag) { - int32_t i; + int32_t i,j; char str[65]; if ( genflag != 0 && swap->iambob == 0 ) printf("basilisk_bobscripts_set WARNING: alice generating BOB tx\n"); if ( depositflag == 0 ) @@ -727,7 +725,13 @@ void basilisk_bobscripts_set(struct supernet_info *myinfo,struct basilisk_swap * } else { - printf("GENERATED BOB PAYMENT\n"); + for (j=0; jbobpayment.datalen; j++) + printf("%02x",swap->bobpayment.txbytes[j]); + printf(" <- bobdeposit.%d\n",swap->bobpayment.datalen); + for (j=0; jbobpayment.redeemlen; j++) + printf("%02x",swap->bobpayment.redeemscript[j]); + printf(" <- redeem.%d\n",swap->bobpayment.redeemlen); + printf("GENERATED BOB PAYMENT.(%s)\n",bits256_str(str,swap->bobpayment.actualtxid)); iguana_unspents_mark(myinfo,swap->bobcoin,swap->bobpayment.vins); basilisk_bobpayment_reclaim(myinfo,swap,INSTANTDEX_LOCKTIME); break; @@ -750,7 +754,13 @@ void basilisk_bobscripts_set(struct supernet_info *myinfo,struct basilisk_swap * } else { - printf("GENERATED BOB DEPOSIT\n"); + for (j=0; jbobdeposit.datalen; j++) + printf("%02x",swap->bobdeposit.txbytes[j]); + printf(" <- bobdeposit.%d\n",swap->bobdeposit.datalen); + for (j=0; jbobdeposit.redeemlen; j++) + printf("%02x",swap->bobdeposit.redeemscript[j]); + printf(" <- redeem.%d\n",swap->bobdeposit.redeemlen); + printf("GENERATED BOB DEPOSIT.(%s)\n",bits256_str(str,swap->bobdeposit.actualtxid)); iguana_unspents_mark(myinfo,swap->bobcoin,swap->bobdeposit.vins); basilisk_bobdeposit_refund(myinfo,swap,INSTANTDEX_LOCKTIME); break; @@ -770,7 +780,7 @@ int32_t basilisk_verify_privi(struct supernet_info *myinfo,void *ptr,uint8_t *da { for (j=0; j<32; j++) privkey.bytes[j] = data[len++]; - revcalc_rmd160_sha256(secret160,privkey);//.bytes,sizeof(privkey)); + revcalc_rmd160_sha256(secret160,privkey); memcpy(&txid,secret160,sizeof(txid)); pubi = bitcoin_pubkey33(myinfo->ctx,pubkey33,privkey); if ( basilisk_verify_pubpair(&wrongfirstbyte,swap,swap->choosei,pubkey33[0],pubi,txid) == 0 ) diff --git a/iguana/coins/genanc b/iguana/coins/genanc index a658b9e14..f860d74a8 100755 --- a/iguana/coins/genanc +++ b/iguana/coins/genanc @@ -1 +1 @@ -curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"ANC\",\"name\":\"AnonCoin\",\"netmagic\":\"facabada\",\"p2p\":9377,\"rpc\":28332,\"pubval\":23,\"p2shval\":5,\"wifval\":151,\"txfee_satoshis\":\"2000000\",\"minconfirms\":2,\"genesishash\":\"00000be19c5a519257aa921349037d55548af7cabf112741eb905a26bb73e468\",\"genesis\":{\"version\":1,\"timestamp\":1370190760,\"nBits\":\"1e0ffff0\",\"nonce\":347089008,\"merkle_root\":\"7ce7004d764515f9b43cb9f07547c8e2e00d94c9348b3da33c8681d350f2c736\"},\"alertpubkey\":\"04c6db35c11724e526f6725cc5bd5293b4bc9382397856e1bcef7111fb44ce357fd12442b34c496d937a348c1dca1e36ae0c0e128905eb3d301433887e8f0b4536\"}" +curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"ANC\",\"name\":\"AnonCoin\",\"netmagic\":\"facabada\",\"p2p\":9377,\"rpc\":28332,\"pubval\":23,\"p2shval\":5,\"wifval\":151,\"txfee_satoshis\":\"2000000\",\"minconfirms\":2,\"genesishash\":\"00000be19c5a519257aa921349037d55548af7cabf112741eb905a26bb73e468\",\"genesis\":{\"version\":1,\"timestamp\":1370190760,\"nBits\":\"1e0ffff0\",\"nonce\":347089008,\"merkle_root\":\"7ce7004d764515f9b43cb9f07547c8e2e00d94c9348b3da33c8681d350f2c736\"},\"alertpubkey\":\"04c6db35c11724e526f6725cc5bd5293b4bc9382397856e1bcef7111fb44ce357fd12442b34c496d937a348c1dca1e36ae0c0e128905eb3d301433887e8f0b4536\",\"protover\":70010}" diff --git a/iguana/coins/genanc.json b/iguana/coins/genanc.json index f55052f2b..3c192deed 100755 --- a/iguana/coins/genanc.json +++ b/iguana/coins/genanc.json @@ -1 +1 @@ -{"RELAY":1,"VALIDATE":1,"prefetchlag":-1,"poll":10,"active":1,"agent":"iguana","method":"addcoin","maxpeers":256,"newcoin":"ANC","name":"AnonCoin","netmagic":"facabada","p2p":9377,"rpc":28332,"pubval":23,"p2shval":5,"wifval":151,"txfee_satoshis":"2000000","minconfirms":2,"genesishash":"00000be19c5a519257aa921349037d55548af7cabf112741eb905a26bb73e468","genesis":{"version":1,"timestamp":1370190760,"nBits":"1e0ffff0","nonce":347089008,"merkle_root":"7ce7004d764515f9b43cb9f07547c8e2e00d94c9348b3da33c8681d350f2c736"},"alertpubkey":"04c6db35c11724e526f6725cc5bd5293b4bc9382397856e1bcef7111fb44ce357fd12442b34c496d937a348c1dca1e36ae0c0e128905eb3d301433887e8f0b4536"} +{"RELAY":1,"VALIDATE":1,"prefetchlag":-1,"poll":10,"active":1,"agent":"iguana","method":"addcoin","maxpeers":256,"newcoin":"ANC","name":"AnonCoin","netmagic":"facabada","p2p":9377,"rpc":28332,"pubval":23,"p2shval":5,"wifval":151,"txfee_satoshis":"2000000","minconfirms":2,"genesishash":"00000be19c5a519257aa921349037d55548af7cabf112741eb905a26bb73e468","genesis":{"version":1,"timestamp":1370190760,"nBits":"1e0ffff0","nonce":347089008,"merkle_root":"7ce7004d764515f9b43cb9f07547c8e2e00d94c9348b3da33c8681d350f2c736"},"alertpubkey":"04c6db35c11724e526f6725cc5bd5293b4bc9382397856e1bcef7111fb44ce357fd12442b34c496d937a348c1dca1e36ae0c0e128905eb3d301433887e8f0b4536",\"protover\":70010} diff --git a/iguana/iguana_payments.c b/iguana/iguana_payments.c index ff5f94ac9..79483bec0 100755 --- a/iguana/iguana_payments.c +++ b/iguana/iguana_payments.c @@ -338,7 +338,7 @@ char *iguana_signrawtx(struct supernet_info *myinfo,struct iguana_info *coin,int if ( flag != 0 ) free_json(privkeys); } - char str[65]; printf("completed.%d %s signed.(%s)\n",*completedp,bits256_str(str,*signedtxidp),signedtx!=0?signedtx:""); + //char str[65]; printf("completed.%d %s signed.(%s)\n",*completedp,bits256_str(str,*signedtxidp),signedtx!=0?signedtx:""); return(signedtx); }