Minor: move ExcessivelyLargeTransactionGraph exception into the right place

This commit is contained in:
Mike Hearn 2016-02-18 17:29:44 +01:00
parent 54a73166c3
commit adda2bbe6b
2 changed files with 4 additions and 2 deletions

View File

@ -36,6 +36,8 @@ class ResolveTransactionsProtocol(private val txHashes: Set<SecureHash>,
private fun dependencyIDs(wtx: WireTransaction) = wtx.inputs.map { it.txhash }.toSet()
}
class ExcessivelyLargeTransactionGraph() : Exception()
// Transactions to verify after the dependencies.
private var stx: SignedTransaction? = null
private var wtx: WireTransaction? = null
@ -123,9 +125,10 @@ class ResolveTransactionsProtocol(private val txHashes: Set<SecureHash>,
// And loop around ...
// TODO: Figure out a more appropriate DOS limit here, 5000 is simply a guess.
// TODO: Unit test the DoS limit.
limitCounter += nextRequests.size
if (limitCounter > 5000)
throw TwoPartyTradeProtocol.ExcessivelyLargeTransactionGraphException()
throw ExcessivelyLargeTransactionGraph()
}
}
}

View File

@ -70,7 +70,6 @@ object TwoPartyTradeProtocol {
class AssetMismatchException(val expectedTypeName: String, val typeName: String) : Exception() {
override fun toString() = "The submitted asset didn't match the expected type: $expectedTypeName vs $typeName"
}
class ExcessivelyLargeTransactionGraphException() : Exception()
// This object is serialised to the network and is the first protocol message the seller sends to the buyer.
class SellerTradeInfo(