Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
0323f94c7e
  1. 8
      iguana/iguana_recv.c
  2. 12
      iguana/iguana_wallet.c

8
iguana/iguana_recv.c

@ -132,7 +132,7 @@ int32_t iguana_sendblockreqPT(struct iguana_info *coin,struct iguana_peer *addr,
} }
if ( block != 0 ) if ( block != 0 )
block->issued = addr->pendtime; block->issued = addr->pendtime;
if ( 0 && coin->current == bp ) //if ( 0 && coin->current == bp )
printf("REQ.(%s) [%d:%d] %s n.%d\n",bits256_str(hexstr,hash2),bundlei,bp!=0?bp->hdrsi:-1,addr->ipaddr,addr->pendblocks); printf("REQ.(%s) [%d:%d] %s n.%d\n",bits256_str(hexstr,hash2),bundlei,bp!=0?bp->hdrsi:-1,addr->ipaddr,addr->pendblocks);
} else printf("MSG_BLOCK null datalen.%d\n",len); } else printf("MSG_BLOCK null datalen.%d\n",len);
return(len); return(len);
@ -755,7 +755,7 @@ void iguana_gotblockM(struct supernet_info *myinfo,struct iguana_info *coin,stru
bp = 0, bundlei = -2; bp = 0, bundlei = -2;
if ( iguana_bundlefind(coin,&bp,&bundlei,origtxdata->zblock.RO.prev_block) == 0 ) if ( iguana_bundlefind(coin,&bp,&bundlei,origtxdata->zblock.RO.prev_block) == 0 )
{ {
//printf("gotblockM: RTblock? %s\n",bits256_str(str,origtxdata->zblock.RO.hash2)); printf("gotblockM: RTblock? %s\n",bits256_str(str,origtxdata->zblock.RO.hash2));
numtx = origtxdata->zblock.RO.txn_count; numtx = origtxdata->zblock.RO.txn_count;
iguana_RTgotblock(coin,origtxdata->zblock.RO.hash2,data,&recvlen,&numtx); iguana_RTgotblock(coin,origtxdata->zblock.RO.hash2,data,&recvlen,&numtx);
req = iguana_recv_bundlereq(coin,addr,0,H,data,recvlen,0,-1,origtxdata); req = iguana_recv_bundlereq(coin,addr,0,H,data,recvlen,0,-1,origtxdata);
@ -835,7 +835,7 @@ void iguana_gotblockM(struct supernet_info *myinfo,struct iguana_info *coin,stru
req = iguana_recv_bundlereq(coin,addr,copyflag,H,data,recvlen,bp,bundlei,txdata); req = iguana_recv_bundlereq(coin,addr,copyflag,H,data,recvlen,bp,bundlei,txdata);
queue_enqueue("recvQ",&coin->recvQ,&req->DL,0); queue_enqueue("recvQ",&coin->recvQ,&req->DL,0);
//if ( 0 && strcmp("BTCD",coin->symbol) == 0 ) //if ( 0 && strcmp("BTCD",coin->symbol) == 0 )
//printf("[%d:%d].s%d %s Q.(%s) %s\n",bp->hdrsi,bundlei,numsaved,coin->symbol,bits256_str(str,origtxdata->zblock.RO.hash2),addr->ipaddr); printf("[%d:%d].s%d %s Q.(%s) %s\n",bp->hdrsi,bundlei,numsaved,coin->symbol,bits256_str(str,origtxdata->zblock.RO.hash2),addr->ipaddr);
//if ( (bp == coin->current || (coin->peers != 0 && ) && (rand() % coin->chain->bundlesize) < numsaved ) //if ( (bp == coin->current || (coin->peers != 0 && ) && (rand() % coin->chain->bundlesize) < numsaved )
if ( numsaved < coin->chain->bundlesize ) if ( numsaved < coin->chain->bundlesize )
{ {
@ -1582,7 +1582,7 @@ struct iguana_bundlereq *iguana_recvblock(struct supernet_info *myinfo,struct ig
coin->longestchain = prevblock->height+1; coin->longestchain = prevblock->height+1;
} else iguana_blockQ("prev",coin,0,-1,origblock->RO.prev_block,1); } else iguana_blockQ("prev",coin,0,-1,origblock->RO.prev_block,1);
} }
//printf("%s received.(%s) %s\n",coin->symbol,bits256_str(str,origblock->RO.hash2),addr->ipaddr); printf("%s received.(%s) %s\n",coin->symbol,bits256_str(str,origblock->RO.hash2),addr->ipaddr);
if ( (bp= iguana_bundleset(myinfo,coin,&block,&bundlei,(struct iguana_block *)origblock)) != 0 && bp == coin->current && block != 0 && bp->speculative != 0 && bundlei >= 0 ) if ( (bp= iguana_bundleset(myinfo,coin,&block,&bundlei,(struct iguana_block *)origblock)) != 0 && bp == coin->current && block != 0 && bp->speculative != 0 && bundlei >= 0 )
{ {
if ( 0 && strcmp("BTCD",coin->symbol) == 0 ) if ( 0 && strcmp("BTCD",coin->symbol) == 0 )

12
iguana/iguana_wallet.c

@ -31,10 +31,18 @@ void scrubfree(char *sensitivestr)
struct iguana_waddress *iguana_waddressfind(struct supernet_info *myinfo,struct iguana_waccount *wacct,char *coinaddr) struct iguana_waddress *iguana_waddressfind(struct supernet_info *myinfo,struct iguana_waccount *wacct,char *coinaddr)
{ {
struct iguana_waddress *waddr; uint8_t addrtype,rmd160[20]; struct iguana_waddress *waddr,*tmp; uint8_t addrtype,rmd160[20];
bitcoin_addr2rmd160(&addrtype,rmd160,coinaddr); bitcoin_addr2rmd160(&addrtype,rmd160,coinaddr);
//calc_rmd160_sha256(rmd160,pubkey33,33); //calc_rmd160_sha256(rmd160,pubkey33,33);
HASH_FIND(hh,wacct->waddr,rmd160,sizeof(rmd160),waddr); HASH_FIND(hh,wacct->waddr,rmd160,sizeof(rmd160),waddr);
if ( waddr == 0 )
{
HASH_ITER(hh,wacct->waddr,waddr,tmp)
{
printf("%s ",waddr->coinaddr);
}
printf("not in %s\n",wacct->account);
}
//if ( waddr != 0 && coin != 0 && strcmp(coin->symbol,waddr->symbol) != 0 ) //if ( waddr != 0 && coin != 0 && strcmp(coin->symbol,waddr->symbol) != 0 )
// return(0); // return(0);
//printf("%s (%s).%d in (%s)\n",waddr==0?"couldnt find":"found",coinaddr,len,wacct->account); //printf("%s (%s).%d in (%s)\n",waddr==0?"couldnt find":"found",coinaddr,len,wacct->account);
@ -1058,7 +1066,7 @@ STRING_ARG(bitcoinrpc,validateaddress,address)
strcat(str,"88ac"); strcat(str,"88ac");
jaddstr(retjson,"scriptPubKey",str); jaddstr(retjson,"scriptPubKey",str);
jadd(retjson,"isscript",(addrtype == coin->chain->p2shtype) ? jtrue() : jfalse()); jadd(retjson,"isscript",(addrtype == coin->chain->p2shtype) ? jtrue() : jfalse());
if ( iguana_ismine(myinfo,coin,coinaddr,addrtype,pubkey,rmd160) > 0 ) if ( iguana_ismine(myinfo,coin,coinaddr,addrtype,pubkey,rmd160) != 0 )
{ {
init_hexbytes_noT(str,pubkey,bitcoin_pubkeylen(pubkey)); init_hexbytes_noT(str,pubkey,bitcoin_pubkeylen(pubkey));
jaddstr(retjson,"pubkey",str); jaddstr(retjson,"pubkey",str);

Loading…
Cancel
Save