Merge pull request #105 from blackjok3rtt/jl777

Jl777
This commit is contained in:
blackjok3rtt
2019-05-03 00:23:03 +08:00
committed by GitHub
4 changed files with 15 additions and 8 deletions

View File

@@ -1627,7 +1627,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
break;
}
if ( ASSETCHAINS_CC != 0 && KOMODO_SNAPSHOT_INTERVAL != 0 && chainActive.Height() > KOMODO_SNAPSHOT_INTERVAL )
if ( ASSETCHAINS_CC != 0 && KOMODO_SNAPSHOT_INTERVAL != 0 && chainActive.Height() >= KOMODO_SNAPSHOT_INTERVAL )
{
if ( !komodo_dailysnapshot(chainActive.Height()) )
{

View File

@@ -2063,7 +2063,7 @@ bool komodo_appendACscriptpub()
ASSETCHAINS_SCRIPTPUB.pop_back(); ASSETCHAINS_SCRIPTPUB.pop_back(); // remove last 2 chars.
// get OP_RETURN from txid and append the HexStr of it to scriptpub
// encoded opreturn incorrectly on TESTHC chain, once we no longer need this it can be changed to a straight +1 to drop OP_RETURN opcode.
ASSETCHAINS_SCRIPTPUB.append(HexStr(tx.vout[i].scriptPubKey.begin()+(strcmp("TESTHC",ASSETCHAINS_SYMBOL) == 0 ? 3 : 1), tx.vout[i].scriptPubKey.end()));
ASSETCHAINS_SCRIPTPUB.append(HexStr(tx.vout[i].scriptPubKey.begin()+3, tx.vout[i].scriptPubKey.end()));
//fprintf(stderr, "ac_script.%s\n",ASSETCHAINS_SCRIPTPUB.c_str());
didinit = true;
return true;

View File

@@ -4258,7 +4258,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
komodo_pricesupdate(pindexNew->GetHeight(),pblock);
if ( ASSETCHAINS_SAPLING <= 0 && pindexNew->nTime > KOMODO_SAPLING_ACTIVATION - 24*3600 )
komodo_activate_sapling(pindexNew);
if ( ASSETCHAINS_CC != 0 && KOMODO_SNAPSHOT_INTERVAL != 0 && (pindexNew->GetHeight() % KOMODO_SNAPSHOT_INTERVAL) == 0 && pindexNew->GetHeight() > KOMODO_SNAPSHOT_INTERVAL )
if ( ASSETCHAINS_CC != 0 && KOMODO_SNAPSHOT_INTERVAL != 0 && (pindexNew->GetHeight() % KOMODO_SNAPSHOT_INTERVAL) == 0 && pindexNew->GetHeight() >= KOMODO_SNAPSHOT_INTERVAL )
{
uint64_t start = time(NULL);
if ( !komodo_dailysnapshot(pindexNew->GetHeight()) )

View File

@@ -8045,14 +8045,21 @@ UniValue opreturn_burn(const UniValue& params, bool fHelp)
int64_t normalInputs = AddNormalinputs(mtx, myPubkey, nAmount, 60);
if (normalInputs < nAmount)
throw runtime_error("not enough normals\n");
CScript opret; uint8_t *ptr;
opret << OP_RETURN;
CScript opret; uint8_t scripthex[8192];
decode_hex(scripthex,strHex.size()/2,(char *)strHex.c_str());
std::string test;
test.append((char*)scripthex);
std::vector<uint8_t> opretdata(test.begin(), test.end());
opret << OP_RETURN << E_MARSHAL(ss << opretdata);
/*CScript opret; uint8_t *ptr;
opret << OP_RETURN << 0;
int32_t len = strlen(strHex.c_str());
len >>=1;
opret.resize(len+1);
opret.resize(len+2);
ptr = (uint8_t *)&opret[1];
decode_hex(ptr,len,(char *)strHex.c_str());
decode_hex(ptr,len,(char *)strHex.c_str()); */
mtx.vout.push_back(CTxOut(nAmount,opret));
ret.push_back(Pair("hex",FinalizeCCTx(0, cp, mtx, myPubkey, 10000, CScript())));
return(ret);