Browse Source

test

etomic
jl777 8 years ago
parent
commit
055aa0d33f
  1. 13
      iguana/dpow/dpow_network.c
  2. 3
      iguana/iguana_secp.c

13
iguana/dpow/dpow_network.c

@ -23,7 +23,7 @@ struct signed_nnpacket
int32_t signed_nn_send(void *ctx,bits256 privkey,int32_t sock,void *packet,int32_t size)
{
int32_t i,sentbytes,siglen = 0; uint8_t sig[65],pubkey33[33]; struct signed_nnpacket *sigpacket;
int32_t i,j,sentbytes,siglen = 0; uint8_t sig[65],pubkey33[33]; struct signed_nnpacket *sigpacket;
if ( (sigpacket= calloc(1,size + sizeof(*sigpacket))) != 0 )
{
sigpacket->packetlen = size;
@ -39,11 +39,14 @@ int32_t signed_nn_send(void *ctx,bits256 privkey,int32_t sock,void *packet,int32
if ( i < 10000 && (siglen= bitcoin_sign(ctx,"nnsend",sig,sigpacket->packethash,privkey,1)) > 0 && siglen == 65 )
{
memcpy(sigpacket->sig64,sig+1,64);
if ( bitcoin_recoververify(ctx,"nnrecv",sigpacket->sig64,sigpacket->packethash,pubkey33,33) == 0 )
for (j=0; j<10; j++)
{
for (i=0; i<33; i++)
printf("%02x",pubkey33[i]);
printf(" signed pubkey\n");
if ( bitcoin_recoververify(ctx,"nnrecv",sigpacket->sig64,sigpacket->packethash,pubkey33,33) == 0 )
{
for (i=0; i<33; i++)
printf("%02x",pubkey33[i]);
printf(" signed pubkey\n");
}
}
sentbytes = nn_send(sock,sigpacket,size + sizeof(*sigpacket),0);
//for (i=0; i<size+sizeof(*sigpacket); i++)

3
iguana/iguana_secp.c

@ -181,8 +181,7 @@ int32_t bitcoin_recoververify(void *ctx,char *symbol,uint8_t *sig,bits256 messag
pubkey[0] = 2;
else if ( pubkey[0] != 2 )
pubkey[0] = 3;*/
}
else printf("secp256k1_ecdsa_verify error\n");
} else printf("secp256k1_ecdsa_verify error\n");
} else printf("secp256k1_ecdsa_recover error\n");
ENDSECP_ENSURE_CTX
}

Loading…
Cancel
Save