Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
77b47fd347
  1. 28
      basilisk/basilisk.c
  2. 4
      basilisk/basilisk.h
  3. 16
      gecko/gecko.c
  4. 3
      gecko/gecko.h
  5. 21
      gecko/gecko_blocks.c
  6. 4
      gecko/gecko_delayedPoW.c
  7. 21
      gecko/gecko_miner.c
  8. 2
      iguana/iguana_chains.c
  9. 18
      iguana/iguana_init.c

28
basilisk/basilisk.c

@ -60,21 +60,21 @@ char *basilisk_addhexstr(char **ptrp,cJSON *valsobj,char *strbuf,int32_t strsize
return(strbuf); return(strbuf);
} }
uint8_t *get_dataptr(uint8_t **ptrp,int32_t *datalenp,uint8_t *space,int32_t spacesize,char *hexstr) uint8_t *get_dataptr(int32_t hdroffset,uint8_t **ptrp,int32_t *datalenp,uint8_t *space,int32_t spacesize,char *hexstr)
{ {
*ptrp = 0; uint8_t *data = 0; uint32_t basilisktag; *ptrp = 0; uint8_t *data = 0;
if ( hexstr != 0 && (*datalenp= is_hexstr(hexstr,0)) > 0 ) if ( hexstr != 0 && (*datalenp= is_hexstr(hexstr,0)) > 0 )
{ {
*datalenp >>= 1; *datalenp >>= 1;
if ( (*datalenp+BASILISK_HDROFFSET) <= spacesize ) if ( (*datalenp+hdroffset) <= spacesize )
{ {
memset(space,0,BASILISK_HDROFFSET); memset(space,0,hdroffset);
data = &space[BASILISK_HDROFFSET]; data = &space[hdroffset];
} else *ptrp = data = calloc(1,*datalenp + BASILISK_HDROFFSET); } else *ptrp = data = calloc(1,*datalenp + hdroffset);
decode_hex(&data[BASILISK_HDROFFSET],*datalenp,hexstr); decode_hex(&data[hdroffset],*datalenp,hexstr);
} }
if ( data != 0 ) if ( data != 0 )
return(&data[BASILISK_HDROFFSET]); return(&data[hdroffset]);
else return(data); else return(data);
} }
@ -269,14 +269,15 @@ int32_t basilisk_blocksubmit(struct supernet_info *myinfo,struct iguana_info *vi
if ( virt->TXMEM.ptr == 0 ) if ( virt->TXMEM.ptr == 0 )
iguana_meminit(&virt->TXMEM,virt->name,0,IGUANA_MAXPACKETSIZE * 2,0); iguana_meminit(&virt->TXMEM,virt->name,0,IGUANA_MAXPACKETSIZE * 2,0);
iguana_memreset(&virt->TXMEM); iguana_memreset(&virt->TXMEM);
if ( (data= get_dataptr(&allocptr,&recvlen,space,sizeof(space),blockstr)) != 0 ) if ( (data= get_dataptr(BASILISK_HDROFFSET,&allocptr,&recvlen,space,sizeof(space),blockstr)) != 0 )
{ {
memset(&txdata,0,sizeof(txdata)); memset(&txdata,0,sizeof(txdata));
if ( (n= iguana_gentxarray(virt,&virt->TXMEM,&txdata,&len,data,recvlen)) == recvlen ) if ( (n= iguana_gentxarray(virt,&virt->TXMEM,&txdata,&len,data,recvlen)) == recvlen )
{ {
len = n; len = n;
memset(&H,0,sizeof(H)); memset(&H,0,sizeof(H));
iguana_gotblockM(virt,&virt->internaladdr,&txdata,virt->TXMEM.ptr,&H,data,recvlen); gecko_blockarrived(myinfo,&virt->internaladdr,0,data,recvlen);
//iguana_gotblockM(virt,&virt->internaladdr,&txdata,virt->TXMEM.ptr,&H,data,recvlen);
} }
} }
if ( allocptr != 0 ) if ( allocptr != 0 )
@ -407,7 +408,7 @@ char *basilisk_standardservice(char *CMD,struct supernet_info *myinfo,bits256 ha
{ {
uint32_t nBits = 0; uint8_t space[8192],*allocptr=0,*data = 0; struct basilisk_item *ptr,Lptr; int32_t datalen = 0; cJSON *retjson; uint32_t nBits = 0; uint8_t space[8192],*allocptr=0,*data = 0; struct basilisk_item *ptr,Lptr; int32_t datalen = 0; cJSON *retjson;
retjson = cJSON_CreateObject(); retjson = cJSON_CreateObject();
data = get_dataptr(&allocptr,&datalen,space,sizeof(space),hexstr); data = get_dataptr(BASILISK_HDROFFSET,&allocptr,&datalen,space,sizeof(space),hexstr);
ptr = basilisk_requestservice(myinfo,CMD,valsobj,hash,data,datalen,nBits); ptr = basilisk_requestservice(myinfo,CMD,valsobj,hash,data,datalen,nBits);
if ( allocptr != 0 ) if ( allocptr != 0 )
free(allocptr); free(allocptr);
@ -738,9 +739,6 @@ HASH_ARRAY_STRING(basilisk,VPNlogout,pubkey,vals,hexstr)
void basilisks_loop(void *arg) void basilisks_loop(void *arg)
{ {
basilisk_metricfunc metricfunc; struct iguana_info *btcd,*virt,*hhtmp; struct basilisk_item *ptr,*tmp,*pending,*parent; int32_t i,iter,maxmillis,done,flag,n; cJSON *valsobj,*retjson; uint32_t now; struct supernet_info *myinfo = arg; basilisk_metricfunc metricfunc; struct iguana_info *btcd,*virt,*hhtmp; struct basilisk_item *ptr,*tmp,*pending,*parent; int32_t i,iter,maxmillis,done,flag,n; cJSON *valsobj,*retjson; uint32_t now; struct supernet_info *myinfo = arg;
//uint8_t *blockspace; struct OS_memspace RAWMEM;
//memset(&RAWMEM,0,sizeof(RAWMEM));
//blockspace = calloc(1,IGUANA_MAXPACKETSIZE);
iter = 0; iter = 0;
while ( 1 ) while ( 1 )
{ {
@ -919,7 +917,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *addr,uint32_t sender
// gecko chains // gecko chains
{ (void *)"NEW", &basilisk_respond_newgeckochain }, // creates new virtual gecko chain { (void *)"NEW", &basilisk_respond_newgeckochain }, // creates new virtual gecko chain
{ (void *)"SEQ", &basilisk_respond_hashstamps }, // BTCD and BTC recent hashes from timestamp { (void *)"SEQ", &basilisk_respond_hashstamps }, // BTCD and BTC recent hashes from timestamp
{ (void *)"VTX", &basilisk_respond_geckotx }, { (void *)"GTX", &basilisk_respond_geckotx },
{ (void *)"BLK", &basilisk_respond_geckoblock }, { (void *)"BLK", &basilisk_respond_geckoblock },
{ (void *)"GEN", &basilisk_respond_geckogenesis }, { (void *)"GEN", &basilisk_respond_geckogenesis },

4
basilisk/basilisk.h

@ -25,7 +25,7 @@
#define BASILISK_MAXFUTUREBLOCK 60 #define BASILISK_MAXFUTUREBLOCK 60
#define BASILISK_MAXBLOCKLAG 600 #define BASILISK_MAXBLOCKLAG 600
#define BASILISK_HDROFFSET ((int32_t)(sizeof(struct iguana_msghdr)+sizeof(basilisktag))) #define BASILISK_HDROFFSET ((int32_t)(sizeof(struct iguana_msghdr)+sizeof(uint32_t)))
struct basilisk_value { bits256 txid; int64_t value; int32_t height; int16_t vout; char coinaddr[64]; }; struct basilisk_value { bits256 txid; int64_t value; int32_t height; int16_t vout; char coinaddr[64]; };
@ -53,7 +53,7 @@ uint8_t *basilisk_jsondata(uint8_t **ptrp,uint8_t *space,int32_t spacesize,int32
uint8_t *SuperNET_ciphercalc(void **ptrp,int32_t *cipherlenp,bits256 *privkeyp,bits256 *destpubkeyp,uint8_t *data,int32_t datalen,uint8_t *space2,int32_t space2size); uint8_t *SuperNET_ciphercalc(void **ptrp,int32_t *cipherlenp,bits256 *privkeyp,bits256 *destpubkeyp,uint8_t *data,int32_t datalen,uint8_t *space2,int32_t space2size);
void *SuperNET_deciphercalc(void **ptrp,int32_t *msglenp,bits256 privkey,bits256 srcpubkey,uint8_t *cipher,int32_t cipherlen,uint8_t *buf,int32_t bufsize); void *SuperNET_deciphercalc(void **ptrp,int32_t *msglenp,bits256 privkey,bits256 srcpubkey,uint8_t *cipher,int32_t cipherlen,uint8_t *buf,int32_t bufsize);
uint8_t *get_dataptr(uint8_t **ptrp,int32_t *datalenp,uint8_t *space,int32_t spacesize,char *hexstr); uint8_t *get_dataptr(int32_t hdroffset,uint8_t **ptrp,int32_t *datalenp,uint8_t *space,int32_t spacesize,char *hexstr);
char *basilisk_addhexstr(char **ptrp,cJSON *valsobj,char *strbuf,int32_t strsize,uint8_t *data,int32_t datalen); char *basilisk_addhexstr(char **ptrp,cJSON *valsobj,char *strbuf,int32_t strsize,uint8_t *data,int32_t datalen);
char *basilisk_standardservice(char *CMD,struct supernet_info *myinfo,bits256 hash,cJSON *valsobj,char *hexstr,int32_t blockflag); // client side char *basilisk_standardservice(char *CMD,struct supernet_info *myinfo,bits256 hash,cJSON *valsobj,char *hexstr,int32_t blockflag); // client side

16
gecko/gecko.c

@ -16,6 +16,7 @@
#include "../iguana/iguana777.h" #include "../iguana/iguana777.h"
#include "gecko_delayedPoW.c" #include "gecko_delayedPoW.c"
#include "gecko_miner.c" #include "gecko_miner.c"
#include "gecko_blocks.c"
bits256 calc_categoryhashes(bits256 *subhashp,char *category,char *subcategory) bits256 calc_categoryhashes(bits256 *subhashp,char *category,char *subcategory)
{ {
@ -233,7 +234,7 @@ struct iguana_info *basilisk_geckochain(struct supernet_info *myinfo,char *symbo
safecopy(virt->name,chainname,sizeof(virt->name)); safecopy(virt->name,chainname,sizeof(virt->name));
virt->chain = calloc(1,sizeof(*virt->chain)); virt->chain = calloc(1,sizeof(*virt->chain));
virt->enableCACHE = 1; virt->enableCACHE = 1;
serialized = get_dataptr(&ptr,&datalen,hexbuf,sizeof(hexbuf),hexstr); serialized = get_dataptr(BASILISK_HDROFFSET,&ptr,&datalen,hexbuf,sizeof(hexbuf),hexstr);
iguana_chaininit(virt->chain,1,valsobj); iguana_chaininit(virt->chain,1,valsobj);
hdrsize = (virt->chain->zcash != 0) ? sizeof(struct iguana_msgblockhdr_zcash) : sizeof(struct iguana_msgblockhdr); hdrsize = (virt->chain->zcash != 0) ? sizeof(struct iguana_msgblockhdr_zcash) : sizeof(struct iguana_msgblockhdr);
if ( gecko_blocknonce_verify(virt,serialized,hdrsize,virt->chain->nBits) == 0 ) if ( gecko_blocknonce_verify(virt,serialized,hdrsize,virt->chain->nBits) == 0 )
@ -390,7 +391,7 @@ char *basilisk_respond_geckotx(struct supernet_info *myinfo,char *CMD,void *addr
char *basilisk_respond_geckoblock(struct supernet_info *myinfo,char *CMD,void *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 hash2,int32_t from_basilisk) char *basilisk_respond_geckoblock(struct supernet_info *myinfo,char *CMD,void *addr,char *remoteaddr,uint32_t basilisktag,cJSON *valsobj,uint8_t *data,int32_t datalen,bits256 hash2,int32_t from_basilisk)
{ {
char *symbol; struct iguana_info *virt; bits256 checkhash2; int32_t hdrsize; uint32_t nBits; struct iguana_msgblock msg; struct iguana_block newblock; char *symbol; struct iguana_info *virt; bits256 checkhash2; int32_t hdrsize; uint32_t nBits; struct iguana_msgblock msg;
printf("got geckoblock len.%d from (%s) %s\n",datalen,remoteaddr!=0?remoteaddr:"",jprint(valsobj,0)); printf("got geckoblock len.%d from (%s) %s\n",datalen,remoteaddr!=0?remoteaddr:"",jprint(valsobj,0));
if ( (symbol= jstr(valsobj,"coin")) != 0 && (virt= iguana_coinfind(symbol)) != 0 ) if ( (symbol= jstr(valsobj,"coin")) != 0 && (virt= iguana_coinfind(symbol)) != 0 )
{ {
@ -401,11 +402,12 @@ char *basilisk_respond_geckoblock(struct supernet_info *myinfo,char *CMD,void *a
iguana_rwblock(symbol,virt->chain->zcash,virt->chain->auxpow,virt->chain->hashalgo,0,&checkhash2,data,&msg,datalen); iguana_rwblock(symbol,virt->chain->zcash,virt->chain->auxpow,virt->chain->hashalgo,0,&checkhash2,data,&msg,datalen);
if ( bits256_cmp(hash2,checkhash2) == 0 ) if ( bits256_cmp(hash2,checkhash2) == 0 )
{ {
iguana_blockconv(virt->chain->zcash,virt->chain->auxpow,&newblock,&msg,hash2,jint(valsobj,"ht")); /*iguana_blockconv(virt->chain->zcash,virt->chain->auxpow,&newblock,&msg,hash2,jint(valsobj,"ht"));
if ( _iguana_chainlink(virt,&newblock) != 0 ) if ( _iguana_chainlink(virt,&newblock) != 0 )
{ {
return(clonestr("{\"result\":\"gecko chain extended\"}")); return(clonestr("{\"result\":\"gecko chain extended\"}"));
} else return(clonestr("{\"result\":\"block not HWM\"}")); } else return(clonestr("{\"result\":\"block not HWM\"}"));*/
return(gecko_blockarrived(myinfo,addr,valsobj,data,datalen));
} else return(clonestr("{\"error\":\"block error with checkhash2\"}")); } else return(clonestr("{\"error\":\"block error with checkhash2\"}"));
} else return(clonestr("{\"error\":\"block nonce didnt verify\"}")); } else return(clonestr("{\"error\":\"block nonce didnt verify\"}"));
} }
@ -476,16 +478,16 @@ HASH_ARRAY_STRING(basilisk,geckotx,pubkey,vals,hexstr)
{ {
if ( btcd->RELAYNODE != 0 || btcd->VALIDATENODE != 0 ) if ( btcd->RELAYNODE != 0 || btcd->VALIDATENODE != 0 )
{ {
if ( (data= get_dataptr(&allocptr,&datalen,space,sizeof(space),hexstr)) != 0 ) if ( (data= get_dataptr(BASILISK_HDROFFSET,&allocptr,&datalen,space,sizeof(space),hexstr)) != 0 )
{ {
txid = bits256_doublesha256(0,data,datalen); txid = bits256_doublesha256(0,data,datalen);
retstr = basilisk_respond_geckotx(myinfo,"VTX",0,0,0,vals,data,datalen,txid,0); retstr = basilisk_respond_geckotx(myinfo,"GTX",0,0,0,vals,data,datalen,txid,0);
} }
if ( allocptr != 0 ) if ( allocptr != 0 )
free(allocptr); free(allocptr);
if ( retstr == 0 ) if ( retstr == 0 )
retstr = clonestr("{\"error\":\"couldnt create geckotx\"}"); retstr = clonestr("{\"error\":\"couldnt create geckotx\"}");
} else retstr = basilisk_standardservice("VTX",myinfo,txid,vals,hexstr,1); } else retstr = basilisk_standardservice("GTX",myinfo,txid,vals,hexstr,1);
return(retstr); return(retstr);
} else return(clonestr("{\"error\":\"couldnt find geckochain\"}")); } else return(clonestr("{\"error\":\"couldnt find geckochain\"}"));
} }

3
gecko/gecko.h

@ -28,6 +28,8 @@
#define GECKO_MAXNAMELEN 64 #define GECKO_MAXNAMELEN 64
#define GECKO_MAXMINERITERS 10000000 #define GECKO_MAXMINERITERS 10000000
struct iguana_peer;
struct hashstamp { bits256 hash2; uint32_t timestamp; int32_t height; }; struct hashstamp { bits256 hash2; uint32_t timestamp; int32_t height; };
struct gecko_sequence { struct hashstamp *stamps; int32_t lastupdate,maxstamps,numstamps,lasti,longestchain; }; struct gecko_sequence { struct hashstamp *stamps; int32_t lastupdate,maxstamps,numstamps,lasti,longestchain; };
struct gecko_sequences { struct gecko_sequence BTC,BTCD; }; struct gecko_sequences { struct gecko_sequence BTC,BTCD; };
@ -50,5 +52,6 @@ char *basilisk_respond_geckoblock(struct supernet_info *myinfo,char *CMD,void *a
void gecko_miner(struct supernet_info *myinfo,struct iguana_info *btcd,struct iguana_info *virt,int32_t maxmillis,char *mineraddr); void gecko_miner(struct supernet_info *myinfo,struct iguana_info *btcd,struct iguana_info *virt,int32_t maxmillis,char *mineraddr);
void gecko_seqresult(struct supernet_info *myinfo,char *retstr); void gecko_seqresult(struct supernet_info *myinfo,char *retstr);
int32_t gecko_sequpdate(char *symbol,uint32_t reftimestamp); int32_t gecko_sequpdate(char *symbol,uint32_t reftimestamp);
char *gecko_blockarrived(struct supernet_info *myinfo,struct iguana_peer *addr,cJSON *valsobj,uint8_t *data,int32_t datalen);
#endif #endif

21
gecko/gecko_blocks.c

@ -0,0 +1,21 @@
/******************************************************************************
* Copyright © 2014-2016 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* SuperNET software, including this file may be copied, modified, propagated *
* or distributed except according to the terms contained in the LICENSE file *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
// included from gecko.c
char *gecko_blockarrived(struct supernet_info *myinfo,struct iguana_peer *addr,cJSON *valsobj,uint8_t *data,int32_t datalen)
{
return(clonestr("{\"result\":\"gecko block queued\"}"));
}

4
gecko/gecko_delayedPoW.c

@ -13,7 +13,7 @@
* * * *
******************************************************************************/ ******************************************************************************/
// included from gecko_chains.c // included from gecko.c
int32_t gecko_hashstampsfind(struct hashstamp *stamps,int32_t max,struct gecko_sequence *seq,bits256 hash,uint32_t reftimestamp) int32_t gecko_hashstampsfind(struct hashstamp *stamps,int32_t max,struct gecko_sequence *seq,bits256 hash,uint32_t reftimestamp)
{ {
@ -202,7 +202,7 @@ void gecko_seqresult(struct supernet_info *myinfo,char *retstr)
longestchain = jint(resultjson,"longest"); longestchain = jint(resultjson,"longest");
hexstr = jstr(resultjson,"data"); hexstr = jstr(resultjson,"data");
printf("got startheight.%d num.%d lastupdate.%d longest.%d (%s)\n",startheight,num,lastupdate,longestchain,hexstr!=0?hexstr:""); printf("got startheight.%d num.%d lastupdate.%d longest.%d (%s)\n",startheight,num,lastupdate,longestchain,hexstr!=0?hexstr:"");
if ( hexstr != 0 && (data= get_dataptr(&allocptr,&datalen,space,sizeof(space),hexstr)) != 0 ) if ( hexstr != 0 && (data= get_dataptr(BASILISK_HDROFFSET,&allocptr,&datalen,space,sizeof(space),hexstr)) != 0 )
{ {
gecko_ensure(seq,ind + num); gecko_ensure(seq,ind + num);
for (i=0; i<num; i++,ind++) for (i=0; i<num; i++,ind++)

21
gecko/gecko_miner.c

@ -13,7 +13,7 @@
* * * *
******************************************************************************/ ******************************************************************************/
// included from gecko_chains.c // included from gecko.c
int32_t gecko_blocknonce_verify(struct iguana_info *virt,uint8_t *serialized,int32_t datalen,uint32_t nBits) int32_t gecko_blocknonce_verify(struct iguana_info *virt,uint8_t *serialized,int32_t datalen,uint32_t nBits)
{ {
@ -89,7 +89,7 @@ char *gecko_block(struct supernet_info *myinfo,struct iguana_info *virt,struct i
{ {
for (i=0; i<txn_count; i++) for (i=0; i<txn_count; i++)
{ {
if ( (txdata= get_dataptr(&allocptr,&txlen,space,sizeof(space),txptrs[i])) == 0 ) if ( (txdata= get_dataptr(BASILISK_HDROFFSET,&allocptr,&txlen,space,sizeof(space),txptrs[i])) == 0 )
{ {
printf("gecko_block error tx.%d\n",i); printf("gecko_block error tx.%d\n",i);
if ( txids != txspace ) if ( txids != txspace )
@ -218,7 +218,22 @@ char **gecko_mempool(struct supernet_info *myinfo,struct iguana_info *virt,int64
void gecko_blocksubmit(struct supernet_info *myinfo,struct iguana_info *virt,char *blockstr) void gecko_blocksubmit(struct supernet_info *myinfo,struct iguana_info *virt,char *blockstr)
{ {
uint8_t *data,space[16384],*allocptr=0; int32_t i,len,numranked=0; struct iguana_peers *peers; struct iguana_peer *addr;
if ( (peers= virt->peers) == 0 || (numranked= peers->numranked) == 0 )
basilisk_blocksubmit(myinfo,virt,blockstr);
else
{
if ( (data= get_dataptr(sizeof(struct iguana_msghdr),&allocptr,&len,space,sizeof(space),blockstr)) != 0 )
{
for (i=0; i<numranked; i++)
{
if ( (addr= peers->ranked[i]) != 0 && addr->usock >= 0 && addr->supernet != 0 )
iguana_queue_send(addr,0,data,"block",len);
}
}
if ( allocptr != 0 )
free(allocptr);
}
} }
void gecko_miner(struct supernet_info *myinfo,struct iguana_info *btcd,struct iguana_info *virt,int32_t maxmillis,char *mineraddr) void gecko_miner(struct supernet_info *myinfo,struct iguana_info *btcd,struct iguana_info *virt,int32_t maxmillis,char *mineraddr)

2
iguana/iguana_chains.c

@ -386,7 +386,7 @@ void iguana_chainparms(struct iguana_chain *chain,cJSON *argjson)
uint8_t hexbuf[1024],*ptr,*data; int32_t datalen,hdrsize; uint8_t hexbuf[1024],*ptr,*data; int32_t datalen,hdrsize;
hdrsize = chain->zcash != 0 ? sizeof(struct iguana_msgblockhdr_zcash) : sizeof(struct iguana_msgblockhdr); hdrsize = chain->zcash != 0 ? sizeof(struct iguana_msgblockhdr_zcash) : sizeof(struct iguana_msgblockhdr);
chain->genesis_hex = clonestr(hexstr); chain->genesis_hex = clonestr(hexstr);
data = get_dataptr(&ptr,&datalen,hexbuf,sizeof(hexbuf),hexstr); data = get_dataptr(BASILISK_HDROFFSET,&ptr,&datalen,hexbuf,sizeof(hexbuf),hexstr);
chain->genesishash2 = iguana_calcblockhash(chain->symbol,chain->hashalgo,data,hdrsize); chain->genesishash2 = iguana_calcblockhash(chain->symbol,chain->hashalgo,data,hdrsize);
memcpy(chain->genesis_hashdata,chain->genesishash2.bytes,32); memcpy(chain->genesis_hashdata,chain->genesishash2.bytes,32);
//char str[65]; printf("%s -> calculated %s from %d datalen\n",hexstr,bits256_str(str,chain->genesishash2),hdrsize); //char str[65]; printf("%s -> calculated %s from %d datalen\n",hexstr,bits256_str(str,chain->genesishash2),hdrsize);

18
iguana/iguana_init.c

@ -516,6 +516,15 @@ struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialhei
} }
//coin->firstblock = coin->blocks.parsedblocks + 1; //coin->firstblock = coin->blocks.parsedblocks + 1;
iguana_genesis(coin,coin->chain); iguana_genesis(coin,coin->chain);
int32_t bundlei = -2;
static const bits256 zero;
iguana_bundlecreate(coin,&bundlei,0,*(bits256 *)coin->chain->genesis_hashdata,zero,1);
_iguana_chainlink(coin,iguana_blockfind("genesis",coin,*(bits256 *)coin->chain->genesis_hashdata));
if ( coin->blocks.hwmchain.height != 0 || memcmp(coin->blocks.hwmchain.RO.hash2.bytes,coin->chain->genesis_hashdata,sizeof(coin->chain->genesis_hashdata)) != 0 )
{
char str[65]; printf("%s genesis values mismatch hwmheight.%d %.15f %.15f %s\n",coin->name,coin->blocks.hwmchain.height,coin->blocks.hwmchain.PoW,coin->blocks.hwmchain.PoW,bits256_str(str,coin->blocks.hwmchain.RO.hash2));
getchar();
}
memset(&lastbundle,0,sizeof(lastbundle)); memset(&lastbundle,0,sizeof(lastbundle));
if ( coin->peers == 0 ) if ( coin->peers == 0 )
iter = 2; iter = 2;
@ -588,15 +597,6 @@ struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialhei
fclose(fp); fclose(fp);
} else fpos = -1; } else fpos = -1;
} }
int32_t bundlei = -2;
static const bits256 zero;
iguana_bundlecreate(coin,&bundlei,0,*(bits256 *)coin->chain->genesis_hashdata,zero,1);
_iguana_chainlink(coin,iguana_blockfind("genesis",coin,*(bits256 *)coin->chain->genesis_hashdata));
if ( coin->blocks.hwmchain.height != 0 || memcmp(coin->blocks.hwmchain.RO.hash2.bytes,coin->chain->genesis_hashdata,sizeof(coin->chain->genesis_hashdata)) != 0 )
{
char str[65]; printf("%s genesis values mismatch hwmheight.%d %.15f %.15f %s\n",coin->name,coin->blocks.hwmchain.height,coin->blocks.hwmchain.PoW,coin->blocks.hwmchain.PoW,bits256_str(str,coin->blocks.hwmchain.RO.hash2));
getchar();
}
#ifndef IGUANA_DEDICATED_THREADS #ifndef IGUANA_DEDICATED_THREADS
coin->peers->peersloop = iguana_launch("peersloop",iguana_peersloop,coin,IGUANA_PERMTHREAD); coin->peers->peersloop = iguana_launch("peersloop",iguana_peersloop,coin,IGUANA_PERMTHREAD);
#endif #endif

Loading…
Cancel
Save