diff --git a/src/main/kotlin/contracts/protocols/ResolveTransactionsProtocol.kt b/src/main/kotlin/contracts/protocols/ResolveTransactionsProtocol.kt index 4994e39b45..1ec9ea93fa 100644 --- a/src/main/kotlin/contracts/protocols/ResolveTransactionsProtocol.kt +++ b/src/main/kotlin/contracts/protocols/ResolveTransactionsProtocol.kt @@ -36,6 +36,8 @@ class ResolveTransactionsProtocol(private val txHashes: Set, 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, // 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() } } } diff --git a/src/main/kotlin/contracts/protocols/TwoPartyTradeProtocol.kt b/src/main/kotlin/contracts/protocols/TwoPartyTradeProtocol.kt index 32c1ad9435..e0ee438567 100644 --- a/src/main/kotlin/contracts/protocols/TwoPartyTradeProtocol.kt +++ b/src/main/kotlin/contracts/protocols/TwoPartyTradeProtocol.kt @@ -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(