Browse Source

Return much more info via dpow/active without mask hex

pass-iguana-arg
jl777 7 years ago
parent
commit
81b1e39320
  1. 4
      iguana/dPoW.h
  2. 1
      iguana/dpow/dpow_fsm.c
  3. 24
      iguana/dpow/dpow_network.c
  4. 11
      iguana/iguana_notary.c

4
iguana/dPoW.h

@ -29,7 +29,7 @@
#define DPOW_VERSION 0x1782
#define DPOW_UTXOSIZE 10000//50000
#define DPOW_MINOUTPUT 6000
#define DPOW_DURATION 600
#define DPOW_DURATION 1200
#define DPOW_RATIFYDURATION (3600 * 24)
//#define DPOW_ENTRIESCHANNEL ('e' | ('n' << 8) | ('t' << 16) | ('r' << 24))
@ -142,7 +142,7 @@ struct dpow_info
struct pax_transaction *PAX;
portable_mutex_t paxmutex,dexmutex;
uint32_t ipbits[128],numipbits;
struct dpow_block **blocks;
struct dpow_block **blocks,*currentbp;
};
struct komodo_ccdatapair { int32_t notarization_height; uint32_t MoMoMoffset; };

1
iguana/dpow/dpow_fsm.c

@ -360,6 +360,7 @@ void dpow_statemachinestart(void *ptr)
}
bp->bestk = -1;
dp->blocks[checkpoint.blockhash.height] = bp;
dp->currentbp = bp;
bp->beacon = rand256(0);
vcalc_sha256(0,bp->commit.bytes,bp->beacon.bytes,sizeof(bp->beacon));
}

24
iguana/dpow/dpow_network.c

@ -1778,6 +1778,30 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct
}
}
cJSON *dpow_recvmasks(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp)
{
int32_t i,j; cJSON *retjson,*item; char hexstr[64];
retjson = cJSON_CreateArray();
if ( dp == 0 || bp == 0 )
return(retjson);
for (i=0; i<bp->numnotaries; i++)
{
item = cJSON_CreateObject();
jaddstr(item,"notary",Notaries_elected[i][0]);
jaddnum(item,"bestk",bp->notaries[i].bestk);
for (j=7; j>=0; j--)
sprintf(hexstr,"%02x",((uint8_t *)&bp->notaries[i].recvmask)[j]);
hexstr[16] = 0;
jaddstr(item,"recvmask",hexstr);
for (j=7; j>=0; j--)
sprintf(hexstr,"%02x",((uint8_t *)&bp->notaries[i].bestmask)[j]);
hexstr[16] = 0;
jaddstr(item,"bestmask",hexstr);
jaddi(retjson,item);
}
return(retjson);
}
void dpow_notarize_update(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp,uint8_t senderind,int8_t bestk,uint64_t bestmask,uint64_t recvmask,bits256 srcutxo,uint16_t srcvout,bits256 destutxo,uint16_t destvout,uint8_t siglens[2],uint8_t sigs[2][DPOW_MAXSIGLEN],uint32_t paxwdcrc)
{
bits256 srchash; int32_t i,flag,bestmatches = 0,matches = 0,paxmatches = 0,paxbestmatches = 0;

11
iguana/iguana_notary.c

@ -148,6 +148,8 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
{
if ( (i % DPOW_MAXFREQ) != 0 && (bp= dp->blocks[i]) != 0 && bp->state == 0xffffffff )
{
if ( dp->currentbp == dp->blocks[i] )
dp->currentbp = 0;
dp->blocks[i] = 0;
Numallocated--;
free(bp);
@ -858,10 +860,11 @@ STRING_AND_INT(dpow,fundnotaries,symbol,numblocks)
}
extern char *Notaries_elected[65][2];
cJSON *dpow_recvmasks(struct supernet_info *myinfo,struct dpow_info *dp,struct dpow_block *bp);
STRING_ARG(dpow,active,maskhex)
{
uint8_t data[8],revdata[8],pubkeys[64][33]; char pubkeystr[67]; int32_t i,len,current,n; uint64_t mask; cJSON *infojson,*retjson,*array,*notarray;
uint8_t data[8],revdata[8],pubkeys[64][33]; int32_t i,len,current,n; uint64_t mask; cJSON *infojson,*retjson,*array,*notarray;
array = cJSON_CreateArray();
notarray = cJSON_CreateArray();
if ( (infojson= dpow_getinfo(myinfo,coin)) != 0 )
@ -872,7 +875,9 @@ STRING_ARG(dpow,active,maskhex)
n = komodo_notaries("KMD",pubkeys,current);
if ( maskhex == 0 || maskhex[0] == 0 )
{
mask = myinfo->DPOWS[0]->lastrecvmask;
return(jprint(dpow_recvmasks(myinfo,myinfo->DPOWS[0],myinfo->DPOWS[0]->currentbp),1));
/*mask = myinfo->DPOWS[0]->lastrecvmask;
for (i=0; i<n; i++)
{
if ( ((1LL << i) & mask) != 0 )
@ -885,7 +890,7 @@ STRING_ARG(dpow,active,maskhex)
retjson = cJSON_CreateObject();
jadd64bits(retjson,"recvmask",mask);
jadd(retjson,"notaries",array);
return(jprint(retjson,1));
return(jprint(retjson,1));*/
}
//printf("dpow active (%s)\n",maskhex);
if ( (len= (int32_t)strlen(maskhex)) <= 16 )

Loading…
Cancel
Save