Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
13ef1f2f82
  1. 6
      basilisk/basilisk.c
  2. 4
      basilisk/basilisk_CMD.c
  3. 6
      iguana/iguana_secp.c

6
basilisk/basilisk.c

@ -994,7 +994,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende
// unencrypted low level functions, used by higher level protocols and virtual network funcs
{ (void *)"ADD", &basilisk_respond_addrelay }, // relays register with each other bus
// { (void *)"RLY", &basilisk_respond_relays },
{ (void *)"RLY", &basilisk_respond_relays },
{ (void *)"DEX", &basilisk_respond_instantdex },
// encrypted data for jumblr
@ -1018,7 +1018,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende
symbol = "BTCD";
if ( (valsobj= cJSON_Parse((char *)data)) != 0 )
{
//printf("MSGVALS.(%s)\n",(char *)data);
printf("MSGVALS.(%s)\n",(char *)data);
if ( jobj(valsobj,"coin") != 0 )
coin = iguana_coinfind(jstr(valsobj,"coin"));
else if ( jobj(valsobj,"symbol") != 0 )
@ -1068,7 +1068,7 @@ void basilisk_msgprocess(struct supernet_info *myinfo,void *_addr,uint32_t sende
CMD[i] = toupper((int32_t)CMD[i]);
cmd[i] = tolower((int32_t)CMD[i]);
}
//printf("MSGPROCESS.(%s) tag.%d\n",(char *)data,basilisktag);
printf("MSGPROCESS.(%s) tag.%d\n",(char *)data,basilisktag);
myinfo->basilisk_busy = 1;
if ( valsobj != 0 )
{

4
basilisk/basilisk_CMD.c

@ -69,11 +69,11 @@ char *basilisk_respond_relays(struct supernet_info *myinfo,char *CMD,void *_addr
decode_hex(sig,siglen,sigstr);
vcalc_sha256(0,txhash2.bytes,data,datalen);
memset(pubkey33,0,33);
if ( bitcoin_recoververify(myinfo->ctx,"BTCD",sig,txhash2,pubkey33) == 0 || 1 )
if ( bitcoin_recoververify(myinfo->ctx,"BTCD",sig,txhash2,pubkey33) == 0 )
{
// compare with existing
init_hexbytes_noT(pubstr,pubkey33,33);
printf("skip verified relay data siglen.%d pub33.%s\n",siglen,pubstr);
printf(" verified relay data siglen.%d pub33.%s\n",siglen,pubstr);
if ( (retstr= basilisk_addrelay_info(myinfo,pubkey33,(uint32_t)calc_ipbits(remoteaddr),hash)) != 0 )
free(retstr);
n = (int32_t)(datalen / sizeof(uint32_t));

6
iguana/iguana_secp.c

@ -160,7 +160,13 @@ int32_t bitcoin_recoververify(void *ctx,char *symbol,uint8_t *sig65,bits256 mess
{
secp256k1_ec_pubkey_serialize(ctx,pubkey,&plen,&PUB,plen == 65 ? SECP256K1_EC_UNCOMPRESSED : SECP256K1_EC_COMPRESSED);
if ( secp256k1_ecdsa_verify(ctx,&SIG,messagehash2.bytes,&PUB) != 0 )
{
retval = 0;
if ( pubkey[0] == 4 ) // experimentally looks like 04 is set
pubkey[0] = 2;
else if ( pubkey[0] != 2 )
pubkey[0] = 3;
}
else printf("secp256k1_ecdsa_verify error\n");
} else printf("secp256k1_ecdsa_recover error\n");
ENDSECP_ENSURE_CTX

Loading…
Cancel
Save