Merge branch 'FSM' into jl777
This commit is contained in:
@@ -309,8 +309,8 @@ char *uppercase_str(char *buf,char *str);
|
|||||||
char *lowercase_str(char *buf,char *str);
|
char *lowercase_str(char *buf,char *str);
|
||||||
int32_t strsearch(char *strs[],int32_t num,char *name);
|
int32_t strsearch(char *strs[],int32_t num,char *name);
|
||||||
int32_t OS_getline(int32_t waitflag,char *line,int32_t max,char *dispstr);
|
int32_t OS_getline(int32_t waitflag,char *line,int32_t max,char *dispstr);
|
||||||
int32_t sort64s(uint64_t *buf,uint32_t num,int32_t size);
|
void sort64s(uint64_t *buf,uint32_t num,int32_t size);
|
||||||
int32_t revsort64s(uint64_t *buf,uint32_t num,int32_t size);
|
void revsort64s(uint64_t *buf,uint32_t num,int32_t size);
|
||||||
int decode_base32(uint8_t *token,uint8_t *tokenstr,int32_t len);
|
int decode_base32(uint8_t *token,uint8_t *tokenstr,int32_t len);
|
||||||
int init_base32(char *tokenstr,uint8_t *token,int32_t len);
|
int init_base32(char *tokenstr,uint8_t *token,int32_t len);
|
||||||
char *OS_mvstr();
|
char *OS_mvstr();
|
||||||
|
|||||||
21
src/komodo.h
21
src/komodo.h
@@ -803,7 +803,10 @@ int32_t komodo_notarycmp(uint8_t *scriptPubKey,int32_t scriptlen,uint8_t pubkeys
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// int32_t !
|
// int32_t (!!!)
|
||||||
|
/*
|
||||||
|
read blackjok3rtt comments in main.cpp
|
||||||
|
*/
|
||||||
int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
||||||
{
|
{
|
||||||
static int32_t hwmheight;
|
static int32_t hwmheight;
|
||||||
@@ -897,8 +900,8 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
|||||||
}
|
}
|
||||||
numvalid = bitweight(signedmask);
|
numvalid = bitweight(signedmask);
|
||||||
if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) ||
|
if ( ((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) ||
|
||||||
(numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) ||
|
(numvalid >= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) ||
|
||||||
numvalid > (numnotaries/5) )
|
numvalid > (numnotaries/5) )
|
||||||
{
|
{
|
||||||
if ( !fJustCheck && ASSETCHAINS_SYMBOL[0] != 0)
|
if ( !fJustCheck && ASSETCHAINS_SYMBOL[0] != 0)
|
||||||
{
|
{
|
||||||
@@ -918,7 +921,7 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
|||||||
fflush(signedfp);
|
fflush(signedfp);
|
||||||
}
|
}
|
||||||
transaction = i;
|
transaction = i;
|
||||||
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
|
printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts);
|
||||||
}
|
}
|
||||||
notarized = 1;
|
notarized = 1;
|
||||||
}
|
}
|
||||||
@@ -1014,7 +1017,9 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
|||||||
printf("%s ht.%d\n",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL,height);
|
printf("%s ht.%d\n",ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL,height);
|
||||||
if ( !fJustCheck && pindex->GetHeight() == hwmheight )
|
if ( !fJustCheck && pindex->GetHeight() == hwmheight )
|
||||||
komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,(uint32_t)pindex->nTime,0,0,0,0,zero,0);
|
komodo_stateupdate(height,0,0,0,zero,0,0,0,0,height,(uint32_t)pindex->nTime,0,0,0,0,zero,0);
|
||||||
} else fprintf(stderr,"komodo_connectblock: unexpected null pindex\n");
|
}
|
||||||
|
else
|
||||||
|
{ fprintf(stderr,"komodo_connectblock: unexpected null pindex\n"); return(0); }
|
||||||
//KOMODO_INITDONE = (uint32_t)time(NULL);
|
//KOMODO_INITDONE = (uint32_t)time(NULL);
|
||||||
//fprintf(stderr,"%s end connect.%d\n",ASSETCHAINS_SYMBOL,pindex->GetHeight());
|
//fprintf(stderr,"%s end connect.%d\n",ASSETCHAINS_SYMBOL,pindex->GetHeight());
|
||||||
if (fJustCheck)
|
if (fJustCheck)
|
||||||
@@ -1025,6 +1030,12 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
|||||||
return(1);
|
return(1);
|
||||||
if ( notarisations.size() > 1 || (notarisations.size() == 1 && notarisations[0] != 1) )
|
if ( notarisations.size() > 1 || (notarisations.size() == 1 && notarisations[0] != 1) )
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
|
fprintf(stderr,"komodo_connectblock: unxexpected behaviour when fJustCheck == true, report blackjok3rtt plz ! \n");
|
||||||
|
/* this needed by gcc-8, it counts here that control reaches end of non-void function without this.
|
||||||
|
by default, we count that if control reached here -> the valid notarization isnt in position 1 or there are too many notarizations in this block.
|
||||||
|
*/
|
||||||
|
return(-1);
|
||||||
}
|
}
|
||||||
else return(0);
|
else return(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2597,7 +2597,7 @@ static int cmp_llu(const void *a, const void*b)
|
|||||||
else return(1);
|
else return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t sort64(int64_t *l, int32_t llen)
|
static void sort64(int64_t *l, int32_t llen)
|
||||||
{
|
{
|
||||||
qsort(l,llen,sizeof(uint64_t),cmp_llu);
|
qsort(l,llen,sizeof(uint64_t),cmp_llu);
|
||||||
}
|
}
|
||||||
@@ -2611,7 +2611,7 @@ static int revcmp_llu(const void *a, const void*b)
|
|||||||
else return(1);
|
else return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t revsort64(int64_t *l, int32_t llen)
|
static void revsort64(int64_t *l, int32_t llen)
|
||||||
{
|
{
|
||||||
qsort(l,llen,sizeof(uint64_t),revcmp_llu);
|
qsort(l,llen,sizeof(uint64_t),revcmp_llu);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3392,7 +3392,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
{
|
{
|
||||||
// do a full block scan to get notarisation position and to enforce a valid notarization is in position 1.
|
// do a full block scan to get notarisation position and to enforce a valid notarization is in position 1.
|
||||||
// if notarisation in the block, must be position 1 and the coinbase must pay notaries.
|
// if notarisation in the block, must be position 1 and the coinbase must pay notaries.
|
||||||
int notarisationTx = komodo_connectblock(true,pindex,*(CBlock *)&block);
|
int32_t notarisationTx = komodo_connectblock(true,pindex,*(CBlock *)&block);
|
||||||
// -1 means that the valid notarization isnt in position 1 or there are too many notarizations in this block.
|
// -1 means that the valid notarization isnt in position 1 or there are too many notarizations in this block.
|
||||||
if ( notarisationTx == -1 )
|
if ( notarisationTx == -1 )
|
||||||
return state.DoS(100, error("ConnectBlock(): Notarization is not in TX position 1 or block contains more than 1 notarization! Invalid Block!"),
|
return state.DoS(100, error("ConnectBlock(): Notarization is not in TX position 1 or block contains more than 1 notarization! Invalid Block!"),
|
||||||
|
|||||||
Reference in New Issue
Block a user