mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
merge bitcoin#17775: Try case where txn has inputs first
This commit is contained in:
parent
07946c5558
commit
e099f937e6
@ -24,7 +24,7 @@ struct CSpentIndexTxInfo;
|
||||
// core_read.cpp
|
||||
CScript ParseScript(const std::string& s);
|
||||
std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode = false);
|
||||
[[nodiscard]] bool DecodeHexTx(CMutableTransaction& tx, const std::string& strHexTx);
|
||||
[[nodiscard]] bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx);
|
||||
[[nodiscard]] bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
|
||||
bool DecodeHexBlockHeader(CBlockHeader&, const std::string& hex_header);
|
||||
/**
|
||||
|
@ -100,25 +100,31 @@ CScript ParseScript(const std::string& s)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool DecodeHexTx(CMutableTransaction& tx, const std::string& strHexTx)
|
||||
static bool DecodeTx(CMutableTransaction& tx, const std::vector<unsigned char>& tx_data)
|
||||
{
|
||||
if (!IsHex(strHexTx))
|
||||
return false;
|
||||
|
||||
std::vector<unsigned char> txData(ParseHex(strHexTx));
|
||||
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
|
||||
CDataStream ssData(tx_data, SER_NETWORK, PROTOCOL_VERSION);
|
||||
try {
|
||||
ssData >> tx;
|
||||
if (!ssData.empty())
|
||||
if (!ssData.empty()) {
|
||||
return false;
|
||||
}
|
||||
catch (const std::exception&) {
|
||||
}
|
||||
} catch (const std::exception&) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx)
|
||||
{
|
||||
if (!IsHex(hex_tx)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> txData(ParseHex(hex_tx));
|
||||
return DecodeTx(tx, txData);
|
||||
}
|
||||
|
||||
bool DecodeHexBlockHeader(CBlockHeader& header, const std::string& hex_header)
|
||||
{
|
||||
if (!IsHex(hex_header)) return false;
|
||||
|
Loading…
Reference in New Issue
Block a user