This commit is contained in:
jl777
2016-10-19 17:41:42 -03:00
parent 52ed4002de
commit dd7b22adda

View File

@@ -203,8 +203,11 @@ int32_t komodo_stateupdate(uint8_t notarypubs[][33],uint8_t numnotaries)
if ( func == 'P' )
{
if ( (num= fgetc(fp)) < 64 )
{
if ( fread(pubkeys,33,num,fp) != num )
errs++;
else printf("updated %d pubkeys\n",num);
}
else printf("illegal num.%d\n",num);
}
else if ( func == 'N' )
@@ -360,7 +363,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
{
static int32_t didinit;
char *scriptstr,*opreturnstr; uint64_t signedmask,voutmask;
uint8_t scriptbuf[4096]; uint256 kmdtxid,btctxid,txhash;
uint8_t scriptbuf[4096],pubkeys[64][33]; uint256 kmdtxid,btctxid,txhash;
int32_t i,j,k,specialtx,notarizedheight,notaryid,len,numvouts,numvins,height,txn_count,flag;
if ( didinit == 0 )
{
@@ -409,6 +412,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
printf("NOTARY SIGNED.%llx numvins.%d ht.%d txi.%d notaryht.%d specialtx.%d\n",(long long)signedmask,numvins,height,i,notarizedheight,specialtx);
if ( specialtx != 0 && numvouts > 2 && komodo_threshold(signedmask) > 0 )
{
memset(pubkeys,0,sizeof(pubkeys));
for (j=1; j<numvouts; j++)
{
len = block.vtx[i].vout[j].scriptPubKey.size();
@@ -417,12 +421,14 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block)
memcpy(scriptbuf,block.vtx[i].vout[j].scriptPubKey.data(),len);
if ( len == 35 && scriptbuf[0] == 33 && scriptbuf[34] == 0xac )
{
memcpy(pubkeys[j-1],scriptbuf+1,33);
for (k=0; k<33; k++)
printf("%02x",scriptbuf[k+1]);
printf(" <- new notary.[%d]\n",j-1);
}
}
}
komodo_stateupdate(pubkeys,numvouts-1);
printf("new notaries.%d newheight.%d from height.%d\n",numvouts-1,(((height+500)/1000)+1)*1000,height);
}
}