Browse Source

test

etomic
jl777 8 years ago
parent
commit
d5eef3a8e7
  1. 11
      iguana/dpow/dpow_network.c
  2. 10
      iguana/main.c

11
iguana/dpow/dpow_network.c

@ -52,7 +52,7 @@ int32_t signed_nn_send(void *ctx,bits256 privkey,int32_t sock,void *packet,int32
int32_t signed_nn_recv(void **freeptrp,void *ctx,uint8_t notaries[64][33],int32_t n,int32_t sock,void *packetp)
{
int32_t i,recvbytes; uint8_t pubkey33[33]; bits256 packethash; struct signed_nnpacket *sigpacket=0;
int32_t i,recvbytes; uint8_t pubkey33[33],pubkey0[33]; bits256 packethash; struct signed_nnpacket *sigpacket=0;
*(void **)packetp = 0;
*freeptrp = 0;
recvbytes = nn_recv(sock,&sigpacket,NN_MSG,0);
@ -63,6 +63,14 @@ int32_t signed_nn_recv(void **freeptrp,void *ctx,uint8_t notaries[64][33],int32_
{
if ( bitcoin_recoververify(ctx,"nnrecv",sigpacket->sig64,sigpacket->packethash,pubkey33,33) == 0 )
{
char *notary0 = "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828";
decode_hex(pubkey0,33,notary0);
if ( memcmp(pubkey0,pubkey33,33) == 0 )
{
*(void **)packetp = (void **)((uint64_t)sigpacket + sizeof(*sigpacket));
*freeptrp = sigpacket;
return((int32_t)(recvbytes - sizeof(*sigpacket)));
}
for (i=0; i<n && i<64; i++)
{
if ( memcmp(pubkey33,notaries[i],33) == 0 )
@ -258,6 +266,7 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int3
else if ( retptr != 0 )
{
retstr = clonestr((char *)retptr);
printf("GOT.(%s)\n",retstr);
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
ipbits = juint(retjson,"randipbits");

10
iguana/main.c

@ -1643,11 +1643,10 @@ void iguana_main(void *arg)
#ifdef __APPLE__
iguana_appletests(myinfo);
#endif
}
} else basilisks_init(myinfo);
char *retstr,*pubkeystr; cJSON *retjson,*array,*item; int32_t i,n;
if ( (retstr= _dex_notaries(myinfo,"KMD")) != 0 )
{
printf("INITIAL NOTARIES.(%s)\n",retstr);
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{
if ( (myinfo->numnotaries= jint(retjson,"numnotaries")) != 0 && (array= jarray(&n,retjson,"notaries")) != 0 && n == myinfo->numnotaries )
@ -1663,6 +1662,13 @@ void iguana_main(void *arg)
}
free(retstr);
}
}
}
else
{
basilisks_init(myinfo);
myinfo->numnotaries = komodo_notaries("KMD",myinfo->notaries,-1);
}
if ( 0 )
{
char *jsonstr = "[\"03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828\", \"02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344\", \"03750cf30d739cd7632f77c1c02812dd7a7181628b0558058d4755838117e05339\", \"0394f3529d2e8cc69ffa7a2b55f3761e7be978fa1896ef4c55dc9c275e77e5bf5e\", \"0243c1eeb3777af47187d542e5f8c84f0ac4b05cf5a7ad77faa8cb6d2d56db7823\", \"02bb298844175640a34e908ffdfa2839f77aba3d5edadefee16beb107826e00063\", \"02fa88e549b4b871498f892e527a5d57287916809f8cc3163f641d71c535e8df5a\", \"032f799e370f06476793a122fcd623db7804898fe5aef5572095cfee6353df34bf\", \"02c06fe5401faff4442ef87b7d1b56c2e5a214166615f9a2f2030c71b0cb067ae8\", \"038ac67ca49a8169bcc5de83fe020071095a2c3b2bc4d1c17386977329758956d5\"]";

Loading…
Cancel
Save