Skip to content

Commit c22596b

Browse files
pm47t-bast
andauthored
Update dependencies and enable fatal warnings (#1885)
Co-authored-by: Bastien Teinturier <[email protected]>
1 parent 79729c7 commit c22596b

File tree

89 files changed

+788
-783
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+788
-783
lines changed

eclair-core/pom.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
<dependency>
169169
<groupId>org.json4s</groupId>
170170
<artifactId>json4s-jackson_${scala.version.short}</artifactId>
171-
<version>3.6.7</version>
171+
<version>3.6.11</version>
172172
</dependency>
173173
<dependency>
174174
<groupId>com.softwaremill.sttp</groupId>
@@ -202,7 +202,7 @@
202202
<dependency>
203203
<groupId>org.scodec</groupId>
204204
<artifactId>scodec-core_${scala.version.short}</artifactId>
205-
<version>1.11.7</version>
205+
<version>1.11.8</version>
206206
</dependency>
207207
<dependency>
208208
<groupId>commons-codec</groupId>
@@ -224,11 +224,11 @@
224224
<dependency>
225225
<groupId>org.xerial</groupId>
226226
<artifactId>sqlite-jdbc</artifactId>
227-
<version>3.34.0</version>
227+
<version>3.36.0.1</version>
228228
</dependency>
229229
<dependency>
230230
<groupId>org.postgresql</groupId>
231-
<version>42.2.12</version>
231+
<version>42.2.23</version>
232232
<artifactId>postgresql</artifactId>
233233
</dependency>
234234
<dependency>

eclair-core/src/main/scala/fr/acinq/eclair/MilliSatoshi.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ case class MilliSatoshi(private val underlying: Long) extends Ordered[MilliSatos
3535
def *(m: Long) = MilliSatoshi(underlying * m)
3636
def *(m: Double) = MilliSatoshi((underlying * m).toLong)
3737
def /(d: Long) = MilliSatoshi(underlying / d)
38-
def unary_-() = MilliSatoshi(-underlying)
38+
def unary_- = MilliSatoshi(-underlying)
3939

4040
override def compare(other: MilliSatoshi): Int = underlying.compareTo(other.underlying)
4141
// Since BtcAmount is a sealed trait that MilliSatoshi cannot extend, we need to redefine comparison operators.

eclair-core/src/main/scala/fr/acinq/eclair/PimpKamon.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object KamonExt {
3434
def timeFuture[T](timer: Timer)(f: => Future[T])(implicit ec: ExecutionContext): Future[T] = {
3535
val started = timer.start()
3636
val res = f
37-
res onComplete (_ => started.stop)
37+
res onComplete (_ => started.stop())
3838
res
3939
}
4040

eclair-core/src/main/scala/fr/acinq/eclair/Setup.scala

+15-13
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,21 @@ class Setup(val datadir: File,
222222
case _ =>
223223
new FallbackFeeProvider(new SmoothFeeProvider(new BitcoinCoreFeeProvider(bitcoin, defaultFeerates), smoothFeerateWindow) :: Nil, minFeeratePerByte)
224224
}
225-
_ = system.scheduler.schedule(0 seconds, 10 minutes)(feeProvider.getFeerates.onComplete {
226-
case Success(feerates) =>
227-
feeratesPerKB.set(feerates)
228-
feeratesPerKw.set(FeeratesPerKw(feerates))
229-
channel.Monitoring.Metrics.LocalFeeratePerKw.withoutTags().update(feeratesPerKw.get.feePerBlock(nodeParams.onChainFeeConf.feeTargets.commitmentBlockTarget).toLong)
230-
blockchain.Monitoring.Metrics.MempoolMinFeeratePerKw.withoutTags().update(feeratesPerKw.get.mempoolMinFee.toLong)
231-
system.eventStream.publish(CurrentFeerates(feeratesPerKw.get))
232-
logger.info(s"current feeratesPerKB=${feeratesPerKB.get} feeratesPerKw=${feeratesPerKw.get}")
233-
feeratesRetrieved.trySuccess(Done)
234-
case Failure(exception) =>
235-
logger.warn(s"cannot retrieve feerates: ${exception.getMessage}")
236-
blockchain.Monitoring.Metrics.CannotRetrieveFeeratesCount.withoutTags().increment()
237-
feeratesRetrieved.tryFailure(CannotRetrieveFeerates)
225+
_ = system.scheduler.scheduleWithFixedDelay(0 seconds, 10 minutes)(new Runnable {
226+
override def run(): Unit = feeProvider.getFeerates.onComplete {
227+
case Success(feerates) =>
228+
feeratesPerKB.set(feerates)
229+
feeratesPerKw.set(FeeratesPerKw(feerates))
230+
channel.Monitoring.Metrics.LocalFeeratePerKw.withoutTags().update(feeratesPerKw.get.feePerBlock(nodeParams.onChainFeeConf.feeTargets.commitmentBlockTarget).toLong.toDouble)
231+
blockchain.Monitoring.Metrics.MempoolMinFeeratePerKw.withoutTags().update(feeratesPerKw.get.mempoolMinFee.toLong.toDouble)
232+
system.eventStream.publish(CurrentFeerates(feeratesPerKw.get))
233+
logger.info(s"current feeratesPerKB=${feeratesPerKB.get} feeratesPerKw=${feeratesPerKw.get}")
234+
feeratesRetrieved.trySuccess(Done)
235+
case Failure(exception) =>
236+
logger.warn(s"cannot retrieve feerates: ${exception.getMessage}")
237+
blockchain.Monitoring.Metrics.CannotRetrieveFeeratesCount.withoutTags().increment()
238+
feeratesRetrieved.tryFailure(CannotRetrieveFeerates)
239+
}
238240
})
239241
_ <- feeratesRetrieved.future
240242

eclair-core/src/main/scala/fr/acinq/eclair/balance/BalanceActor.scala

+12-12
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,24 @@ private class BalanceActor(context: ActorContext[Command],
8484
log.info("current balance: total={} onchain.confirmed={} onchain.unconfirmed={} offchain={}", result.total.toDouble, result.onChain.confirmed.toDouble, result.onChain.unconfirmed.toDouble, result.offChain.total.toDouble)
8585
log.debug("current balance details : {}", result)
8686
Metrics.GlobalBalance.withoutTags().update(result.total.toMilliBtc.toDouble)
87-
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.OnchainConfirmed).update(result.onChain.confirmed.toMilliBtc.toLong)
88-
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.OnchainUnconfirmed).update(result.onChain.unconfirmed.toMilliBtc.toLong)
89-
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.waitForFundingConfirmed).update(result.offChain.waitForFundingConfirmed.toMilliBtc.toLong)
90-
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.waitForFundingLocked).update(result.offChain.waitForFundingLocked.toMilliBtc.toLong)
91-
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.normal).update(result.offChain.normal.total.toMilliBtc.toLong)
92-
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.shutdown).update(result.offChain.shutdown.total.toMilliBtc.toLong)
93-
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.closingLocal).update(result.offChain.closing.localCloseBalance.total.toMilliBtc.toLong)
94-
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.closingRemote).update(result.offChain.closing.remoteCloseBalance.total.toMilliBtc.toLong)
95-
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.closingUnknown).update(result.offChain.closing.unknownCloseBalance.total.toMilliBtc.toLong)
96-
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.waitForPublishFutureCommitment).update(result.offChain.waitForPublishFutureCommitment.toMilliBtc.toLong)
87+
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.OnchainConfirmed).update(result.onChain.confirmed.toMilliBtc.toDouble)
88+
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.OnchainUnconfirmed).update(result.onChain.unconfirmed.toMilliBtc.toDouble)
89+
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.waitForFundingConfirmed).update(result.offChain.waitForFundingConfirmed.toMilliBtc.toDouble)
90+
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.waitForFundingLocked).update(result.offChain.waitForFundingLocked.toMilliBtc.toDouble)
91+
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.normal).update(result.offChain.normal.total.toMilliBtc.toDouble)
92+
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.shutdown).update(result.offChain.shutdown.total.toMilliBtc.toDouble)
93+
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.closingLocal).update(result.offChain.closing.localCloseBalance.total.toMilliBtc.toDouble)
94+
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.closingRemote).update(result.offChain.closing.remoteCloseBalance.total.toMilliBtc.toDouble)
95+
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.closingUnknown).update(result.offChain.closing.unknownCloseBalance.total.toMilliBtc.toDouble)
96+
Metrics.GlobalBalanceDetailed.withTag(Tags.BalanceType, Tags.BalanceTypes.Offchain).withTag(Tags.OffchainState, Tags.OffchainStates.waitForPublishFutureCommitment).update(result.offChain.waitForPublishFutureCommitment.toMilliBtc.toDouble)
9797
refBalance_opt match {
9898
case Some(refBalance) =>
9999
val normalizedValue = 100 + (if (refBalance.total.toSatoshi.toLong > 0) (result.total.toSatoshi.toLong - refBalance.total.toSatoshi.toLong) * 1000D / refBalance.total.toSatoshi.toLong else 0)
100100
val diffValue = result.total.toSatoshi.toLong - refBalance.total.toSatoshi.toLong
101101
log.info("relative balance: current={} reference={} normalized={} diff={}", result.total.toDouble, refBalance.total.toDouble, normalizedValue, diffValue)
102102
Metrics.GlobalBalanceNormalized.withoutTags().update(normalizedValue)
103-
Metrics.GlobalBalanceDiff.withTag(Tags.DiffSign, Tags.DiffSigns.plus).update(diffValue.max(0))
104-
Metrics.GlobalBalanceDiff.withTag(Tags.DiffSign, Tags.DiffSigns.minus).update((-diffValue).max(0))
103+
Metrics.GlobalBalanceDiff.withTag(Tags.DiffSign, Tags.DiffSigns.plus).update(diffValue.max(0).toDouble)
104+
Metrics.GlobalBalanceDiff.withTag(Tags.DiffSign, Tags.DiffSigns.minus).update((-diffValue).max(0).toDouble)
105105
Behaviors.same
106106
case None =>
107107
log.info("using balance={} as reference", result.total.toDouble)

eclair-core/src/main/scala/fr/acinq/eclair/balance/CheckBalance.scala

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import fr.acinq.eclair.blockchain.bitcoind.rpc.ExtendedBitcoinClient
66
import fr.acinq.eclair.channel.Helpers.Closing
77
import fr.acinq.eclair.channel.Helpers.Closing.{CurrentRemoteClose, LocalClose, NextRemoteClose, RemoteClose}
88
import fr.acinq.eclair.channel._
9-
import fr.acinq.eclair.db.{Databases, PendingCommandsDb}
9+
import fr.acinq.eclair.db.Databases
1010
import fr.acinq.eclair.transactions.DirectedHtlc.{incoming, outgoing}
1111
import fr.acinq.eclair.transactions.Transactions
1212
import fr.acinq.eclair.transactions.Transactions.{ClaimHtlcSuccessTx, ClaimHtlcTimeoutTx, HtlcSuccessTx, HtlcTimeoutTx}
@@ -220,7 +220,8 @@ object CheckBalance {
220220
val remoteClose = if (d.remoteCommitPublished.isDefined) {
221221
CurrentRemoteClose(d.commitments.remoteCommit, d.remoteCommitPublished.get)
222222
} else {
223-
NextRemoteClose(d.commitments.remoteNextCommitInfo.left.get.nextRemoteCommit, d.nextRemoteCommitPublished.get)
223+
val Left(waitingForRevocation) = d.commitments.remoteNextCommitInfo
224+
NextRemoteClose(waitingForRevocation.nextRemoteCommit, d.nextRemoteCommitPublished.get)
224225
}
225226
r.modify(_.closing.remoteCloseBalance).using(updatePossiblyPublishedBalance(computeRemoteCloseBalance(d.commitments, remoteClose, knownPreimages)))
226227
case _ => r.modify(_.closing.unknownCloseBalance).using(updateMainAndHtlcBalance(d.commitments.localCommit, knownPreimages))
@@ -267,8 +268,8 @@ object CheckBalance {
267268
def computeOnChainBalance(bitcoinClient: ExtendedBitcoinClient)(implicit ec: ExecutionContext): Future[CorrectedOnChainBalance] = for {
268269
utxos <- bitcoinClient.listUnspent()
269270
detailed = utxos.foldLeft(DetailedBalance()) {
270-
case (total, utxo) if utxo.confirmations > 0 => total.modify(_.confirmed).using(_ + utxo.amount)
271271
case (total, utxo) if utxo.confirmations == 0 => total.modify(_.unconfirmed).using(_ + utxo.amount)
272+
case (total, utxo) => total.modify(_.confirmed).using(_ + utxo.amount)
272273
}
273274
} yield CorrectedOnChainBalance(detailed.confirmed, detailed.unconfirmed)
274275

eclair-core/src/main/scala/fr/acinq/eclair/blockchain/bitcoind/ZmqWatcher.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ import fr.acinq.bitcoin._
2323
import fr.acinq.eclair.blockchain.Monitoring.Metrics
2424
import fr.acinq.eclair.blockchain._
2525
import fr.acinq.eclair.blockchain.bitcoind.rpc.ExtendedBitcoinClient
26-
import fr.acinq.eclair.blockchain.bitcoind.rpc.ExtendedBitcoinClient.Utxo
2726
import fr.acinq.eclair.blockchain.watchdogs.BlockchainWatchdog
2827
import fr.acinq.eclair.wire.protocol.ChannelAnnouncement
2928
import fr.acinq.eclair.{KamonExt, ShortChannelId}
30-
import org.json4s.JsonAST._
3129

3230
import java.util.concurrent.atomic.AtomicLong
3331
import scala.concurrent.duration._
@@ -381,6 +379,7 @@ private class ZmqWatcher(chainHash: ByteVector32, blockCount: AtomicLong, client
381379
}
382380
}
383381
}
382+
case _ => Future.successful((): Unit)
384383
}
385384
}
386385

