From 4542884bffd7bce630d80cdcf03b1e412c10dc40 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 16 Sep 2016 07:56:49 -0300 Subject: [PATCH] test --- deprecated/obsolete.h | 47 +++++++++++++++++++++++++++ iguana/coins/gengmc | 2 +- iguana/coins/gensys | 2 +- iguana/iguana_chains.c | 1 + iguana/iguana_ramchain.c | 63 ++++++------------------------------ iguana/iguana_spendvectors.c | 4 ++- includes/iguana_structs.h | 2 +- 7 files changed, 63 insertions(+), 58 deletions(-) diff --git a/deprecated/obsolete.h b/deprecated/obsolete.h index 8e74114d6..919eed598 100755 --- a/deprecated/obsolete.h +++ b/deprecated/obsolete.h @@ -19107,3 +19107,50 @@ len = 0; return(flag); } #endif + /*if ( (checklen= iguana_vinscriptdecode(coin,ramchain,&metalen,_script,&Kspace[rdata->scriptspace],Kspace,s)) != vinscriptlen || (vinscript != 0 && memcmp(_script,vinscript,vinscriptlen) != 0) ) + { + static uint64_t counter; + if ( counter++ < 100 ) + { + for (i=0; iH.scriptoffset += metalen; + + + /*static uint64_t good,bad; + if ( 0 && iguana_metascript(coin,RAMCHAIN_ARG,s,vinscript,vinscriptlen,0) < 0 ) + { + static long errlen,err2len; char errbuf[1024]; + errlen += vinscriptlen; + if ( iguana_metascript(coin,RAMCHAIN_ARG,s,vinscript,vinscriptlen,1) < 0 ) + { + err2len += vinscriptlen; + errbuf[0] = 0; + for (i=0; i 138 ) + { + errbuf[0] = 0; + for (i=0; ihdrsi = hdrsi; + //s->bundlei = bundlei; + //char str[65]; printf("%s set prevout.%d -> %d\n",bits256_str(str,prev_hash),prev_vout,s->prevout); + //if ( pkind != 0 ) + // s->prevspendind = A[pkind].lastspendind; diff --git a/iguana/coins/gengmc b/iguana/coins/gengmc index c5a55621e..f192a8a36 100755 --- a/iguana/coins/gengmc +++ b/iguana/coins/gengmc @@ -1 +1 @@ -curl --url "http://127.0.0.1:7778" --data "{\"startpend\":8,\"endpend\":4,\"services\":129,\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"GMC\",\"name\":\"GameCredits\",\"netmagic\":\"fbc0b6db\",\"p2p\":40002,\"rpc\":40001,\"pubval\":38,\"p2shval\":5,\"wifval\":166,\"txfee_satoshis\":\"100000\",\"minconfirms\":2,\"genesishash\":\"91ec5f25ee9a0ffa1af7d4da4db9a552228dd2dc77cdb15b738be4e1f55f30ee\",\"genesis\":{\"hashalgo\":\"scrypt\",\"version\":1,\"timestamp\":1392757140,\"nBits\":\"1e0ffff0\",\"nonce\":2084565393,\"merkle_root\":\"d849db99a14164f4b4c8ad6d2d8d7e2b1ba7f89963e9f4bf9fad5ff1a4754429\"},\"alertpubkey\":\"04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284\",\"auxpow\":1,\"protover\":80006,\"isPoS\":0}" +curl --url "http://127.0.0.1:7778" --data "{\"startpend\":8,\"endpend\":4,\"services\":129,\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"maxpeers\":256,\"newcoin\":\"GMC\",\"name\":\"GameCredits\",\"netmagic\":\"fbc0b6db\",\"p2p\":40002,\"rpc\":40001,\"pubval\":38,\"p2shval\":5,\"wifval\":166,\"txfee_satoshis\":\"100000\",\"minconfirms\":2,\"genesishash\":\"91ec5f25ee9a0ffa1af7d4da4db9a552228dd2dc77cdb15b738be4e1f55f30ee\",\"genesis\":{\"hashalgo\":\"scrypt\",\"version\":1,\"timestamp\":1392757140,\"nBits\":\"1e0ffff0\",\"nonce\":2084565393,\"merkle_root\":\"d849db99a14164f4b4c8ad6d2d8d7e2b1ba7f89963e9f4bf9fad5ff1a4754429\"},\"alertpubkey\":\"04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284\",\"auxpow\":1,\"protover\":80006,\"isPoS\":0,"fixit"1}" diff --git a/iguana/coins/gensys b/iguana/coins/gensys index 209e33213..b16b254e1 100755 --- a/iguana/coins/gensys +++ b/iguana/coins/gensys @@ -1,2 +1,2 @@ -curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":18,\"endpend\":18,\"services\":129,\"maxpeers\":256,\"newcoin\":\"SYS\",\"name\":\"SYScoin\",\"hasheaders\":0,\"useaddmultisig\":0,\"netmagic\":\"f9beb4d9\",\"p2p\":8369,\"rpc\":8370,\"pubval\":0,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"100000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"0000072d66e51ab87de265765cc8bdd2d229a4307c672a1b3d5af692519cf765\",\"genesis\":{\"version\":1,\"timestamp\":1450473723,\"nBits\":\"1e0ffff0\",\"nonce\":5258726,\"merkle_root\":\"5215c5a2af9b63f2550b635eb2b354bb13645fd8fa31275394eb161944303065\"},\"protover\":70012,\"auxpow\":1}" +curl --url "http://127.0.0.1:7778" --data "{\"RELAY\":1,\"VALIDATE\":1,\"prefetchlag\":-1,\"poll\":10,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":18,\"endpend\":18,\"services\":129,\"maxpeers\":256,\"newcoin\":\"SYS\",\"name\":\"SYScoin\",\"hasheaders\":0,\"useaddmultisig\":0,\"netmagic\":\"f9beb4d9\",\"p2p\":8369,\"rpc\":8370,\"pubval\":0,\"p2shval\":5,\"wifval\":128,\"txfee_satoshis\":\"100000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"0000072d66e51ab87de265765cc8bdd2d229a4307c672a1b3d5af692519cf765\",\"genesis\":{\"version\":1,\"timestamp\":1450473723,\"nBits\":\"1e0ffff0\",\"nonce\":5258726,\"merkle_root\":\"5215c5a2af9b63f2550b635eb2b354bb13645fd8fa31275394eb161944303065\"},\"protover\":70012,\"auxpow\":1,"fixit":1}" diff --git a/iguana/iguana_chains.c b/iguana/iguana_chains.c index 6e8911ea6..eb073d680 100755 --- a/iguana/iguana_chains.c +++ b/iguana/iguana_chains.c @@ -342,6 +342,7 @@ void iguana_chainparms(struct supernet_info *myinfo,struct iguana_chain *chain,c } chain->zcash = juint(argjson,"zcash"); chain->debug = juint(argjson,"debug"); + chain->fixit = juint(argjson,"fixit"); if ( (chain->normal_txversion= juint(argjson,"normal_txversion")) == 0 ) chain->normal_txversion = IGUANA_NORMAL_TXVERSION; if ( (chain->locktime_txversion= juint(argjson,"locktime_txversion")) == 0 ) diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index 48ec5b69d..2b38a2555 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -341,8 +341,8 @@ uint32_t iguana_ramchain_addunspent20(struct iguana_info *coin,struct iguana_pee printf("error writing vout scriptlen.%d errno.%d or scriptpos.%lld != %u\n",scriptlen,errno,(long long)scriptpos,u->scriptpos); else { - fflush(addr->voutsfp); - usleep(1000); + //fflush(addr->voutsfp); + //usleep(1000); addr->dirty[0]++; } #ifdef __PNACL__ @@ -353,7 +353,7 @@ uint32_t iguana_ramchain_addunspent20(struct iguana_info *coin,struct iguana_pee } } u->txidind = ramchain->H.txidind; - if ( 0 && vout > 0 ) + if ( coin->chain->fixit != 0 && vout > 0 ) { int32_t i; for (i=0; i<20; i++) printf("%02x",rmd160[i]); @@ -510,21 +510,6 @@ uint32_t iguana_ramchain_addspend(struct iguana_info *coin,RAMCHAIN_FUNC,bits256 char str[65],str2[65]; printf("ramchain_addspend RO value mismatch diffseq.%x v %x (%d) vs (%d) %s vs %s\n",s->sequenceid,sequence,s->prevout,prev_vout,bits256_str(str,txid),bits256_str(str2,prev_hash)); return(0); } - /*if ( (checklen= iguana_vinscriptdecode(coin,ramchain,&metalen,_script,&Kspace[rdata->scriptspace],Kspace,s)) != vinscriptlen || (vinscript != 0 && memcmp(_script,vinscript,vinscriptlen) != 0) ) - { - static uint64_t counter; - if ( counter++ < 100 ) - { - for (i=0; iH.scriptoffset += metalen; } else { @@ -534,36 +519,6 @@ uint32_t iguana_ramchain_addspend(struct iguana_info *coin,RAMCHAIN_FUNC,bits256 s->fileid = fileid; s->scriptpos = scriptpos; s->scriptlen = vinscriptlen; - /*static uint64_t good,bad; - if ( 0 && iguana_metascript(coin,RAMCHAIN_ARG,s,vinscript,vinscriptlen,0) < 0 ) - { - static long errlen,err2len; char errbuf[1024]; - errlen += vinscriptlen; - if ( iguana_metascript(coin,RAMCHAIN_ARG,s,vinscript,vinscriptlen,1) < 0 ) - { - err2len += vinscriptlen; - errbuf[0] = 0; - for (i=0; i 138 ) - { - errbuf[0] = 0; - for (i=0; ihdrsi = hdrsi; - //s->bundlei = bundlei; - //char str[65]; printf("%s set prevout.%d -> %d\n",bits256_str(str,prev_hash),prev_vout,s->prevout); - //if ( pkind != 0 ) - // s->prevspendind = A[pkind].lastspendind; } if ( pkind != 0 ) { @@ -610,8 +565,8 @@ uint32_t iguana_ramchain_addspend256(struct iguana_info *coin,struct iguana_peer else { addr->dirty[1]++; - fflush(addr->vinsfp); - usleep(1000); + //fflush(addr->vinsfp); + //usleep(1000); } #ifdef __PNACL__ //portable_mutex_unlock(&mutex); @@ -1092,7 +1047,7 @@ long iguana_ramchain_save(struct iguana_info *coin,RAMCHAIN_FUNC,uint32_t ipbits fpos = -1; } else iguana_ramchain_saveaction(fname,RAMCHAIN_ARG,fp,rdata,bp!=0?bp->n:1,ramchain->H.scriptoffset,zcash); *rdata = tmp; - fflush(fp); + //fflush(fp); fclose(fp); //sleep(3); } @@ -1941,10 +1896,10 @@ long iguana_ramchain_data(struct iguana_info *coin,struct iguana_peer *addr,stru //char str[65]; printf("saved.%s [%d:%d] fpos.%d datalen.%d\n",bits256_str(str,block->RO.hash2),bp->hdrsi,bundlei,fpos,origtxdata->datalen); ramchain->H.ROflag = 0; flag = 1; - /*if ( addr->voutsfp != 0 ) //addr->dirty[0] != 0 && + if ( addr->dirty[0] != 0 && addr->voutsfp != 0 ) // fflush(addr->voutsfp); - if ( addr->vinsfp != 0 ) //addr->dirty[1] != 0 && - fflush(addr->vinsfp);*/ + if ( addr->dirty[1] != 0 && addr->vinsfp != 0 ) //addr->dirty[1] != 0 && + fflush(addr->vinsfp); memset(&R,0,sizeof(R)); if ( verifyflag != 0 && (mapchain= iguana_ramchain_map(coin,fname,0,1,&R,0,(uint32_t)addr->ipbits,block->RO.hash2,block->RO.prev_block,bundlei,fpos,1,0)) == 0 ) { diff --git a/iguana/iguana_spendvectors.c b/iguana/iguana_spendvectors.c index 098889570..2a6b4c9c6 100755 --- a/iguana/iguana_spendvectors.c +++ b/iguana/iguana_spendvectors.c @@ -1138,7 +1138,9 @@ int32_t iguana_bundlevalidate(struct supernet_info *myinfo,struct iguana_info *c iguana_volatilesmap(coin,&bp->ramchain); for (i=0; in; i++) { - //char str[65]; printf("validate %s.[%d:%d] %s\n",coin->symbol,bp->hdrsi,i,bits256_str(str,bp->hashes[i])); + char str[65]; + if ( coin->chain->fixit != 0 ) + printf("validate %s.[%d:%d] %s\n",coin->symbol,bp->hdrsi,i,bits256_str(str,bp->hashes[i])); if ( (len= iguana_peerblockrequest(myinfo,coin,blockspace,max,0,bp->hashes[i],1)) < 0 ) { errs++; diff --git a/includes/iguana_structs.h b/includes/iguana_structs.h index f690ed153..c253b6580 100755 --- a/includes/iguana_structs.h +++ b/includes/iguana_structs.h @@ -55,7 +55,7 @@ struct iguana_chain char use_addmultisig,do_opreturn; int32_t estblocktime,protover; bits256 genesishash2,PoWtarget,PoStargets[16]; int32_t numPoStargets,PoSheights[16]; - uint8_t zcash,auxpow,debug,havecltv,alertpubkey[65]; + uint8_t zcash,fixit,auxpow,debug,havecltv,alertpubkey[65]; uint16_t targetspacing,targettimespan; uint32_t nBits,normal_txversion,locktime_txversion; };