Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
03dc42b819
  1. 2
      basilisk/basilisk.c
  2. 10
      gecko/gecko_blocks.c

2
basilisk/basilisk.c

@ -595,8 +595,8 @@ int32_t basilisk_blocksend(struct supernet_info *myinfo,struct iguana_info *btcd
hash2 = iguana_blockhash(virt,height);
if ( (blocklen= iguana_peerblockrequest(virt,virt->blockspace,IGUANA_MAXPACKETSIZE,0,hash2,0)) > 0 )
{
printf("RELAYID.%d send block.%d -> (%s) %s\n",myinfo->RELAYID,height,addr->ipaddr,bits256_str(str,hash2));
blockstr = basilisk_addhexstr(&allocptr,0,strbuf,sizeof(strbuf),&virt->blockspace[sizeof(struct iguana_msghdr)],blocklen);
printf("RELAYID.%d send block.%d %s -> (%s) %s\n",myinfo->RELAYID,height,blockstr,addr->ipaddr,bits256_str(str,hash2));
basilisk_blocksubmit(myinfo,btcd,virt,addr,blockstr,virt->blocks.hwmchain.RO.hash2,height);
if ( allocptr != 0 )
free(allocptr);

10
gecko/gecko_blocks.c

@ -172,7 +172,7 @@ 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)
{
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; 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]; bits256 txid,threshold; struct iguana_msgtx *txs;
memset(&txdata,0,sizeof(txdata));
iguana_memreset(&virt->TXMEM);
if ( (n= iguana_gentxarray(virt,&virt->TXMEM,&txdata,&len,data,datalen)) == datalen )
@ -182,6 +182,14 @@ char *gecko_blockarrived(struct supernet_info *myinfo,struct iguana_info *virt,c
printf("gecko_blockarrived: mismatched hash2\n");
return(clonestr("{\"error\":\"gecko block hash2 mismatch\"}"));
}
if ( txdata.zblock.RO.bits >= GECKO_EASIESTDIFF )
bits256_from_compact(GECKO_EASIESTDIFF);
else threshold = bits256_from_compact(txdata.zblock.RO.bits);
if ( bits256_cmp(threshold,hash2) <= 0 )
{
printf("gecko_blockarrived: failed nBits diff\n");
return(clonestr("{\"error\":\"gecko block failed nBits diff\"}"));
}
txs = virt->TXMEM.ptr;
for (i=0; i<txdata.zblock.RO.txn_count; i++)
{

Loading…
Cancel
Save