From c4aa8becdafecb758d4e5760ef8cb4040fd5976f Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 20 Jul 2016 17:46:52 -0300 Subject: [PATCH] test --- iguana/iguana777.c | 2 +- iguana/iguana_volatiles.c | 14 ++++++++++---- iguana/main.c | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 5d76ebef3..4b42b361d 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -566,7 +566,7 @@ void iguana_helper(void *arg) //portable_mutex_lock(&myinfo->allcoins_mutex); HASH_ITER(hh,myinfo->allcoins,coin,tmp) { - if ( 1 || coin->spendvectorsaved == 1 ) + if ( coin->spendvectorsaved == 1 ) iguana_utxogen(myinfo,coin,helperid,0); else if ( coin->spendvectorsaved > 1 ) { diff --git a/iguana/iguana_volatiles.c b/iguana/iguana_volatiles.c index f2ad68f86..65d08716b 100755 --- a/iguana/iguana_volatiles.c +++ b/iguana/iguana_volatiles.c @@ -217,11 +217,17 @@ int32_t iguana_volatileupdate(struct iguana_info *coin,int32_t incremental,struc printf("from.%d vs current.%d\n",fromheight,coin->current->bundleheight); iguana_bundleremove(coin,fromheight/coin->chain->bundlesize,0); } - if ( coin->current != 0 && spent_hdrsi != coin->current->hdrsi ) - iguana_bundleremove(coin,spent_hdrsi,0); coin->spendvectorsaved = 0; coin->started = 0; coin->active = 0;*/ + if ( coin->current != 0 && spent_hdrsi != coin->current->hdrsi && spent_hdrsi != fromheight/coin->chain->bundlesize ) + { + iguana_bundleremove(coin,spent_hdrsi,0); + iguana_bundleremove(coin,fromheight/coin->chain->bundlesize,0); + printf("restart iguana\n"); + sleep(3); + exit(-1); + } } else if ( coin->spendvectorsaved > 1 ) printf("volatileupdate skip null rdata [%d]\n",spentchain->height/coin->current->bundleheight); @@ -328,7 +334,7 @@ int32_t iguana_volatilesmap(struct iguana_info *coin,struct iguana_ramchain *ram coin->balancehash = balancehash; coin->allbundles = allbundles; } - if ( numhdrsi == coin->balanceswritten && memcmp(balancehash.bytes,coin->balancehash.bytes,sizeof(balancehash)) == 0 && memcmp(allbundles.bytes,coin->allbundles.bytes,sizeof(allbundles)) == 0 ) + if ( numhdrsi >= coin->balanceswritten-1 && memcmp(balancehash.bytes,coin->balancehash.bytes,sizeof(balancehash)) == 0 && memcmp(allbundles.bytes,coin->allbundles.bytes,sizeof(allbundles)) == 0 ) { ramchain->A2 = (void *)((long)ramchain->debitsfileptr + sizeof(numhdrsi) + 2*sizeof(bits256)); sprintf(fname,"%s/%s%s/accounts/lastspends.%d",GLOBAL_DBDIR,iter==0?"ro/":"",coin->symbol,ramchain->height); @@ -337,7 +343,7 @@ int32_t iguana_volatilesmap(struct iguana_info *coin,struct iguana_ramchain *ram numhdrsi = *(int32_t *)ramchain->lastspendsfileptr; memcpy(balancehash.bytes,(void *)((long)ramchain->lastspendsfileptr + sizeof(numhdrsi)),sizeof(balancehash)); memcpy(allbundles.bytes,(void *)((long)ramchain->lastspendsfileptr + sizeof(numhdrsi) + sizeof(balancehash)),sizeof(allbundles)); - if ( numhdrsi == coin->balanceswritten && memcmp(balancehash.bytes,coin->balancehash.bytes,sizeof(balancehash)) == 0 && memcmp(allbundles.bytes,coin->allbundles.bytes,sizeof(allbundles)) == 0 ) + if ( numhdrsi >= coin->balanceswritten-1 && memcmp(balancehash.bytes,coin->balancehash.bytes,sizeof(balancehash)) == 0 && memcmp(allbundles.bytes,coin->allbundles.bytes,sizeof(allbundles)) == 0 ) { ramchain->Uextras = (void *)((long)ramchain->lastspendsfileptr + sizeof(numhdrsi) + 2*sizeof(bits256)); ramchain->from_roU = (iter == 0); diff --git a/iguana/main.c b/iguana/main.c index 3aab974ed..48c968864 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -503,10 +503,10 @@ void iguana_appletests(struct supernet_info *myinfo) bitcoin_sharedsecret(myinfo->ctx,hash2,pubkey,33); printf("secp256k1 elapsed %.3f for %d iterations\n",OS_milliseconds() - startmillis,i); getchar();**/ - if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":1,\"VALIDATE\":0,\"portp2p\":14631,\"rpc\":14632,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":8,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":1}"),0,myinfo->rpcport)) != 0 ) + if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"protover\":70002,\"RELAY\":1,\"VALIDATE\":0,\"portp2p\":14631,\"rpc\":14632,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":64,\"endpend\":64,\"services\":129,\"maxpeers\":8,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":1}"),0,myinfo->rpcport)) != 0 ) { free(str); - if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"portp2p\":8333,\"RELAY\":0,\"VALIDATE\":0,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":8,\"newcoin\":\"BTC\",\"active\":0,\"numhelpers\":1,\"poll\":100}"),0,myinfo->rpcport)) != 0 ) + if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"portp2p\":8333,\"RELAY\":0,\"VALIDATE\":0,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":1,\"endpend\":1,\"services\":128,\"maxpeers\":8,\"newcoin\":\"BTC\",\"active\":0,\"numhelpers\":1,\"poll\":100}"),0,myinfo->rpcport)) != 0 ) { free(str); if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"agent\":\"SuperNET\",\"method\":\"login\",\"handle\":\"alice\",\"password\":\"alice\",\"passphrase\":\"alice\"}"),0,myinfo->rpcport)) != 0 )