@@ -109,16 +109,10 @@ static bool CheckTxScriptsSanity(const CMutableTransaction& tx)
109
109
return true ;
110
110
}
111
111
112
- bool DecodeHexTx (CMutableTransaction& tx, const std::string& hex_tx , bool try_no_witness, bool try_witness)
112
+ static bool DecodeTx (CMutableTransaction& tx, const std::vector< unsigned char >& tx_data , bool try_no_witness, bool try_witness)
113
113
{
114
- if (!IsHex (hex_tx)) {
115
- return false ;
116
- }
117
-
118
- std::vector<unsigned char > txData (ParseHex (hex_tx));
119
-
120
114
if (try_witness) {
121
- CDataStream ssData (txData , SER_NETWORK, PROTOCOL_VERSION);
115
+ CDataStream ssData (tx_data , SER_NETWORK, PROTOCOL_VERSION);
122
116
try {
123
117
ssData >> tx;
124
118
// If transaction looks sane, we don't try other mode even if requested
@@ -131,7 +125,7 @@ bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no
131
125
}
132
126
133
127
if (try_no_witness) {
134
- CDataStream ssData (txData , SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS);
128
+ CDataStream ssData (tx_data , SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS);
135
129
try {
136
130
ssData >> tx;
137
131
if (ssData.empty ()) {
@@ -145,6 +139,16 @@ bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no
145
139
return false ;
146
140
}
147
141
142
+ bool DecodeHexTx (CMutableTransaction& tx, const std::string& hex_tx, bool try_no_witness, bool try_witness)
143
+ {
144
+ if (!IsHex (hex_tx)) {
145
+ return false ;
146
+ }
147
+
148
+ std::vector<unsigned char > txData (ParseHex (hex_tx));
149
+ return DecodeTx (tx, txData, try_no_witness, try_witness);
150
+ }
151
+
148
152
bool DecodeHexBlockHeader (CBlockHeader& header, const std::string& hex_header)
149
153
{
150
154
if (!IsHex (hex_header)) return false ;
0 commit comments