|
@ -172,14 +172,14 @@ int32_t gecko_hwmset(struct supernet_info *myinfo,struct iguana_info *virt,struc |
|
|
|
|
|
|
|
|
char *gecko_blockarrived(struct supernet_info *myinfo,struct iguana_info *virt,char *remoteaddr,uint8_t *data,int32_t datalen,bits256 hash2,int32_t verifyonly) |
|
|
char *gecko_blockarrived(struct supernet_info *myinfo,struct iguana_info *virt,char *remoteaddr,uint8_t *data,int32_t datalen,bits256 hash2,int32_t verifyonly) |
|
|
{ |
|
|
{ |
|
|
struct iguana_txblock txdata; int32_t height,valid,adjacent,gap,n,i,j,len = -1; struct iguana_block *block,*prev; struct iguana_txid tx; char str[65]; bits256 txid,threshold; struct iguana_msgtx *txs; |
|
|
struct iguana_txblock txdata; int32_t height,valid,adjacent,gap,n,i,j,len = -1; struct iguana_block *block,*prev; struct iguana_txid tx; char str[65],str2[65]; bits256 txid,threshold; struct iguana_msgtx *txs; |
|
|
memset(&txdata,0,sizeof(txdata)); |
|
|
memset(&txdata,0,sizeof(txdata)); |
|
|
iguana_memreset(&virt->TXMEM); |
|
|
iguana_memreset(&virt->TXMEM); |
|
|
if ( (n= iguana_gentxarray(virt,&virt->TXMEM,&txdata,&len,data,datalen)) == datalen ) |
|
|
if ( (n= iguana_gentxarray(virt,&virt->TXMEM,&txdata,&len,data,datalen)) == datalen ) |
|
|
{ |
|
|
{ |
|
|
if ( bits256_cmp(hash2,txdata.zblock.RO.hash2) != 0 ) |
|
|
if ( bits256_cmp(hash2,txdata.zblock.RO.hash2) != 0 ) |
|
|
{ |
|
|
{ |
|
|
printf("gecko_blockarrived: mismatched hash2\n"); |
|
|
printf("gecko_blockarrived: mismatched hash2.%s vs %s\n",bits256_str(str,hash2),bits256_str(str2,txdata.zblock.RO.hash2)); |
|
|
return(clonestr("{\"error\":\"gecko block hash2 mismatch\"}")); |
|
|
return(clonestr("{\"error\":\"gecko block hash2 mismatch\"}")); |
|
|
} |
|
|
} |
|
|
if ( txdata.zblock.RO.bits >= GECKO_EASIESTDIFF ) |
|
|
if ( txdata.zblock.RO.bits >= GECKO_EASIESTDIFF ) |
|
@ -319,7 +319,7 @@ char *basilisk_respond_geckoblock(struct supernet_info *myinfo,char *CMD,void *a |
|
|
int32_t basilisk_blocksubmit(struct supernet_info *myinfo,struct iguana_info *btcd,struct iguana_info *virt,struct iguana_peer *addr,char *blockstr,bits256 hash2,int32_t height) |
|
|
int32_t basilisk_blocksubmit(struct supernet_info *myinfo,struct iguana_info *btcd,struct iguana_info *virt,struct iguana_peer *addr,char *blockstr,bits256 hash2,int32_t height) |
|
|
{ |
|
|
{ |
|
|
int32_t i,datalen,num,numerrs,numresults=0; uint8_t *data,space[16384],*allocptr; cJSON *valsobj=0,*retjson,*retarray,*item; char *str,*str2,*othercoin; bits256 othertip; |
|
|
int32_t i,datalen,num,numerrs,numresults=0; uint8_t *data,space[16384],*allocptr; cJSON *valsobj=0,*retjson,*retarray,*item; char *str,*str2,*othercoin; bits256 othertip; |
|
|
//printf("blocksubmit.(%s)\n",blockstr);
|
|
|
printf("blocksubmit.(%s)\n",blockstr); |
|
|
if ( (data= get_dataptr(sizeof(struct iguana_msghdr) + BASILISK_HDROFFSET,&allocptr,&datalen,space,sizeof(space),blockstr)) != 0 ) |
|
|
if ( (data= get_dataptr(sizeof(struct iguana_msghdr) + BASILISK_HDROFFSET,&allocptr,&datalen,space,sizeof(space),blockstr)) != 0 ) |
|
|
{ |
|
|
{ |
|
|
if ( (str= gecko_blockarrived(myinfo,virt,"127.0.0.1",data,datalen,hash2,0)) != 0 ) |
|
|
if ( (str= gecko_blockarrived(myinfo,virt,"127.0.0.1",data,datalen,hash2,0)) != 0 ) |
|
|