put burntx opreturn at end of vout and fix crash with import tx

This commit is contained in:
Scott Sadler
2018-09-04 05:29:36 -03:00
parent 3716229824
commit 52ff32a564
4 changed files with 15 additions and 12 deletions

View File

@@ -45,7 +45,7 @@ bool UnmarshalBurnTx(const CTransaction &burnTx, std::string &targetSymbol, uint
{
std::vector<uint8_t> burnOpret;
if (burnTx.vout.size() == 0) return false;
GetOpReturnData(burnTx.vout[0].scriptPubKey, burnOpret);
GetOpReturnData(burnTx.vout.back().scriptPubKey, burnOpret);
return E_UNMARSHAL(burnOpret, ss >> VARINT(*targetCCid);
ss >> targetSymbol;
ss >> payoutsHash);
@@ -61,7 +61,7 @@ CAmount GetCoinImportValue(const CTransaction &tx)
CTransaction burnTx;
std::vector<CTxOut> payouts;
if (UnmarshalImportTx(tx, proof, burnTx, payouts)) {
return burnTx.vout.size() ? burnTx.vout[0].nValue : 0;
return burnTx.vout.size() ? burnTx.vout.back().nValue : 0;
}
return 0;
}