mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
BIP144: Serialization, hashes, relay (sender side)
Contains refactorings by Eric Lombrozo. Contains fixup by Nicolas Dorier. Contains cleanup of CInv::GetCommand by Alex Morcos
This commit is contained in:
parent
ecacfd98e6
commit
7030d9eb47
21 changed files with 339 additions and 90 deletions
|
|
@ -90,12 +90,26 @@ CScript ParseScript(const std::string& s)
|
|||
return result;
|
||||
}
|
||||
|
||||
bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx)
|
||||
bool DecodeHexTx(CTransaction& tx, const std::string& strHexTx, bool fTryNoWitness)
|
||||
{
|
||||
if (!IsHex(strHexTx))
|
||||
return false;
|
||||
|
||||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue