add era gap, and change to start at era 1 instead of 0.
This commit is contained in:
@@ -206,8 +206,9 @@ const char *Notaries_elected1[][2] =
|
||||
int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp)
|
||||
{
|
||||
static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; static int32_t n0,n1;
|
||||
static uint8_t staked_pubkeys[64][33],staked_pubkeys1[64][33],didstaked,didstaked1; static int32_t ns,ns1;
|
||||
static uint8_t staked_pubkeys2[64][33],staked_pubkeys3[64][33],didstaked2,didstaked3; static int32_t ns2,ns3;
|
||||
static uint8_t staked_pubkeys1[64][33],staked_pubkeys2[64][33],didstaked1,didstaked2; static int32_t ns1,ns2;
|
||||
static uint8_t staked_pubkeys3[64][33],staked_pubkeys4[64][33],didstaked3,didstaked4; static int32_t ns3,ns4;
|
||||
static uint8_t null_pubkeys[64][33];
|
||||
int staked_era;
|
||||
int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp;
|
||||
if ( timestamp == 0 && ASSETCHAINS_SYMBOL[0] != 0 )
|
||||
@@ -250,23 +251,11 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // here we can activate our pubkeys.
|
||||
{ // here we can activate our pubkeys for STAKED chains by era.
|
||||
if (timestamp != 0)
|
||||
{
|
||||
staked_era = STAKED_era(timestamp);
|
||||
if (staked_era == 0)
|
||||
{
|
||||
if (didstaked == 0)
|
||||
{
|
||||
ns = num_notaries_STAKED;
|
||||
for (i=0; i<ns; i++)
|
||||
decode_hex(staked_pubkeys[i],33,(char *)notaries_STAKED[i][1]);
|
||||
didstaked = 1;
|
||||
printf("THIS CHAIN IS A STAKED CHAIN and is era 0 \n");
|
||||
}
|
||||
memcpy(pubkeys,staked_pubkeys,ns * 33);
|
||||
return(ns);
|
||||
} else if (staked_era == 1)
|
||||
if (staked_era == 1)
|
||||
{
|
||||
if (didstaked1 == 0)
|
||||
{
|
||||
@@ -302,6 +291,26 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestam
|
||||
}
|
||||
memcpy(pubkeys,staked_pubkeys3,ns3 * 33);
|
||||
return(ns3);
|
||||
} else if (staked_era == 4)
|
||||
{
|
||||
if (didstaked4 == 0)
|
||||
{
|
||||
ns4 = num_notaries_STAKED4;
|
||||
for (i=0; i<ns4; i++)
|
||||
decode_hex(staked_pubkeys4[i],33,(char *)notaries_STAKED4[i][1]);
|
||||
didstaked4 = 1;
|
||||
printf("THIS CHAIN IS A STAKED CHAIN and is era 4 \n");
|
||||
}
|
||||
memcpy(pubkeys,staked_pubkeys4,ns4 * 33);
|
||||
return(ns4);
|
||||
} else if (staked_era == 0)
|
||||
{
|
||||
// this means we are in a gap, so we set the array of pubkeys to null, so all notarizations are invalid.
|
||||
for (i=0; i<1; i++)
|
||||
decode_hex(null_pubkeys[i],33,(char *)notaries_STAKED1[i][1]);
|
||||
printf("THIS CHAIN IS A STAKED CHAIN and is in an ERA GAP, so we ignored it.\n");
|
||||
memcpy(pubkeys,null_pubkeys,0 * 33);
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,30 +2,6 @@
|
||||
#include "notaries_staked.h"
|
||||
#include <cstring>
|
||||
|
||||
// Era 0 set of pubkeys
|
||||
const char *notaries_STAKED[][2] =
|
||||
{
|
||||
{"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x
|
||||
{"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg
|
||||
{"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8
|
||||
{"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ
|
||||
{"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9
|
||||
{"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8
|
||||
{"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev
|
||||
{"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6
|
||||
{"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL
|
||||
{"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2
|
||||
{"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu
|
||||
{"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx
|
||||
{"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca
|
||||
{"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN
|
||||
{"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca
|
||||
{"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5
|
||||
{"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s
|
||||
};
|
||||
|
||||
int num_notaries_STAKED = (sizeof(notaries_STAKED)/sizeof(*notaries_STAKED));
|
||||
|
||||
// Era 1 set of pubkeys
|
||||
const char *notaries_STAKED1[][2] =
|
||||
{
|
||||
@@ -98,6 +74,30 @@ const char *notaries_STAKED3[][2] =
|
||||
|
||||
int num_notaries_STAKED3 = (sizeof(notaries_STAKED3)/sizeof(*notaries_STAKED3));
|
||||
|
||||
// Era 4 set of pubkeys
|
||||
const char *notaries_STAKED4[][2] =
|
||||
{
|
||||
{"blackjok3r", "021914947402d936a89fbdd1b12be49eb894a1568e5e17bb18c8a6cffbd3dc106e" }, // RTVti13NP4eeeZaCCmQxc2bnPdHxCJFP9x
|
||||
{"alright", "0285657c689b903218c97f5f10fe1d10ace2ed6595112d9017f54fb42ea1c1dda8" }, //RXmXeQ8LfJK6Y1aTM97cRz9Gu5f6fmR3sg
|
||||
{"webworker01", "031d1fb39ae4dca28965c3abdbd21faa0f685f6d7b87a60561afa7c448343fef6d" }, //RGsQiArk5sTmjXZV9UzGMW5njyvtSnsTN8
|
||||
{"CrisF", "03f87f1bccb744d90fdbf7fad1515a98e9fc7feb1800e460d2e7565b88c3971bf3" }, //RMwEpnaVe3cesWbMqqKYPPkaLcDkooTDgZ
|
||||
{"smk762", "02eacef682d2f86e0103c18f4da46116e17196f3fb8f73ed931acb78e81d8e1aa5" }, // RQVvzJ8gepCDVjhqCAc5Tia1kTmt8KDPL9
|
||||
{"jorian", "02150c410a606b898bcab4f083e48e0f98a510e0d48d4db367d37f318d26ae72e3" }, // RFgzxZe2P4RWKx6E9QGPK3rx3TXeWxSqa8
|
||||
{"TonyL", "021a559101e355c907d9c553671044d619769a6e71d624f68bfec7d0afa6bd6a96" }, // RHq3JsvLxU45Z8ufYS6RsDpSG4wi6ucDev
|
||||
{"Emman", "038f642dcdacbdf510b7869d74544dbc6792548d9d1f8d73a999dd9f45f513c935" }, //RN2KsQGW36Ah4NorJDxLJp2xiYJJEzk9Y6
|
||||
{"CHMEX", "03ed125d1beb118d12ff0a052bdb0cee32591386d718309b2924f2c36b4e7388e6" }, // RF4HiVeuYpaznRPs7fkRAKKYqT5tuxQQTL
|
||||
{"metaphilibert", "0344182c376f054e3755d712361672138660bda8005abb64067eb5aa98bdb40d10" }, // RG28QSnYFADBg1dAVkH1uPGYS6F8ioEUM2
|
||||
{"jusoaresf", "02dfb7ed72a23f6d07f0ea2f28192ee174733cc8412ec0f97b073007b78fab6346" }, // RBQGfE5Hxsjm1BPraTxbneRuNasPDuoLnu
|
||||
{"mylo", "03f6b7fcaf0b8b8ec432d0de839a76598b78418dadd50c8e5594c0e557d914ec09" }, // RXN4hoZkhUkkrnef9nTUDw3E3vVALAD8Kx
|
||||
{"blackjok3r2", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca
|
||||
{"blackjok3r3", "03c3e4c0206551dbf3a4b24d18e5d2737080541184211e3bfd2b1092177410b9c2" }, // RMMav2AVse5XHPvDfTzRpMbFhK3GqFmtSN
|
||||
{"kmdkrazy", "02f7597468703c1c5c8465dd6d43acaae697df9df30bed21494d193412a1ea193e" }, // RWHGbrLSP89fTzNVF9U9xiekDYJqcibTca
|
||||
{"alrighttest", "02e9dfe248f453b499315a90375e58a1c9ad79f5f3932ecb2205399a0f262d65fc" }, // RBevSstS8JtDXMEFNcJws4QTYN4PcE2VL5
|
||||
{"alrighttest1", "03527c7ecd6a8c5db6d685a64e6e18c1edb49e2f057a434f56c3f1253a26e9c6a2" }, // RBw2jNU3dnGk86ZLqPMadJwRwg3NU8eC6s
|
||||
};
|
||||
|
||||
int num_notaries_STAKED4 = (sizeof(notaries_STAKED4)/sizeof(*notaries_STAKED4));
|
||||
|
||||
int is_STAKED(const char *chain_name) {
|
||||
int STAKED = 0;
|
||||
if ( (strncmp(chain_name, "STKD", 4) == 0) || (strncmp(chain_name, "STAKED", 6) == 0) )
|
||||
@@ -108,13 +108,16 @@ int is_STAKED(const char *chain_name) {
|
||||
int STAKED_era(int timestamp)
|
||||
{
|
||||
int era;
|
||||
if (timestamp <= STAKED_NOTARIES_TIMESTAMP)
|
||||
era = 0;
|
||||
else if (timestamp <= STAKED_NOTARIES_TIMESTAMP1 && timestamp >= STAKED_NOTARIES_TIMESTAMP)
|
||||
if (timestamp <= STAKED_NOTARIES_TIMESTAMP1
|
||||
era = 1;
|
||||
else if (timestamp <= STAKED_NOTARIES_TIMESTAMP2 && timestamp >= STAKED_NOTARIES_TIMESTAMP1)
|
||||
else if (timestamp <= STAKED_NOTARIES_TIMESTAMP2 && timestamp >= (STAKED_NOTARIES_TIMESTAMP1 + STAKED_ERA_GAP))
|
||||
era = 2;
|
||||
else if (timestamp <= STAKED_NOTARIES_TIMESTAMP3 && timestamp >= STAKED_NOTARIES_TIMESTAMP2)
|
||||
else if (timestamp <= STAKED_NOTARIES_TIMESTAMP3 && timestamp >= (STAKED_NOTARIES_TIMESTAMP2 + STAKED_ERA_GAP))
|
||||
era = 3;
|
||||
else if (timestamp <= STAKED_NOTARIES_TIMESTAMP4 && timestamp >= (STAKED_NOTARIES_TIMESTAMP3 + STAKED_ERA_GAP))
|
||||
era = 4;
|
||||
else
|
||||
era = 0;
|
||||
// if we are in a gap, return era 0, so any notarizations submitted are invalid.
|
||||
return(era);
|
||||
}
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
#ifndef NOTARIES_STAKED
|
||||
#define NOTARIES_STAKED
|
||||
|
||||
static const int STAKED_NOTARIES_TIMESTAMP = 1537780949;
|
||||
static const int STAKED_NOTARIES_TIMESTAMP1 = 1537791749;
|
||||
static const int STAKED_NOTARIES_TIMESTAMP2 = 1537802549;
|
||||
static const int STAKED_NOTARIES_TIMESTAMP3 = 1537813349;
|
||||
static const int STAKED_ERA_GAP = 777;
|
||||
|
||||
extern const char *notaries_STAKED[][2];
|
||||
extern int num_notaries_STAKED;
|
||||
static const int STAKED_NOTARIES_TIMESTAMP1 = 1537780949;
|
||||
static const int STAKED_NOTARIES_TIMESTAMP2 = 1537791749;
|
||||
static const int STAKED_NOTARIES_TIMESTAMP3 = 1537802549;
|
||||
static const int STAKED_NOTARIES_TIMESTAMP4 = 1537813349;
|
||||
|
||||
extern const char *notaries_STAKED1[][2];
|
||||
extern int num_notaries_STAKED1;
|
||||
@@ -19,6 +18,9 @@ extern int num_notaries_STAKED2;
|
||||
extern const char *notaries_STAKED3[][2];
|
||||
extern int num_notaries_STAKED3;
|
||||
|
||||
extern const char *notaries_STAKED4[][2];
|
||||
extern int num_notaries_STAKED4;
|
||||
|
||||
int is_STAKED(const char *chain_name);
|
||||
int STAKED_era(int timestamp);
|
||||
|
||||
|
||||
@@ -47,12 +47,9 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight)
|
||||
printf("ERA.(%d) \n",staked_era);
|
||||
if (staked_era == 0)
|
||||
{
|
||||
// era 0
|
||||
auth_STAKED.requiredSigs = (num_notaries_STAKED / 5);
|
||||
auth_STAKED.size = num_notaries_STAKED;
|
||||
for (int n=0; n<auth_STAKED.size; n++)
|
||||
for (size_t i=0; i<33; i++)
|
||||
sscanf(notaries_STAKED[n][1]+(i*2), "%2hhx", auth_STAKED.notaries[n]+i);
|
||||
// this is an ERA GAP, so we will ignore this notarization
|
||||
printf("This notarization occured inside an ERA GAP, we will ignore it! \n");
|
||||
continue;
|
||||
} else if (staked_era == 1)
|
||||
{
|
||||
// era 1
|
||||
@@ -77,9 +74,14 @@ NotarisationsInBlock ScanBlockNotarisations(const CBlock &block, int nHeight)
|
||||
for (int n=0; n<auth_STAKED.size; n++)
|
||||
for (size_t i=0; i<33; i++)
|
||||
sscanf(notaries_STAKED3[n][1]+(i*2), "%2hhx", auth_STAKED.notaries[n]+i);
|
||||
} else if (staked_era > 3) {
|
||||
printf("Invalid ERA.(%d), this should not happen",staked_era);
|
||||
continue;
|
||||
} else if (staked_era == 4)
|
||||
{
|
||||
// era 4
|
||||
auth_STAKED.requiredSigs = (num_notaries_STAKED4 / 5);
|
||||
auth_STAKED.size = num_notaries_STAKED4;
|
||||
for (int n=0; n<auth_STAKED.size; n++)
|
||||
for (size_t i=0; i<33; i++)
|
||||
sscanf(notaries_STAKED4[n][1]+(i*2), "%2hhx", auth_STAKED.notaries[n]+i);
|
||||
}
|
||||
if (!CheckTxAuthority(tx, auth_STAKED))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user