Browse Source

workaround for assetchain mining blocks in regtest mode

pull/4/head
Scott Sadler 6 years ago
parent
commit
3fdb378291
  1. 12
      src/cc/eval.h
  2. 3
      src/komodo_bitcoind.h
  3. 2
      src/test-komodo/test_crosschain.cpp

12
src/cc/eval.h

@ -144,7 +144,7 @@ public:
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
bool IsBack = IsBackNotarisation;
if (2 == IsBackNotarisation) IsBack = AutoIsBackNotarisation(s, ser_action);
if (2 == IsBackNotarisation) IsBack = DetectBackNotarisation(s, ser_action);
READWRITE(blockHash);
READWRITE(height);
@ -178,16 +178,18 @@ public:
}
template <typename Stream>
bool AutoIsBackNotarisation(Stream& s, CSerActionUnserialize act)
bool DetectBackNotarisation(Stream& s, CSerActionUnserialize act)
{
if (ASSETCHAINS_SYMBOL[0]) return 1;
if (s.size() >= 72 && strcmp("BTC", &s[68]) == 0) return 1;
if (s.size() >= 72 && strcmp("KMD", &s[68]) == 0) return 1;
if (s.size() >= 72) {
if (strcmp("BTC", &s[68]) == 0) return 1;
if (strcmp("KMD", &s[68]) == 0) return 1;
}
return 0;
}
template <typename Stream>
bool AutoIsBackNotarisation(Stream& s, CSerActionSerialize act)
bool DetectBackNotarisation(Stream& s, CSerActionSerialize act)
{
return !txHash.IsNull();
}

3
src/komodo_bitcoind.h

@ -1265,6 +1265,8 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_
return(isPoS);
}
bool KOMODO_TEST_ASSETCHAIN_SKIP_POW = 0;
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;
@ -1304,6 +1306,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
}
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());
return(-1);
}

2
src/test-komodo/test_crosschain.cpp

@ -28,6 +28,7 @@
extern uint256 komodo_calcMoM(int32_t height,int32_t MoMdepth);
extern bool KOMODO_TEST_ASSETCHAIN_SKIP_POW;
/*
@ -48,6 +49,7 @@ public:
protected:
static void SetUpTestCase() { }
virtual void SetUp() {
KOMODO_TEST_ASSETCHAIN_SKIP_POW = 1;
ASSETCHAINS_CC = 1;
EVAL_TEST = this;
}

Loading…
Cancel
Save