Add better CETSignaturesV0TLV.toString so we don't accidentally DOS in the case of large amoutns of adaptor signatures (#3521)

This commit is contained in:
Chris Stewart 2021-08-11 10:23:01 -05:00 committed by GitHub
parent b2065a9c02
commit e829d03249
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1404,6 +1404,15 @@ case class CETSignaturesV0TLV(sigs: Vector[ECAdaptorSignature])
override val value: ByteVector = {
bigSizePrefixedList(sigs)
}
override def toString: String = {
if (sigs.length <= 5) {
super.toString
} else {
s"CETSignaturesV0TLV(sigs=${sigs.take(
2)}..., omitting remainingSigs of length=${sigs.length - 2})"
}
}
}
object CETSignaturesV0TLV extends TLVFactory[CETSignaturesV0TLV] {