diff options
| author | Pieter Wuille <[email protected]> | 2015-11-06 01:32:04 +0100 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2016-06-22 15:42:59 +0200 |
| commit | 7030d9eb47254499bba14f1c00abc6bf493efd91 (patch) | |
| tree | 95055978907c7418c1b96728ff09413781b9c0b7 /src/core_read.cpp | |
| parent | --- [SEGWIT] begin: P2P/node/consensus --- (diff) | |
| download | discoin-7030d9eb47254499bba14f1c00abc6bf493efd91.tar.xz discoin-7030d9eb47254499bba14f1c00abc6bf493efd91.zip | |
BIP144: Serialization, hashes, relay (sender side)
Contains refactorings by Eric Lombrozo.
Contains fixup by Nicolas Dorier.
Contains cleanup of CInv::GetCommand by Alex Morcos
Diffstat (limited to 'src/core_read.cpp')
| -rw-r--r-- | src/core_read.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/core_read.cpp b/src/core_read.cpp index 444a4c7eb..7cfda6dd6 100644 --- a/src/core_read.cpp +++ b/src/core_read.cpp @@ -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; |