Correct script serialization
This commit is contained in:
@@ -221,8 +221,10 @@ bool GetCCParams(Eval* eval, const CTransaction &tx, uint32_t nIn,
|
|||||||
{
|
{
|
||||||
if (tx.vout[tx.vout.size() - 1].scriptPubKey.GetOpretData(params) && params.size() == 1)
|
if (tx.vout[tx.vout.size() - 1].scriptPubKey.GetOpretData(params) && params.size() == 1)
|
||||||
{
|
{
|
||||||
CScript scr = CScript(params[0]);
|
CScript scr = CScript(params[0].begin(), params[0].end());
|
||||||
// printf("Stake cheat parameter opret:\n%s\n", scr.ToString().c_str());
|
|
||||||
|
printf("Script decoding inner:\n%s\nouter:\n%s\n", scr.ToString().c_str(), tx.vout[tx.vout.size() - 1].scriptPubKey.ToString().c_str());
|
||||||
|
|
||||||
if (!scr.GetPushedData(scr.begin(), params))
|
if (!scr.GetPushedData(scr.begin(), params))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -293,12 +293,17 @@ bool MakeCheatEvidence(CMutableTransaction &mtx, const CTransaction &ccTx, uint3
|
|||||||
if (ValidateMatchingStake(ccTx, voutNum, cheatTx, isCheater) && isCheater)
|
if (ValidateMatchingStake(ccTx, voutNum, cheatTx, isCheater) && isCheater)
|
||||||
{
|
{
|
||||||
CTxOut vOut = CTxOut();
|
CTxOut vOut = CTxOut();
|
||||||
|
int64_t opretype_stakecheat = OPRETTYPE_STAKECHEAT;
|
||||||
|
|
||||||
CScript vData = CScript();
|
CScript vData = CScript();
|
||||||
cheatTx.Serialize(s);
|
cheatTx.Serialize(s);
|
||||||
vch = std::vector<unsigned char>(s.begin(), s.end());
|
vch = std::vector<unsigned char>(s.begin(), s.end());
|
||||||
vData << ((int64_t)OPRETTYPE_STAKECHEAT) << vch;
|
vData << opretype_stakecheat << vch;
|
||||||
vOut.scriptPubKey << OP_RETURN << std::vector<unsigned char>(vData.begin(), vData.end());
|
vch = std::vector<unsigned char>(vData.begin(), vData.end());
|
||||||
|
vOut.scriptPubKey << OP_RETURN << vch;
|
||||||
|
|
||||||
|
printf("Script encoding inner:\n%s\nouter:\n%s\n", vData.ToString().c_str(), vOut.scriptPubKey.ToString().c_str());
|
||||||
|
|
||||||
vOut.nValue = 0;
|
vOut.nValue = 0;
|
||||||
mtx.vout.push_back(vOut);
|
mtx.vout.push_back(vOut);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user