MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / DecodeHexTx

Function DecodeHexTx

src/core_read.cpp:113–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no_witness, bool try_witness)
114{
115 if (!IsHex(hex_tx)) {
116 return false;
117 }
118
119 std::vector<unsigned char> txData(ParseHex(hex_tx));
120
121 if (try_no_witness) {
122 CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS);
123 try {
124 ssData >> tx;
125 if (ssData.eof() && (!try_witness || CheckTxScriptsSanity(tx))) {
126 return true;
127 }
128 } catch (const std::exception&) {
129 // Fall through.
130 }
131 }
132
133 if (try_witness) {
134 CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION);
135 try {
136 ssData >> tx;
137 if (ssData.empty()) {
138 return true;
139 }
140 } catch (const std::exception&) {
141 // Fall through.
142 }
143 }
144
145 return false;
146}
147
148bool DecodeHexBlk(CBlock& block, const std::string& strHexBlk, bool fLegacyFormat)
149{

Callers 10

CommandLineRawTxFunction · 0.85
fundrawtransactionFunction · 0.85
importprunedfundsFunction · 0.85
decoderawtransactionFunction · 0.85
combinerawtransactionFunction · 0.85
sendrawtransactionFunction · 0.85
testmempoolacceptFunction · 0.85
converttopsbtFunction · 0.85

Calls 5

IsHexFunction · 0.85
ParseHexFunction · 0.85
CheckTxScriptsSanityFunction · 0.85
eofMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected