Browse Source

add bailout if MoMoM not determinate.

blackjok3r
blackjok3r 6 years ago
parent
commit
f419768f28
  1. 3
      iguana/dpow/dpow_fsm.c
  2. 6
      iguana/dpow/dpow_rpc.c
  3. 19
      iguana/dpow/dpow_tx.c

3
iguana/dpow/dpow_fsm.c

@ -563,6 +563,9 @@ void dpow_statemachinestart(void *ptr)
src_or_dest = 0;
else src_or_dest = 1;
extralen = dpow_paxpending(myinfo,extras,sizeof(extras),&bp->paxwdcrc,bp->MoM,bp->MoMdepth,bp->CCid,src_or_dest,bp);
// if MoMoM is not avalible yet, then stop this round and try again later.
if ( extralen == -1 )
break;
bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc;
}
if ( dp->checkpoint.blockhash.height > checkpoint.blockhash.height ) //(checkpoint.blockhash.height % 100) != 0 &&

6
iguana/dpow/dpow_rpc.c

@ -312,6 +312,12 @@ int32_t dpow_paxpending(struct supernet_info *myinfo,uint8_t *hex,int32_t hexsiz
}
if ( (retjson= dpow_MoMoMdata(kmdcoin,bp->srccoin->symbol,kmdheight,bp->CCid)) != 0 )
{
if ( jstr(retjson,"error")) != 0 )
{
// bail out MoMoM is indeterminate
free_json(retjson);
return(-1);
}
if ( (hexstr= jstr(retjson,"data")) != 0 && (hexlen= (int32_t)strlen(hexstr)) > 0 && n+hexlen/2 <= hexsize )
{
hexlen >>= 1;

19
iguana/dpow/dpow_tx.c

@ -639,7 +639,17 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo
{
bp->desttxid = txid;
dpow_signedtxgen(myinfo,dp,bp->srccoin,bp,bestk,bestmask,myind,DPOW_SIGCHANNEL,0,numratified != 0);
} else bp->srctxid = txid;
} else
{
bp->srctxid = txid;
#ifdef LOGTX
FILE * fptr;
fptr = fopen("/home/node/complete_notarizations", "a+");
// SRC SRC_TXID DEST DEST_TXID HEIGHT
fprintf(fptr, "%s %s %s\n", bp->srccoin->symbol,bp->srctxid,bp->destcoin->symbol,bp->desttxid,bp->height);
fclose(fptr);
#endif
}
len = (int32_t)strlen(bp->signedtx) >> 1;
decode_hex(txdata+32,len,bp->signedtx);
for (j=0; j<sizeof(srchash); j++)
@ -657,13 +667,6 @@ void dpow_sigscheck(struct supernet_info *myinfo,struct dpow_info *dp,struct dpo
{
bp->state = 0xffffffff;
printf("dpow_sigscheck: [src.%s] mismatched txid.%s vs %s\n",bp->srccoin->symbol,bits256_str(str,txid),retstr);
#ifdef LOGTX
FILE * fptr;
fptr = fopen("/home/node/failed_notarizations", "a+");
unsigned long dwy_timestamp = time(NULL);
fprintf(fptr, "%lu %s %s %d %s\n", dwy_timestamp, bp->srccoin->symbol,bp->destcoin->symbol,src_or_dest,bp->signedtx);
fclose(fptr);
#endif
}
free(retstr);
retstr = 0;

Loading…
Cancel
Save