Skip to content

Commit

Permalink
Allow parsing of incomplete flextrans transactions.
Browse files Browse the repository at this point in the history
  • Loading branch information
zander committed Feb 10, 2017
1 parent cb21309 commit 950e25f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/primitives/transaction.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ std::vector<char> loadTransaction(const std::vector<CMFToken> &tokens, std::vect
seenCoinbaseMessage = true; seenCoinbaseMessage = true;
break; break;
} }
case Consensus::TxEnd:
case Consensus::TxInputStackItem: case Consensus::TxInputStackItem:
case Consensus::TxInputStackItemContinued: { case Consensus::TxInputStackItemContinued: {
if (signatureCount == -1) { // copy all of the input tags if (signatureCount == -1) { // copy all of the input tags
Expand All @@ -163,6 +164,8 @@ std::vector<char> loadTransaction(const std::vector<CMFToken> &tokens, std::vect
} }
txData = std::vector<char>(stream.begin(), stream.end()); txData = std::vector<char>(stream.begin(), stream.end());
} }
if (token.tag == Consensus::TxEnd)
return txData;
if (signatureCount < 0 || token.tag == Consensus::TxInputStackItem) if (signatureCount < 0 || token.tag == Consensus::TxInputStackItem)
signatureCount++; signatureCount++;
if (static_cast<int>(inputs.size()) <= signatureCount) if (static_cast<int>(inputs.size()) <= signatureCount)
Expand All @@ -176,9 +179,6 @@ std::vector<char> loadTransaction(const std::vector<CMFToken> &tokens, std::vect
inputs[signatureCount].scriptSig << data; inputs[signatureCount].scriptSig << data;
break; break;
} }
case Consensus::TxEnd:
return txData;

// TxOut* don't have a pre-defined order, just that both are required so they always have to come in pairs. // TxOut* don't have a pre-defined order, just that both are required so they always have to come in pairs.
case Consensus::TxOutValue: case Consensus::TxOutValue:
if (!inMainTx) throw std::runtime_error("wrong section"); if (!inMainTx) throw std::runtime_error("wrong section");
Expand Down

0 comments on commit 950e25f

Please sign in to comment.