Marmara coinbase opret
This commit is contained in:
@@ -112,6 +112,35 @@ uint8_t DecodeMaramaraCoinbaseOpRet(const CScript &scriptPubKey,CPubKey &pk,int3
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CScript Marmara_scriptPubKey(int32_t height,CScript scriptPubKey)
|
||||||
|
{
|
||||||
|
CTxOut ccvout; uint8_t *ptr; CPubKey pk;
|
||||||
|
if ( height > 0 && ASSETCHAINS_MARMARA != 0 && (height & 1) == 0 && scriptPubKey.size() == 35 )
|
||||||
|
{
|
||||||
|
ptr = (uint8_t *)pubkey.begin();
|
||||||
|
if ( ptr[0] == 33 && ptr[34] == OP_CHECKSIG )
|
||||||
|
pk = buf2pk(ptr+1);
|
||||||
|
ccvout = MakeCC1vout(EVAL_MARMARA,0,pk);
|
||||||
|
return(ccvout.scriptPubKey);
|
||||||
|
}
|
||||||
|
return(scriptPubKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
CScript MarmaraCoinbaseOpret(int32_t height,CScript scriptPubKey)
|
||||||
|
{
|
||||||
|
uint8_t *ptr; CPubKey pk;
|
||||||
|
if ( height > 0 && (height & 1) == 0 && scriptPubKey.size() == 35 )
|
||||||
|
{
|
||||||
|
ptr = (uint8_t *)pubkey.begin();
|
||||||
|
if ( ptr[0] == 33 && ptr[34] == OP_CHECKSIG )
|
||||||
|
{
|
||||||
|
pk = buf2pk(ptr+1);
|
||||||
|
return(EncodeMarmaraCoinbaseOpRet(pk,height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(scriptPubKey);
|
||||||
|
}
|
||||||
|
|
||||||
int32_t MarmaraValidateCoinbase(int32_t height,CTransaction tx)
|
int32_t MarmaraValidateCoinbase(int32_t height,CTransaction tx)
|
||||||
{
|
{
|
||||||
struct CCcontract_info *cp,C; CPubKey pk; int32_t ht,unlockht; CTxOut ccvout;
|
struct CCcontract_info *cp,C; CPubKey pk; int32_t ht,unlockht; CTxOut ccvout;
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
|||||||
extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY,ASSETCHAINS_SCRIPTPUB;
|
extern std::string NOTARY_PUBKEY,ASSETCHAINS_OVERRIDE_PUBKEY,ASSETCHAINS_SCRIPTPUB;
|
||||||
void vcalc_sha256(char deprecated[(256 >> 3) * 2 + 1],uint8_t hash[256 >> 3],uint8_t *src,int32_t len);
|
void vcalc_sha256(char deprecated[(256 >> 3) * 2 + 1],uint8_t hash[256 >> 3],uint8_t *src,int32_t len);
|
||||||
|
|
||||||
extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];
|
extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33],ASSETCHAINS_MARMARA;
|
||||||
uint32_t Mining_start,Mining_height;
|
uint32_t Mining_start,Mining_height;
|
||||||
int32_t My_notaryid = -1;
|
int32_t My_notaryid = -1;
|
||||||
int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
|
int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
|
||||||
@@ -155,6 +155,8 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
|
|||||||
int32_t verus_staked(CBlock *pBlock, CMutableTransaction &txNew, uint32_t &nBits, arith_uint256 &hashResult, uint8_t *utxosig, CPubKey &pk);
|
int32_t verus_staked(CBlock *pBlock, CMutableTransaction &txNew, uint32_t &nBits, arith_uint256 &hashResult, uint8_t *utxosig, CPubKey &pk);
|
||||||
int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33);
|
int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33);
|
||||||
int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex);
|
int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex);
|
||||||
|
CScript Marmara_scriptPubKey(int32_t height,CScript scriptPubKey);
|
||||||
|
CScript MarmaraCoinbaseOpret(int32_t height,CScript scriptPubKey);
|
||||||
|
|
||||||
CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount, bool isStake)
|
CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount, bool isStake)
|
||||||
{
|
{
|
||||||
@@ -534,7 +536,13 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
|
|||||||
|
|
||||||
// check if coinbase transactions must be time locked at current subsidy and prepend the time lock
|
// check if coinbase transactions must be time locked at current subsidy and prepend the time lock
|
||||||
// to transaction if so, cast for GTE operator
|
// to transaction if so, cast for GTE operator
|
||||||
if ((uint64_t)(txNew.vout[0].nValue) >= ASSETCHAINS_TIMELOCKGTE)
|
if ( ASSETCHAINS_MARMARA != 0 && height > 0 && (height & 1) == 0 )
|
||||||
|
{
|
||||||
|
txNew.vout.resize(2);
|
||||||
|
txNew.vout[1].nValue = 0;
|
||||||
|
txNew.vout[1].scriptPubKey = MarmaraCoinbaseOpret(nHeight,scriptPubKeyIn);
|
||||||
|
}
|
||||||
|
else if ((uint64_t)(txNew.vout[0].nValue) >= ASSETCHAINS_TIMELOCKGTE)
|
||||||
{
|
{
|
||||||
int32_t opretlen, p2shlen, scriptlen;
|
int32_t opretlen, p2shlen, scriptlen;
|
||||||
CScriptExt opretScript = CScriptExt();
|
CScriptExt opretScript = CScriptExt();
|
||||||
@@ -775,6 +783,8 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight,
|
|||||||
//scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG;
|
//scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( ASSETCHAINS_MARMARA != 0 )
|
||||||
|
scriptPubKey = Marmara_scriptPubKey(height,scriptPubKey);
|
||||||
return CreateNewBlock(scriptPubKey, gpucount, isStake);
|
return CreateNewBlock(scriptPubKey, gpucount, isStake);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user