Add better exception messages (#4053)

This commit is contained in:
Chris Stewart 2022-02-06 11:14:58 -06:00 committed by GitHub
parent 7a6f0430d6
commit d213e9935d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -1614,7 +1614,7 @@ abstract class DLCWallet
Vector[DLCAnnouncementDb],
Vector[OracleAnnouncementDataDb],
Vector[OracleNonceDb])] =
dlcDataManagement.getDLCAnnouncementDbs(dlcDb.dlcId)
dlcDataManagement.getDLCAnnouncementDbs(dlcId)
val contractInfoAndAnnouncementsF: Future[
(ContractInfo, Vector[(OracleAnnouncementV0TLV, Long)])] = {

View File

@ -211,14 +211,15 @@ object DLCStatusBuilder {
nonceDbs: Vector[OracleNonceDb]): (
OracleOutcome,
Vector[SchnorrDigitalSignature]) = {
val noncesByAnnouncement =
val noncesByAnnouncement: Map[Long, Vector[OracleNonceDb]] =
nonceDbs.sortBy(_.index).groupBy(_.announcementId)
val oracleOutcome = {
val usedOracleIds = announcementIds.filter(_.used)
val usedOracles = usedOracleIds.sortBy(_.index).map { used =>
announcementsWithId.find(_._2 == used.announcementId).get
}
require(usedOracles.nonEmpty, "Error, no oracles used")
require(usedOracles.nonEmpty,
s"Error, no oracles used, dlcIds=${announcementIds.map(_.dlcId)}")
announcementsWithId.head._1.eventTLV.eventDescriptor match {
case _: EnumEventDescriptorV0TLV =>
val oracleInfos = usedOracles.map(t => EnumSingleOracleInfo(t._1))