mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 01:40:55 +01:00
2024 04 30 upgrade eclair v0.10.0
(#5557)
* Fix open, audit commands for v0.10.0 * Get all unit tests passing * Add logger.error() to try to debug channel state * Try adding delay to see if dual funding process can complete before we generate blocks * scalafmt * Try bumping number of blocks generated * Try disabling dual funding * Cleanup
This commit is contained in:
parent
7ee749adcb
commit
7ed2b8801a
@ -222,13 +222,16 @@ object ReceivedPayment {
|
||||
)
|
||||
}
|
||||
|
||||
case class RelayTimestamp(iso: Instant, unix: Long)
|
||||
|
||||
case class RelayedPayment(
|
||||
amountIn: MilliSatoshis,
|
||||
amountOut: MilliSatoshis,
|
||||
paymentHash: Sha256Digest,
|
||||
fromChannelId: FundedChannelId,
|
||||
toChannelId: FundedChannelId,
|
||||
timestamp: Instant // milliseconds
|
||||
startedAt: RelayTimestamp,
|
||||
settledAt: RelayTimestamp
|
||||
)
|
||||
|
||||
case class SentPayment(
|
||||
@ -489,7 +492,7 @@ case class WalletTransaction(
|
||||
address: String,
|
||||
amount: Satoshis,
|
||||
fees: Satoshis,
|
||||
blockHash: DoubleSha256DigestBE,
|
||||
blockId_opt: Option[DoubleSha256DigestBE],
|
||||
confirmations: Long,
|
||||
txid: DoubleSha256DigestBE,
|
||||
timestamp: Long
|
||||
|
@ -1451,6 +1451,8 @@ object JsonReaders {
|
||||
|
||||
implicit val sentPaymentReads: Reads[SentPayment] = Json.reads[SentPayment]
|
||||
|
||||
implicit val relayTimestampReads: Reads[RelayTimestamp] =
|
||||
Json.reads[RelayTimestamp]
|
||||
implicit val relayedPaymentReads: Reads[RelayedPayment] = Reads { js =>
|
||||
for {
|
||||
amountIn <- (js \ "amountIn").validate[MilliSatoshis]
|
||||
@ -1458,15 +1460,16 @@ object JsonReaders {
|
||||
paymentHash <- (js \ "paymentHash").validate[Sha256Digest]
|
||||
fromChannelId <- (js \ "fromChannelId").validate[FundedChannelId]
|
||||
toChannelId <- (js \ "toChannelId").validate[FundedChannelId]
|
||||
timestamp <- (js \ "timestamp" \ "unix")
|
||||
.validate[Instant](instantReadsMilliseconds)
|
||||
startedAt <- (js \ "startedAt").validate[RelayTimestamp]
|
||||
settledAt <- (js \ "settledAt").validate[RelayTimestamp]
|
||||
} yield RelayedPayment(
|
||||
amountIn,
|
||||
amountOut,
|
||||
paymentHash,
|
||||
fromChannelId,
|
||||
toChannelId,
|
||||
timestamp
|
||||
startedAt,
|
||||
settledAt
|
||||
)
|
||||
}
|
||||
implicit val auditResultReads: Reads[AuditResult] = Json.reads[AuditResult]
|
||||
|
@ -130,6 +130,7 @@ TaskKeys.downloadBitcoind := {
|
||||
logger.info(s"Extracting archive with command: $extractCommand")
|
||||
extractCommand.!!
|
||||
} else {
|
||||
Files.delete(expectedEndLocation)
|
||||
logger.error(
|
||||
s"Downloaded invalid version of bitcoind v$version, got $hash, expected ${expectedHash(version)}")
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ object ChannelState extends StringFactory[ChannelState] {
|
||||
case object SYNCING extends ChannelState
|
||||
case object WAIT_FOR_REMOTE_PUBLISH_FUTURE_COMMITMENT extends ChannelState
|
||||
case object ERR_INFORMATION_LEAK extends ChannelState
|
||||
case object WAIT_FOR_DUAL_FUNDING_SIGNED extends ChannelState
|
||||
|
||||
private lazy val all: Map[String, ChannelState] = List(
|
||||
WAIT_FOR_INIT_INTERNAL,
|
||||
@ -57,7 +58,8 @@ object ChannelState extends StringFactory[ChannelState] {
|
||||
OFFLINE,
|
||||
SYNCING,
|
||||
WAIT_FOR_REMOTE_PUBLISH_FUTURE_COMMITMENT,
|
||||
ERR_INFORMATION_LEAK
|
||||
ERR_INFORMATION_LEAK,
|
||||
WAIT_FOR_DUAL_FUNDING_SIGNED
|
||||
).map(state => state.toString -> state).toMap
|
||||
|
||||
override def fromStringOpt(str: String): Option[ChannelState] = {
|
||||
|
@ -223,8 +223,8 @@ class EclairRpcClientTest extends BitcoinSAsyncTest {
|
||||
_ <-
|
||||
EclairRpcTestUtil
|
||||
.awaitUntilIncomingPaymentStatus[IncomingPaymentStatus.Received](
|
||||
client4,
|
||||
invoice.lnTags.paymentHash.hash,
|
||||
client = client4,
|
||||
paymentHash = invoice.lnTags.paymentHash.hash,
|
||||
interval = 1.second
|
||||
)
|
||||
|
||||
@ -262,7 +262,8 @@ class EclairRpcClientTest extends BitcoinSAsyncTest {
|
||||
_ <- EclairRpcTestUtil.openAndConfirmChannel(clientF, otherClientF)
|
||||
_ <- EclairRpcTestUtil.awaitEclairInSync(otherClient, bitcoind)
|
||||
_ <- EclairRpcTestUtil.awaitEclairInSync(client, bitcoind)
|
||||
invoice <- otherClient.createInvoice("abc", 50.msats)
|
||||
invoice <- otherClient.createInvoice(description = "abc",
|
||||
amountMsat = 50.msats)
|
||||
info <- otherClient.getInfo
|
||||
_ = assert(info.nodeId == invoice.nodeId)
|
||||
paymentResult <-
|
||||
@ -460,7 +461,7 @@ class EclairRpcClientTest extends BitcoinSAsyncTest {
|
||||
val getChannelId =
|
||||
(client: EclairRpcClient, otherClient: EclairRpcClient) => {
|
||||
otherClient.getInfo.flatMap { info =>
|
||||
val amt = Satoshis(100000)
|
||||
val amt = Satoshis(10000000)
|
||||
val openedChanF = clientF.flatMap(_.open(info.nodeId, amt))
|
||||
|
||||
openedChanF.flatMap { channelId =>
|
||||
@ -1002,7 +1003,7 @@ class EclairRpcClientTest extends BitcoinSAsyncTest {
|
||||
c2: EclairRpcClient
|
||||
): Future[FundedChannelId] = {
|
||||
EclairRpcTestUtil
|
||||
.openChannel(c1, c2, Satoshis(500000), MilliSatoshis(500000))
|
||||
.openChannel(c1, c2, Satoshis(50000000), MilliSatoshis(500000))
|
||||
}
|
||||
|
||||
val openedChannelsF: Future[(ChannelId, ChannelId)] = {
|
||||
|
@ -19,8 +19,8 @@ TaskKeys.downloadEclair := {
|
||||
Files.createDirectories(binaryDir)
|
||||
}
|
||||
|
||||
val version = "0.9.0"
|
||||
val commit = "623f7e4"
|
||||
val version = "0.10.0"
|
||||
val commit = "a63d2c2"
|
||||
|
||||
logger.debug(s"(Maybe) downloading Eclair binaries for version: $version")
|
||||
|
||||
@ -48,7 +48,7 @@ TaskKeys.downloadEclair := {
|
||||
.mkString
|
||||
|
||||
val expectedHash =
|
||||
"249604de45c54dc48f02c7335b49ff2896334fd44541dbb175e56aff66054cdc"
|
||||
"ee221cac0f3f8379fcac3eb7b558690de92b417365cc005524da2a6305d41e03"
|
||||
|
||||
val success = hash.equalsIgnoreCase(expectedHash)
|
||||
if (success) {
|
||||
@ -58,6 +58,7 @@ TaskKeys.downloadEclair := {
|
||||
logger.info(s"Extracting archive with command: $extractCommand")
|
||||
extractCommand.!!
|
||||
} else {
|
||||
Files.delete(versionDir)
|
||||
logger.error(
|
||||
s"Downloaded invalid version of eclair, got $hash, expected $expectedHash")
|
||||
}
|
||||
|
@ -1081,10 +1081,10 @@ object EclairRpcClient {
|
||||
) = new EclairRpcClient(instance, binary)
|
||||
|
||||
/** The current commit we support of Eclair */
|
||||
private[bitcoins] val commit = "623f7e4"
|
||||
private[bitcoins] val commit = "a63d2c2"
|
||||
|
||||
/** The current version we support of Eclair */
|
||||
private[bitcoins] val version = "0.9.0"
|
||||
private[bitcoins] val version = "0.10.0"
|
||||
|
||||
/** The bitcoind version that eclair is officially tested & supported with by
|
||||
* ACINQ
|
||||
|
@ -92,6 +92,7 @@ TaskKeys.downloadLnd := {
|
||||
logger.info(s"Extracting archive with command: $extractCommand")
|
||||
extractCommand.!!
|
||||
} else {
|
||||
Files.delete(versionDir)
|
||||
logger.error(
|
||||
s"Downloaded invalid version of lnd, got $hash, expected $expectedHash")
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<root level="OFF">
|
||||
<appender-ref ref="FILE"/>
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</root>
|
||||
|
@ -10,7 +10,7 @@ import org.bitcoins.commons.jsonmodels.eclair.{
|
||||
}
|
||||
import org.bitcoins.commons.util.BitcoinSLogger
|
||||
import org.bitcoins.core.compat.JavaConverters._
|
||||
import org.bitcoins.core.currency.{CurrencyUnit, Satoshis}
|
||||
import org.bitcoins.core.currency.{Bitcoins, CurrencyUnit, Satoshis}
|
||||
import org.bitcoins.core.protocol.ln.channel.{
|
||||
ChannelId,
|
||||
ChannelState,
|
||||
@ -125,7 +125,10 @@ trait EclairRpcTestUtil extends BitcoinSLogger {
|
||||
"eclair.alias" -> "suredbits",
|
||||
"eclair.channel.fulfill-safety-before-timeout-blocks" -> 1,
|
||||
"eclair.channel.min-final-expiry-delta-blocks" -> 2,
|
||||
"eclair.features.keysend" -> "optional"
|
||||
"eclair.features.keysend" -> "optional",
|
||||
// for some reason dual funded channels causes tests to fail on CI
|
||||
// but not locally on my laptop, disable them for now
|
||||
"eclair.features.option_dual_fund" -> "disabled"
|
||||
)
|
||||
}
|
||||
val c = ConfigFactory.parseMap(configMap.asJava)
|
||||
@ -457,7 +460,7 @@ trait EclairRpcTestUtil extends BitcoinSLogger {
|
||||
def openAndConfirmChannel(
|
||||
client1F: Future[EclairRpcClient],
|
||||
client2F: Future[EclairRpcClient],
|
||||
amount: CurrencyUnit = Satoshis(1000000)
|
||||
amount: CurrencyUnit = Satoshis(10000000)
|
||||
)(implicit system: ActorSystem): Future[ChannelId] = {
|
||||
import system.dispatcher
|
||||
val bitcoindRpcF = client1F.map(EclairRpcTestUtil.getBitcoindRpc(_))
|
||||
@ -681,7 +684,7 @@ trait EclairRpcTestUtil extends BitcoinSLogger {
|
||||
resultF
|
||||
}
|
||||
|
||||
private val DEFAULT_CHANNEL_MSAT_AMT = MilliSatoshis(500000000L)
|
||||
private val DEFAULT_CHANNEL_MSAT_AMT = MilliSatoshis(Bitcoins.one.satoshis)
|
||||
|
||||
/** Opens a channel from n1 -> n2 */
|
||||
def openChannel(
|
||||
|
Loading…
Reference in New Issue
Block a user