workaround for assetchain mining blocks in regtest mode
This commit is contained in:
@@ -144,7 +144,7 @@ public:
|
|||||||
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
|
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
|
||||||
|
|
||||||
bool IsBack = IsBackNotarisation;
|
bool IsBack = IsBackNotarisation;
|
||||||
if (2 == IsBackNotarisation) IsBack = AutoIsBackNotarisation(s, ser_action);
|
if (2 == IsBackNotarisation) IsBack = DetectBackNotarisation(s, ser_action);
|
||||||
|
|
||||||
READWRITE(blockHash);
|
READWRITE(blockHash);
|
||||||
READWRITE(height);
|
READWRITE(height);
|
||||||
@@ -178,16 +178,18 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
bool AutoIsBackNotarisation(Stream& s, CSerActionUnserialize act)
|
bool DetectBackNotarisation(Stream& s, CSerActionUnserialize act)
|
||||||
{
|
{
|
||||||
if (ASSETCHAINS_SYMBOL[0]) return 1;
|
if (ASSETCHAINS_SYMBOL[0]) return 1;
|
||||||
if (s.size() >= 72 && strcmp("BTC", &s[68]) == 0) return 1;
|
if (s.size() >= 72) {
|
||||||
if (s.size() >= 72 && strcmp("KMD", &s[68]) == 0) return 1;
|
if (strcmp("BTC", &s[68]) == 0) return 1;
|
||||||
|
if (strcmp("KMD", &s[68]) == 0) return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
bool AutoIsBackNotarisation(Stream& s, CSerActionSerialize act)
|
bool DetectBackNotarisation(Stream& s, CSerActionSerialize act)
|
||||||
{
|
{
|
||||||
return !txHash.IsNull();
|
return !txHash.IsNull();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1265,6 +1265,8 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_
|
|||||||
return(isPoS);
|
return(isPoS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool KOMODO_TEST_ASSETCHAIN_SKIP_POW = 0;
|
||||||
|
|
||||||
int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
||||||
{
|
{
|
||||||
uint256 hash; arith_uint256 bnTarget,bhash; bool fNegative,fOverflow; uint8_t *script,pubkey33[33],pubkeys[64][33]; int32_t i,possible,PoSperc,is_PoSblock=0,n,failed = 0,notaryid = -1; int64_t checktoshis,value; CBlockIndex *pprev;
|
uint256 hash; arith_uint256 bnTarget,bhash; bool fNegative,fOverflow; uint8_t *script,pubkey33[33],pubkeys[64][33]; int32_t i,possible,PoSperc,is_PoSblock=0,n,failed = 0,notaryid = -1; int64_t checktoshis,value; CBlockIndex *pprev;
|
||||||
@@ -1304,6 +1306,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
|||||||
}
|
}
|
||||||
else if ( possible == 0 || ASSETCHAINS_SYMBOL[0] != 0 )
|
else if ( possible == 0 || ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
{
|
{
|
||||||
|
if (KOMODO_TEST_ASSETCHAIN_SKIP_POW) return(0);
|
||||||
fprintf(stderr,"pow violation and no chance it is notary ht.%d %s\n",height,hash.ToString().c_str());
|
fprintf(stderr,"pow violation and no chance it is notary ht.%d %s\n",height,hash.ToString().c_str());
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
|
|
||||||
extern uint256 komodo_calcMoM(int32_t height,int32_t MoMdepth);
|
extern uint256 komodo_calcMoM(int32_t height,int32_t MoMdepth);
|
||||||
|
extern bool KOMODO_TEST_ASSETCHAIN_SKIP_POW;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -48,6 +49,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
static void SetUpTestCase() { }
|
static void SetUpTestCase() { }
|
||||||
virtual void SetUp() {
|
virtual void SetUp() {
|
||||||
|
KOMODO_TEST_ASSETCHAIN_SKIP_POW = 1;
|
||||||
ASSETCHAINS_CC = 1;
|
ASSETCHAINS_CC = 1;
|
||||||
EVAL_TEST = this;
|
EVAL_TEST = this;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user