mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +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
|
// core_read.cpp
|
||||||
CScript ParseScript(const std::string& s);
|
CScript ParseScript(const std::string& s);
|
||||||
std::string ScriptToAsmStr(const CScript& script, const bool fAttemptSighashDecode = false);
|
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);
|
[[nodiscard]] bool DecodeHexBlk(CBlock&, const std::string& strHexBlk);
|
||||||
bool DecodeHexBlockHeader(CBlockHeader&, const std::string& hex_header);
|
bool DecodeHexBlockHeader(CBlockHeader&, const std::string& hex_header);
|
||||||
/**
|
/**
|
||||||
|
@ -100,25 +100,31 @@ CScript ParseScript(const std::string& s)
|
|||||||
return result;
|
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))
|
CDataStream ssData(tx_data, SER_NETWORK, PROTOCOL_VERSION);
|
||||||
return false;
|
|
||||||
|
|
||||||
std::vector<unsigned char> txData(ParseHex(strHexTx));
|
|
||||||
CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
|
|
||||||
try {
|
try {
|
||||||
ssData >> tx;
|
ssData >> tx;
|
||||||
if (!ssData.empty())
|
if (!ssData.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
catch (const std::exception&) {
|
} catch (const std::exception&) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
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)
|
bool DecodeHexBlockHeader(CBlockHeader& header, const std::string& hex_header)
|
||||||
{
|
{
|
||||||
if (!IsHex(hex_header)) return false;
|
if (!IsHex(hex_header)) return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user