Browse Source

Merge branch 'dev' into jl777

patch-5
jl777 6 years ago
parent
commit
20488096e5
  1. 4
      iguana/dPoW.h
  2. 6
      iguana/dpow/dpow_fsm.c
  3. 18
      iguana/dpow/dpow_network.c
  4. 2
      iguana/dpow/dpow_tx.c

4
iguana/dPoW.h

@ -135,6 +135,8 @@ struct pax_transaction
char symbol[16],coinaddr[64]; uint8_t rmd160[20],shortflag;
};
#define DPOW_MAXIPBITS 512
struct dpow_info
{
char symbol[16],dest[16]; uint8_t minerkey33[33],minerid; uint64_t lastrecvmask;
@ -146,7 +148,7 @@ struct dpow_info
struct pax_transaction *PAX;
uint32_t fullCCid;
portable_mutex_t paxmutex,dexmutex;
uint32_t ipbits[128],numipbits;
uint32_t ipbits[DPOW_MAXIPBITS],numipbits;
struct dpow_block **blocks,*currentbp;
};

6
iguana/dpow/dpow_fsm.c

@ -265,7 +265,7 @@ void dpow_statemachinestart(void *ptr)
void **ptrs = ptr;
struct supernet_info *myinfo; struct dpow_info *dp; struct dpow_checkpoint checkpoint;
int32_t i,j,ht,extralen,destprevvout0,srcprevvout0,src_or_dest,numratified=0,kmdheight,myind = -1; uint8_t extras[10000],pubkeys[64][33]; cJSON *ratified=0,*item; struct iguana_info *src,*dest; char *jsonstr,*handle,*hexstr,str[65],str2[65],srcaddr[64],destaddr[64]; bits256 zero,MoM,merkleroot,srchash,destprevtxid0,srcprevtxid0; struct dpow_block *bp; struct dpow_entry *ep = 0; uint32_t MoMdepth,duration,minsigs,starttime,srctime;
char *destlockunspent,*srclockunspent,*destunlockunspent,*srcunlockunspent;
char *destlockunspent=0,*srclockunspent=0,*destunlockunspent=0,*srcunlockunspent=0;
memset(&zero,0,sizeof(zero));
MoM = zero;
srcprevtxid0 = destprevtxid0 = zero;
@ -519,7 +519,7 @@ void dpow_statemachinestart(void *ptr)
free(destlockunspent);
}
if ( strcmp("BTC",dest->symbol) == 0 )
if ( 0 && strcmp("BTC",dest->symbol) == 0 )
{
// lock the src coin selected utxo if the source coin is KMD.
srclockunspent = dpow_lockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
@ -634,7 +634,7 @@ void dpow_statemachinestart(void *ptr)
}
// unlock the src selected utxo on KMD, as those are the only ones we LOCK, and CHIPS does not like the lockunspent call.
if ( strcmp("BTC",dest->symbol) == 0 )
if ( 0 && strcmp("BTC",dest->symbol) == 0 )
{
srcunlockunspent = dpow_unlockunspent(myinfo,bp->srccoin,srcaddr,bits256_str(str2,ep->src.prev_hash),ep->src.prev_vout);
if (strncmp(srcunlockunspent,"true", 4) == 0 )

18
iguana/dpow/dpow_network.c

@ -481,7 +481,7 @@ char *_dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *key,int32
for (i=0; i<n; i++)
if ( ipbits == myinfo->dexipbits[i] )
break;
if ( i == n && n < 64 )
if ( i == n && n < DPOW_MAXIPBITS )
{
myinfo->dexipbits[n++] = ipbits;
qsort(myinfo->dexipbits,n,sizeof(uint32_t),_increasing_ipbits);
@ -1292,7 +1292,7 @@ struct dpow_nanomsghdr
{
bits256 srchash,desthash;
struct dpow_nanoutxo ratify,notarize;
uint32_t channel,height,size,datalen,crc32,myipbits,numipbits,ipbits[128];
uint32_t channel,height,size,datalen,crc32,myipbits,numipbits,ipbits[DPOW_MAXIPBITS];
char symbol[16];
uint8_t senderind,version0,version1,packet[];
} PACKED;
@ -1363,15 +1363,15 @@ int32_t dpow_addnotary(struct supernet_info *myinfo,struct dpow_info *dp,char *i
{
char str[512]; uint32_t ipbits,*ptr; int32_t i,iter,n,retval = -1;
#ifdef CHECKNODEIP
#ifdef CHECKNODEIP
// -B- [+] Decker ---
static uint32_t list_ipbits[128];
static int dead_or_alive[128]; // 0 - not set, -1 - dead, 1 - alive
static uint32_t list_ipbits[DPOW_MAXIPBITS];
static int dead_or_alive[DPOW_MAXIPBITS]; // 0 - not set, -1 - dead, 1 - alive
static int list_ipsize;
int in_list_flag;
uint32_t ip_pattern;
// -E- [+] Decker ---
#endif
#endif
if ( myinfo->IAMNOTARY == 0 )
return(-1);
@ -1382,8 +1382,8 @@ int32_t dpow_addnotary(struct supernet_info *myinfo,struct dpow_info *dp,char *i
// -B- [+] Decker ---
// every new ip in BUS topology network goes to dead or white list forever, until iguana restart
ip_pattern = (uint32_t)calc_ipbits(ipaddr);
if ((list_ipsize == 0) || (list_ipsize > 127)) {
for (int i_list = 0; i_list < 128; i_list++) { list_ipbits[i_list] = 0; dead_or_alive[i_list] = 0; }
if ((list_ipsize == 0) || (list_ipsize > DPOW_MAXIPBITS-1)) {
for (int i_list = 0; i_list < DPOW_MAXIPBITS; i_list++) { list_ipbits[i_list] = 0; dead_or_alive[i_list] = 0; }
list_ipsize = 0;
in_list_flag = -1;
} else {
@ -1426,7 +1426,7 @@ int32_t dpow_addnotary(struct supernet_info *myinfo,struct dpow_info *dp,char *i
for (i=0; i<n; i++)
if ( ipbits == ptr[i] )
break;
if ( i == n && n < 64 )
if ( i == n && n < DPOW_MAXIPBITS )
{
ptr[n] = ipbits;
if ( iter == 0 && strcmp(ipaddr,myinfo->ipaddr) != 0 )

2
iguana/dpow/dpow_tx.c

@ -615,7 +615,7 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo
else
{
bp->state = 0xffffffff;
printf("dpow_sigscheck: mismatched txid.%s vs %s\n",bits256_str(str,txid),retstr);
printf("dpow_sigscheck.(%s): mismatched txid.%s vs %s\n",bp->signedtx,bits256_str(str,txid),retstr);
}
free(retstr);
retstr = 0;

Loading…
Cancel
Save