changed elements serialization to new style with no marker 0x00 byte and witness data at the end

This commit is contained in:
tdudz 2017-07-17 16:34:42 -07:00 committed by Tom Dudzik
parent de19cfe797
commit d3a48d59e3
8 changed files with 43 additions and 79 deletions

View file

@ -88,26 +88,13 @@ CScript ParseScript(const std::string& s)
return result;
}
bool DecodeHexTx(CMutableTransaction& tx, const std::string& strHexTx, bool fTryNoWitness)
bool DecodeHexTx(CMutableTransaction& tx, const std::string& strHexTx)
{
if (!IsHex(strHexTx))
return false;
std::vector<unsigned char> txData(ParseHex(strHexTx));
if (fTryNoWitness) {
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS);
try {
ssData >> tx;
if (ssData.eof()) {
return true;
}
}
catch (const std::exception&) {
// Fall through.
}
}
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
try {
ssData >> tx;