diff --git a/basilisk/basilisk_bitcoin.c b/basilisk/basilisk_bitcoin.c index 308cf51c7..388a4fb60 100755 --- a/basilisk/basilisk_bitcoin.c +++ b/basilisk/basilisk_bitcoin.c @@ -563,7 +563,7 @@ char *basilisk_bitcoinrawtx(struct supernet_info *myinfo,struct iguana_info *coi } else oplen = datachain_opreturnscript(coin,buf,opreturn,oplen); } rawtx = iguana_calcrawtx(myinfo,coin,&vins,txobj,amount,changeaddr,txfee,addresses,minconf,oplen!=0?buf:0,oplen+offset,burnamount,remoteaddr); - printf("generated.(%s) vins.(%s)\n",rawtx!=0?rawtx:"",vins!=0?jprint(vins,0):""); + //printf("generated.(%s) vins.(%s)\n",rawtx!=0?rawtx:"",vins!=0?jprint(vins,0):""); } if ( rawtx != 0 ) { diff --git a/iguana/coins/genblk b/iguana/coins/genblk new file mode 100755 index 000000000..1103b8501 --- /dev/null +++ b/iguana/coins/genblk @@ -0,0 +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\":\"BLK\",\"name\":\"BlackCoin\",\"netmagic\":\"70352205\",\"p2p\":15714,\"rpc\":15715,\"pubval\":25,\"p2shval\":85,\"wifval\":153,\"txfee_satoshis\":\"10000\",\"minconfirms\":2,\"genesishash\":\"000001faef25dec4fbcf906e6242621df2c183bf232f263d0ba5b101911e4563\",\"genesis\":{\"hashalgo\":\"scrypt\",\"version\":1,\"timestamp\":1393221600,\"nBits\":\"1e0fffff\",\"nonce\":164482,\"merkle_root\":\"12630d16a97f24b287c8c2594dda5fb98c9e6c70fc61d44191931ea2aa08dc90\"},\"alertpubkey\":\"0486bce1bac0d543f104cbff2bd23680056a3b9ea05e1137d2ff90eeb5e08472eb500322593a2cb06fbf8297d7beb6cd30cb90f98153b5b7cce1493749e41e0284\",\"isPoS\":1}" diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 5e693ee33..034069ccc 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -1548,7 +1548,7 @@ void iguana_bundlestats(struct supernet_info *myinfo,struct iguana_info *coin,ch fprintf(logfp,"%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,numbQ,(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck); fflush(logfp); } - //printf("%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,numbQ,(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck); + printf("%s bQ.%d %d:%02d:%02d stuck.%d max.%d\n",str,numbQ,(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,coin->stucktime!=0?(uint32_t)time(NULL) - coin->stucktime:0,coin->maxstuck); strcpy(coin->lastdispstr,str); if ( (rand() % 100) == 0 ) myallocated(0,0); diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index 40f3c5292..ade8d87c3 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -724,12 +724,12 @@ void iguana_startconnection(void *arg) printf("iguana_startconnection.%s:%04x mismatched coin.%p (%s) vs (%s)\n",addr->ipaddr,coin->chain->portp2p,coin,coin->symbol,addr->coinname); return; } - if ( strcmp("85.25.217.233",addr->ipaddr) == 0 ) + /*if ( strcmp("85.25.217.233",addr->ipaddr) == 0 ) { printf("temp blacklist %s\n",addr->ipaddr); iguana_iAkill(coin,addr,1); return; - } + }*/ //printf("%s iguana_startconnection.%s:%04x\n",coin->symbol,addr->ipaddr,coin->chain->portp2p); if ( strcmp("127.0.0.1",addr->ipaddr) == 0 )//&& (coin->myservices & NODE_NETWORK) != 0 ) { diff --git a/iguana/iguana_scripts.c b/iguana/iguana_scripts.c index 7466352db..6e9220a43 100755 --- a/iguana/iguana_scripts.c +++ b/iguana/iguana_scripts.c @@ -446,6 +446,18 @@ int32_t iguana_calcrmd160(struct iguana_info *coin,char *asmstr,struct vin_info return(vp->type); } +char *iguana_scriptaddress(struct iguana_info *coin,char *coinaddr,uint8_t *script,int32_t scriptlen) +{ + struct vin_info V; + iguana_calcrmd160(coin,0,&V,script,scriptlen,GENESIS_PUBKEY,0,0xffffffff); + if ( V.coinaddr[0] != 0 ) + { + strcpy(coinaddr,V.coinaddr); + return(coinaddr); + } + return(0); +} + //error memalloc mem.0x7f6fc6e4a2a8 94.242.229.158 alloc 1 used 2162688 totalsize.2162688 -> 94.242.229.158 (nil) int32_t bitcoin_scriptget(struct iguana_info *coin,int32_t *hashtypep,uint32_t *sigsizep,uint32_t *pubkeysizep,uint8_t **userdatap,uint32_t *userdatalenp,struct vin_info *vp,uint8_t *scriptsig,int32_t len,int32_t spendtype) diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index d37962f77..ff02eba83 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -988,7 +988,7 @@ int32_t iguana_RTunspentslists(struct supernet_info *myinfo,struct iguana_info * iguana_outptset(myinfo,coin,&outpt,jbits256(item,"txid"),jint(item,"vout"),jdouble(item,"amount") * SATOSHIDEN,spendscriptstr); *unspents = outpt; sum += outpt.value; - printf("ITEM.(%s) %.8f\n",jprint(item,0),dstr(outpt.value)); + //printf("ITEM.(%s) %.8f\n",jprint(item,0),dstr(outpt.value)); unspents++; numunspents++; if ( numunspents > max || sum > required ) diff --git a/iguana/iguana_wallet.c b/iguana/iguana_wallet.c index b0e0f8846..173e352c5 100755 --- a/iguana/iguana_wallet.c +++ b/iguana/iguana_wallet.c @@ -950,13 +950,31 @@ int64_t oldiguana_waccountbalance(struct supernet_info *myinfo,struct iguana_inf cJSON *iguana_privkeysjson(struct supernet_info *myinfo,struct iguana_info *coin,cJSON *vins) { - int32_t i,j,n,numinputs; struct iguana_waddress *waddr; struct iguana_outpoint spentpt; struct iguana_waccount *wacct; char *addresses,*address,coinaddr[64]; cJSON *privkeys = cJSON_CreateArray(); + int32_t i,j,n,numinputs,scriptlen; struct iguana_waddress *waddr; struct iguana_waccount *wacct; char *addresses,*address,*scripthexstr,coinaddr[64]; cJSON *scriptobj,*privkeys,*item; uint8_t spendscript[IGUANA_MAXSCRIPTSIZE]; + privkeys = cJSON_CreateArray(); if ( (numinputs= cJSON_GetArraySize(vins)) > 0 ) { addresses = calloc(numinputs,64); for (i=n=0; i> 1; + decode_hex(spendscript,scriptlen,scripthexstr); + address = iguana_scriptaddress(coin,coinaddr,spendscript,scriptlen); + } + } + //if ( (address= iguana_RTinputaddress(myinfo,coin,coinaddr,&spentpt,jitem(vins,i))) != 0 ) + if ( address != 0 ) { for (j=0; jFULLNODE == 0 && coin->VALIDATENODE == 0 && (n= cJSON_GetArraySize(array)) > 1 ) + if ( coin->FULLNODE == 0 && coin->VALIDATENODE == 0 && (n= cJSON_GetArraySize(array)) > 0 ) { jdelete(getinfoobj,"longestchain"); for (i=0; i longest ) - longest = juint(getinfoobj,"longestchain"); + if ( juint(item,"longestchain") > longest ) + longest = juint(item,"longestchain"); + if ( juint(item,"RTheight") > coin->RTheight ) + { + coin->RTheight = juint(item,"RTheight"); + coin->firstRTheight = juint(item,"firstRTheight"); + printf("set RTheight.%d 1st %d\n",coin->RTheight,coin->firstRTheight); + } if ( (fullnodes= jarray(&m,item,"supernet")) != 0 ) { for (j=0; j