This commit is contained in:
@@ -255,10 +255,13 @@ int32_t MarmaraValidateCoinbase(int32_t height,CTransaction tx)
|
|||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MarmaraPoScheck(char *destaddr,CScript opret,CScript scriptPubKey)
|
bool MarmaraPoScheck(char *destaddr,CScript opret,CTransaction staketx)
|
||||||
{
|
{
|
||||||
CPubKey Marmarapk,pk; int32_t height,unlockht; uint8_t funcid; char coinaddr[64]; struct CCcontract_info *cp,C;
|
CPubKey Marmarapk,pk; int32_t height,unlockht; uint8_t funcid; char coinaddr[64]; struct CCcontract_info *cp,C;
|
||||||
if ( opret == scriptPubKey )
|
UniValue result(UniValue::VOBJ);
|
||||||
|
TxToJSON(tx, uint256(), result);
|
||||||
|
fprintf(stderr,"%s\n",result.ToString());
|
||||||
|
if ( staketx.vout.size() == 2 && opret == staketx.vout[1].scriptPubKey )
|
||||||
{
|
{
|
||||||
cp = CCinit(&C,EVAL_MARMARA);
|
cp = CCinit(&C,EVAL_MARMARA);
|
||||||
funcid = DecodeMaramaraCoinbaseOpRet(opret,pk,height,unlockht);
|
funcid = DecodeMaramaraCoinbaseOpRet(opret,pk,height,unlockht);
|
||||||
|
|||||||
@@ -636,7 +636,7 @@ int32_t komodo_WhoStaked(CBlock *pblock, CTxDestination &addressout)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MarmaraPoScheck(char *destaddr,CScript opret,CScript scriptPubKey);
|
bool MarmaraPoScheck(char *destaddr,CScript opret,CTransaction staketx);
|
||||||
|
|
||||||
int32_t komodo_isPoS(CBlock *pblock,int32_t height)
|
int32_t komodo_isPoS(CBlock *pblock,int32_t height)
|
||||||
{
|
{
|
||||||
@@ -653,17 +653,17 @@ int32_t komodo_isPoS(CBlock *pblock,int32_t height)
|
|||||||
if ( ExtractDestination(pblock->vtx[n-1].vout[0].scriptPubKey,voutaddress) )
|
if ( ExtractDestination(pblock->vtx[n-1].vout[0].scriptPubKey,voutaddress) )
|
||||||
{
|
{
|
||||||
strcpy(voutaddr,CBitcoinAddress(voutaddress).ToString().c_str());
|
strcpy(voutaddr,CBitcoinAddress(voutaddress).ToString().c_str());
|
||||||
fprintf(stderr,"voutaddr.%s vs destaddr.%s\n",voutaddr,destaddr);
|
//fprintf(stderr,"voutaddr.%s vs destaddr.%s\n",voutaddr,destaddr);
|
||||||
if ( pblock->vtx[n-1].vout[0].nValue == value && strcmp(destaddr,voutaddr) == 0 )
|
if ( pblock->vtx[n-1].vout[0].nValue == value && strcmp(destaddr,voutaddr) == 0 )
|
||||||
{
|
{
|
||||||
if ( ASSETCHAINS_MARMARA == 0 )
|
if ( ASSETCHAINS_MARMARA == 0 )
|
||||||
return(1);
|
return(1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( pblock->vtx[n-1].vout[0].scriptPubKey.IsPayToCryptoCondition() != 0 && (numvouts= pblock->vtx[n-1].vout.size()) > 1 )
|
if ( pblock->vtx[n-1].vout[0].scriptPubKey.IsPayToCryptoCondition() != 0 && (numvouts= pblock->vtx[n-1].vout.size()) == 2 )
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"validate proper %s %s signature and unlockht preservation\n",voutaddr,destaddr);
|
//fprintf(stderr,"validate proper %s %s signature and unlockht preservation\n",voutaddr,destaddr);
|
||||||
return(MarmaraPoScheck(destaddr,opret,pblock->vtx[n-1].vout[numvouts-1].scriptPubKey));
|
return(MarmaraPoScheck(destaddr,opret,pblock->vtx[n-1]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -512,7 +512,7 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
|
|||||||
pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txStaked));
|
pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txStaked));
|
||||||
nFees += txfees;
|
nFees += txfees;
|
||||||
pblock->nTime = blocktime;
|
pblock->nTime = blocktime;
|
||||||
//printf("staking PoS ht.%d t%u lag.%u\n",(int32_t)chainActive.LastTip()->GetHeight()+1,blocktime,(uint32_t)(GetAdjustedTime() - (blocktime-13)));
|
printf("staking PoS ht.%d t%u lag.%u\n",(int32_t)chainActive.LastTip()->GetHeight()+1,blocktime,(uint32_t)(GetAdjustedTime() - (blocktime-13)));
|
||||||
} else return(0); //fprintf(stderr,"no utxos eligible for staking\n");
|
} else return(0); //fprintf(stderr,"no utxos eligible for staking\n");
|
||||||
}
|
}
|
||||||
// Create coinbase tx
|
// Create coinbase tx
|
||||||
|
|||||||
Reference in New Issue
Block a user