Browse Source

MoM into pax-ending

patch-1
jl777 7 years ago
parent
commit
f5ac275547
  1. 2
      iguana/dPoW.h
  2. 4
      iguana/dpow/dpow_fsm.c
  3. 2
      iguana/dpow/dpow_network.c
  4. 8
      iguana/dpow/dpow_rpc.c
  5. 7
      iguana/dpow/dpow_tx.c

2
iguana/dPoW.h

@ -142,7 +142,7 @@ struct dpow_info
struct dpow_block **blocks;
};
uint64_t dpow_notarybestk(uint64_t refmask,struct dpow_block *bp,int8_t *lastkp);
int32_t dpow_paxpending(uint8_t *hex,uint32_t *paxwdcrcp);
int32_t dpow_paxpending(uint8_t *hex,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth);
void dex_updateclient(struct supernet_info *myinfo);
char *dex_reqsend(struct supernet_info *myinfo,char *handler,uint8_t *data,int32_t datalen,int32_t M,char *field);
char *basilisk_respond_addmessage(struct supernet_info *myinfo,uint8_t *key,int32_t keylen,uint8_t *data,int32_t datalen,int32_t sendping,uint32_t duration);

4
iguana/dpow/dpow_fsm.c

@ -541,7 +541,7 @@ void dpow_statemachinestart(void *ptr)
{
//if ( (starttime= checkpoint.timestamp) == 0 )
bp->starttime = starttime;
extralen = dpow_paxpending(extras,&bp->paxwdcrc);
extralen = dpow_paxpending(extras,&bp->paxwdcrc,bp->MoM,bp->MoMdepth);
bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc;
}
printf("PAXWDCRC.%x myind.%d isratify.%d DPOW.%s statemachine checkpoint.%d %s start.%u+dur.%d vs %ld\n",bp->paxwdcrc,bp->myind,bp->isratify,src->symbol,checkpoint.blockhash.height,bits256_str(str,checkpoint.blockhash.hash),starttime,bp->duration,time(NULL));
@ -559,7 +559,7 @@ void dpow_statemachinestart(void *ptr)
printf("break due to already ratifying\n");
break;
}
extralen = dpow_paxpending(extras,&bp->paxwdcrc);
extralen = dpow_paxpending(extras,&bp->paxwdcrc,bp->MoM,bp->MoMdepth);
bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc;
}
sleep(13);

2
iguana/dpow/dpow_network.c

@ -1944,7 +1944,7 @@ void dpow_send(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_blo
//printf(" dpow_send.(%d) size.%d numipbits.%d myind.%d\n",datalen,size,np->numipbits,bp->myind);
if ( bp->isratify == 0 )
{
extralen = dpow_paxpending(extras,&paxwdcrc);
extralen = dpow_paxpending(extras,&paxwdcrc,bp->MoM,bp->MoMdepth);
bp->paxwdcrc = bp->notaries[bp->myind].paxwdcrc = np->notarize.paxwdcrc = paxwdcrc;
//dpow_bestconsensus(bp);
dpow_nanoutxoset(myinfo,dp,&np->notarize,bp,0);

8
iguana/dpow/dpow_rpc.c

@ -226,10 +226,16 @@ bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *c
return(blockhash);
}
int32_t dpow_paxpending(uint8_t *hex,uint32_t *paxwdcrcp)
int32_t dpow_paxpending(uint8_t *hex,uint32_t *paxwdcrcp,bits256 MoM,uint32_t MoMdepth)
{
struct iguana_info *coin; char *retstr,*hexstr; cJSON *retjson; int32_t n=0; uint32_t paxwdcrc;
paxwdcrc = 0;
n += iguana_rwbignum(1,&hex[n],sizeof(MoM),MoM.bytes);
n += iguana_rwnum(1,&hex[n],sizeof(MoMdepth),(uint32_t *)&MoMdepth);
paxwdcrc = calc_crc32(0,hex,n) & 0xffffff00;
paxwdcrc |= (n & 0xff);
*paxwdcrcp = paxwdcrc;
return(n);
if ( (coin= iguana_coinfind("KMD")) != 0 )
{
if ( coin->FULLNODE < 0 )

7
iguana/dpow/dpow_tx.c

@ -224,7 +224,7 @@ int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,in
}
printf("numvouts.%d len.%d RATIFY vouts\n",numvouts,len);
}
if ( 0 && (src_or_dest == 0 || strcmp(bp->destcoin->symbol,"BTC") != 0) && (n= dpow_paxpending(extras,&paxwdcrc)) > 0 )
if ( 0 && (src_or_dest == 0 || strcmp(bp->destcoin->symbol,"BTC") != 0) && (n= dpow_paxpending(extras,&paxwdcrc,bp->MoM,bp->MoMdepth)) > 0 )
{
for (i=0; i<n; i++)
printf("%02x",extras[i]);
@ -232,8 +232,9 @@ int32_t dpow_voutstandard(struct dpow_block *bp,uint8_t *serialized,int32_t m,in
}
else if ( Notaries_port != DPOW_SOCKPORT && bp->MoMdepth > 0 && strcmp(bp->destcoin->symbol,"KMD") == 0 ) // only testnets for now
{
n += iguana_rwbignum(1,&extras[n],sizeof(bp->MoM),bp->MoM.bytes);
n += iguana_rwnum(1,&extras[n],sizeof(bp->MoMdepth),(uint32_t *)&bp->MoMdepth);
n = dpow_paxpending(extras,&paxwdcrc,bp->MoM,bp->MoMdepth);
//n += iguana_rwbignum(1,&extras[n],sizeof(bp->MoM),bp->MoM.bytes);
//n += iguana_rwnum(1,&extras[n],sizeof(bp->MoMdepth),(uint32_t *)&bp->MoMdepth);
}
satoshis = 0;
len += iguana_rwnum(1,&serialized[len],sizeof(satoshis),&satoshis);

Loading…
Cancel
Save