Browse Source

Test

etomic
jl777 8 years ago
parent
commit
9d2b7a628c
  1. 4
      basilisk/basilisk_swap.c
  2. 4
      basilisk/smartaddress.c

4
basilisk/basilisk_swap.c

@ -918,7 +918,7 @@ int32_t basilisk_swapget(struct supernet_info *myinfo,struct basilisk_swap *swap
memset(srchash.bytes,0,sizeof(srchash)); memset(srchash.bytes,0,sizeof(srchash));
memset(desthash.bytes,0,sizeof(desthash)); memset(desthash.bytes,0,sizeof(desthash));
crc32 = calc_crc32(0,ptr,size); crc32 = calc_crc32(0,ptr,size);
printf("gotmsg.[%d] crc.%x\n",size,crc32); //printf("gotmsg.[%d] crc.%x\n",size,crc32);
offset = 0; offset = 0;
for (i=0; i<32; i++) for (i=0; i<32; i++)
srchash.bytes[i] = ptr[offset++]; srchash.bytes[i] = ptr[offset++];
@ -964,7 +964,7 @@ uint32_t basilisk_swapsend(struct supernet_info *myinfo,struct basilisk_swap *sw
memcpy(&buf[offset],data,datalen), offset += datalen; memcpy(&buf[offset],data,datalen), offset += datalen;
if ( (sentbytes= nn_send(swap->pushsock,buf,offset,0)) != offset ) if ( (sentbytes= nn_send(swap->pushsock,buf,offset,0)) != offset )
printf("sentbytes.%d vs offset.%d\n",sentbytes,offset); printf("sentbytes.%d vs offset.%d\n",sentbytes,offset);
else printf("send.[%d] %x\n",sentbytes,msgbits); //else printf("send.[%d] %x\n",sentbytes,msgbits);
free(buf); free(buf);
return(0); return(0);
} }

4
basilisk/smartaddress.c

@ -29,6 +29,10 @@ int32_t smartaddress_add(struct supernet_info *myinfo,bits256 privkey)
bitcoin_pubkey33(myinfo->ctx,ap->pubkey33,privkey); bitcoin_pubkey33(myinfo->ctx,ap->pubkey33,privkey);
ap->pubkey = curve25519(privkey,curve25519_basepoint9()); ap->pubkey = curve25519(privkey,curve25519_basepoint9());
calc_rmd160(0,ap->rmd160,ap->pubkey33,33); calc_rmd160(0,ap->rmd160,ap->pubkey33,33);
char coinaddr[64]; bitcoin_address(coinaddr,0,ap->rmd160,20);
for (i=0; i<20; i++)
printf("%02x",ap->rmd160[i]);
printf (" <- rmd160 for %d %s\n",myinfo->numsmartaddrs,coinaddr);
return(myinfo->numsmartaddrs); return(myinfo->numsmartaddrs);
} }
printf("too many smartaddresses %d vs %d\n",myinfo->numsmartaddrs,(int32_t)(sizeof(myinfo->smartaddrs)/sizeof(*myinfo->smartaddrs))); printf("too many smartaddresses %d vs %d\n",myinfo->numsmartaddrs,(int32_t)(sizeof(myinfo->smartaddrs)/sizeof(*myinfo->smartaddrs)));

Loading…
Cancel
Save