Skip to content

Commit

Permalink
Fix nits
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bast committed May 17, 2021
1 parent 5299f39 commit ce7a12d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,20 @@ object WeakEntropyPool {
Behaviors.same
}

case WrappedNewBlock(block) => collecting(collector, Some(collect(entropy_opt, block.hash ++ ByteVector.fromLong(System.currentTimeMillis()))))
case WrappedNewBlock(block) => collecting(collector, collect(entropy_opt, block.hash ++ ByteVector.fromLong(System.currentTimeMillis())))

case WrappedPaymentRelayed(paymentHash, relayedAt) => collecting(collector, Some(collect(entropy_opt, paymentHash ++ ByteVector.fromLong(relayedAt))))
case WrappedPaymentRelayed(paymentHash, relayedAt) => collecting(collector, collect(entropy_opt, paymentHash ++ ByteVector.fromLong(relayedAt)))

case WrappedPeerConnected(nodeId) => collecting(collector, Some(collect(entropy_opt, nodeId.value ++ ByteVector.fromLong(System.currentTimeMillis()))))
case WrappedPeerConnected(nodeId) => collecting(collector, collect(entropy_opt, nodeId.value ++ ByteVector.fromLong(System.currentTimeMillis())))

case WrappedNodeUpdated(sig) => collecting(collector, Some(collect(entropy_opt, sig ++ ByteVector.fromLong(System.currentTimeMillis()))))
case WrappedNodeUpdated(sig) => collecting(collector, collect(entropy_opt, sig ++ ByteVector.fromLong(System.currentTimeMillis())))

case WrappedChannelSignature(wtxid) => collecting(collector, Some(collect(entropy_opt, wtxid ++ ByteVector.fromLong(System.currentTimeMillis()))))
case WrappedChannelSignature(wtxid) => collecting(collector, collect(entropy_opt, wtxid ++ ByteVector.fromLong(System.currentTimeMillis())))
}
}

private def collect(entropy_opt: Option[ByteVector32], additional: ByteVector): ByteVector32 = {
Crypto.sha256(entropy_opt.map(_.bytes).getOrElse(ByteVector.empty) ++ additional)
private def collect(entropy_opt: Option[ByteVector32], additional: ByteVector): Option[ByteVector32] = {
Some(Crypto.sha256(entropy_opt.map(_.bytes).getOrElse(ByteVector.empty) ++ additional))
}

}
2 changes: 1 addition & 1 deletion eclair-core/src/main/scala/fr/acinq/eclair/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import scala.util.{Failure, Success, Try}

package object eclair {

def randomGen = new StrongRandom()
val randomGen = new StrongRandom()

def randomBytes(length: Int): ByteVector = {
val buffer = new Array[Byte](length)
Expand Down

0 comments on commit ce7a12d

Please sign in to comment.