Skip to content

Commit 950e25f

Browse files
committed
Allow parsing of incomplete flextrans transactions.
1 parent cb21309 commit 950e25f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/primitives/transaction.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ std::vector<char> loadTransaction(const std::vector<CMFToken> &tokens, std::vect
153153
seenCoinbaseMessage = true;
154154
break;
155155
}
156+
case Consensus::TxEnd:
156157
case Consensus::TxInputStackItem:
157158
case Consensus::TxInputStackItemContinued: {
158159
if (signatureCount == -1) { // copy all of the input tags
@@ -163,6 +164,8 @@ std::vector<char> loadTransaction(const std::vector<CMFToken> &tokens, std::vect
163164
}
164165
txData = std::vector<char>(stream.begin(), stream.end());
165166
}
167+
if (token.tag == Consensus::TxEnd)
168+
return txData;
166169
if (signatureCount < 0 || token.tag == Consensus::TxInputStackItem)
167170
signatureCount++;
168171
if (static_cast<int>(inputs.size()) <= signatureCount)
@@ -176,9 +179,6 @@ std::vector<char> loadTransaction(const std::vector<CMFToken> &tokens, std::vect
176179
inputs[signatureCount].scriptSig << data;
177180
break;
178181
}
179-
case Consensus::TxEnd:
180-
return txData;
181-
182182
// TxOut* don't have a pre-defined order, just that both are required so they always have to come in pairs.
183183
case Consensus::TxOutValue:
184184
if (!inMainTx) throw std::runtime_error("wrong section");

0 commit comments

Comments
 (0)