Merge branch 'HFtest'

merge down
This commit is contained in:
blackjok3rtt
2018-09-21 03:55:06 +00:00
6 changed files with 579 additions and 564 deletions

View File

@@ -76,7 +76,7 @@ bool CheckTxAuthority(const CTransaction &tx, CrosschainAuthority auth)
const CrosschainAuthority auth_STAKED = [&](){ const CrosschainAuthority auth_STAKED = [&](){
CrosschainAuthority auth; CrosschainAuthority auth;
auth.size = (int32_t)(sizeof(notaries_STAKEDcc)/sizeof(*notaries_STAKEDcc)); auth.size = (int32_t)(sizeof(notaries_STAKEDcc)/sizeof(*notaries_STAKEDcc));
auth.requiredSigs = (auth.size/5); auth.requiredSigs = 4;
for (int n=0; n<auth.size; n++) for (int n=0; n<auth.size; n++)
for (size_t i=0; i<33; i++) for (size_t i=0; i<33; i++)
sscanf(notaries_STAKEDcc[n][1]+(i*2), "%2hhx", auth.notaries[n]+i); sscanf(notaries_STAKEDcc[n][1]+(i*2), "%2hhx", auth.notaries[n]+i);

View File

@@ -856,7 +856,8 @@ void komodo_connectblock(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)) ||
( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) && numvalid > 4 )
{ {
if ( ASSETCHAINS_SYMBOL[0] != 0 ) if ( ASSETCHAINS_SYMBOL[0] != 0 )
{ {

View File

@@ -249,7 +249,7 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam
{ {
if ( did1 == 0 ) if ( did1 == 0 )
{ {
if ( (strlen(ASSETCHAINS_SYMBOL) >= 4 && strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strlen(ASSETCHAINS_SYMBOL) >= 6 && strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) ) if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) )
{ {
n1 = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED)); n1 = (int32_t)(sizeof(notaries_STAKED)/sizeof(*notaries_STAKED));
for (i=0; i<n1; i++) for (i=0; i<n1; i++)

View File

@@ -1554,7 +1554,7 @@ void komodo_args(char *argv0)
if ( name.c_str()[0] != 0 ) if ( name.c_str()[0] != 0 )
{ {
MAX_BLOCK_SIGOPS = 60000; MAX_BLOCK_SIGOPS = 60000;
ASSETCHAINS_SUPPLY = ( GetArg("-ac_supply",10) + 1 ); ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10);
ASSETCHAINS_ENDSUBSIDY = GetArg("-ac_end",0); ASSETCHAINS_ENDSUBSIDY = GetArg("-ac_end",0);
ASSETCHAINS_REWARD = GetArg("-ac_reward",0); ASSETCHAINS_REWARD = GetArg("-ac_reward",0);
ASSETCHAINS_HALVING = GetArg("-ac_halving",0); ASSETCHAINS_HALVING = GetArg("-ac_halving",0);
@@ -1752,4 +1752,3 @@ void komodo_prefetch(FILE *fp)
} }
fseek(fp,fpos,SEEK_SET); fseek(fp,fpos,SEEK_SET);
} }

View File

@@ -5954,14 +5954,28 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
CAddress addrFrom; CAddress addrFrom;
uint64_t nNonce = 1; uint64_t nNonce = 1;
vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe; vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe;
if (pfrom->nVersion < MIN_PEER_PROTO_VERSION) if ( (strncmp(ASSETCHAINS_SYMBOL, "STKD", 4) == 0) || (strncmp(ASSETCHAINS_SYMBOL, "STAKED", 6) == 0) )
{ {
// disconnect from peers older than this proto version if (pfrom->nVersion < STAKEDMIN_PEER_PROTO_VERSION)
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion); {
pfrom->PushMessage("reject", strCommand, REJECT_OBSOLETE, // disconnect from peers older than this proto version
strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION)); LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion);
pfrom->fDisconnect = true; pfrom->PushMessage("reject", strCommand, REJECT_OBSOLETE,
return false; strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION));
pfrom->fDisconnect = true;
return false;
}
} else
{
if (pfrom->nVersion < MIN_PEER_PROTO_VERSION)
{
// disconnect from peers older than this proto version
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion);
pfrom->PushMessage("reject", strCommand, REJECT_OBSOLETE,
strprintf("Version must be %d or greater", MIN_PEER_PROTO_VERSION));
pfrom->fDisconnect = true;
return false;
}
} }
// When Overwinter is active, reject incoming connections from non-Overwinter nodes // When Overwinter is active, reject incoming connections from non-Overwinter nodes

View File

@@ -9,7 +9,7 @@
* network protocol versioning * network protocol versioning
*/ */
static const int PROTOCOL_VERSION = 170003; static const int PROTOCOL_VERSION = 170005;
//! initial proto version, to be increased after version/verack negotiation //! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209; static const int INIT_PROTO_VERSION = 209;
@@ -19,6 +19,7 @@ static const int GETHEADERS_VERSION = 31800;
//! disconnect from peers older than this proto version //! disconnect from peers older than this proto version
static const int MIN_PEER_PROTO_VERSION = 170002; static const int MIN_PEER_PROTO_VERSION = 170002;
static const int STAKEDMIN_PEER_PROTO_VERSION = 170005;
//! nTime field added to CAddress, starting with this version; //! nTime field added to CAddress, starting with this version;
//! if possible, avoid requesting addresses nodes older than this //! if possible, avoid requesting addresses nodes older than this