eclair-core/src/main/scala/fr/acinq/eclair/blockchain/bitcoind/rpc/BatchingClient.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ class BatchingClient(rpcClient: BasicBitcoinJsonRPCClient) extends Actor with Ac
2929
override def receive: Receive = {
3030
case request: JsonRPCRequest =>
3131
// immediately process isolated request
32-
process(queue = Queue(Pending(request, sender)))
32+
process(queue = Queue(Pending(request, sender())))
3333
}
3434

3535
def waiting(queue: Queue[Pending], processing: Seq[Pending]): Receive = {
3636
case request: JsonRPCRequest =>
3737
// there is already a batch in flight, just add this request to the queue
38-
context become waiting(queue :+ Pending(request, sender), processing)
38+
context become waiting(queue :+ Pending(request, sender()), processing)
3939

4040
case responses: Seq[JsonRPCResponse]@unchecked =>
4141
log.debug("got {} responses", responses.size)

eclair-core/src/main/scala/fr/acinq/eclair/blockchain/fee/BitcoinCoreFeeProvider.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ object BitcoinCoreFeeProvider {
7272
def parseFeeEstimate(json: JValue): FeeratePerKB = {
7373
json \ "errors" match {
7474
case JNothing =>
75-
json \ "feerate" match {
75+
(json \ "feerate": @unchecked) match {
7676
case JDecimal(feerate) =>
7777
// estimatesmartfee returns a fee rate in Btc/KB
7878
FeeratePerKB(Btc(feerate).toSatoshi)

eclair-core/src/main/scala/fr/acinq/eclair/blockchain/watchdogs/BlockchainWatchdog.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ object BlockchainWatchdog {
9393
} else {
9494
context.log.info("{}: we are {} blocks late", source, missingBlocks)
9595
}
96-
Metrics.BitcoinBlocksSkew.withTag(Tags.Source, source).update(missingBlocks)
96+
Metrics.BitcoinBlocksSkew.withTag(Tags.Source, source).update(missingBlocks.toDouble)
9797
Behaviors.same
9898
}
9999
}

0 commit comments

Comments
 (0)