Skip to content

Commit

Permalink
Use option_static_remotekey from global-features, see lightning/bolts…
Browse files Browse the repository at this point in the history
  • Loading branch information
araspitzu committed Oct 3, 2019
1 parent d956374 commit 58a5da0
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions eclair-core/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ eclair {
node-alias = "eclair"
node-color = "49daaa"

global-features = "0200" // variable_length_onion
local-features = "208a" // initial_routing_sync + option_data_loss_protect + option_channel_range_queries + option_static_remotekey
global-features = "2200" // variable_length_onion + option_static_remotekey
local-features = "8a" // initial_routing_sync + option_data_loss_protect + option_channel_range_queries
override-features = [ // optional per-node features
# {
# nodeid = "02aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ class Channel(val nodeParams: NodeParams, val wallet: EclairWallet, remoteNodeId
case Success(_) =>
context.system.eventStream.publish(ChannelCreated(self, context.parent, remoteNodeId, isFunder = false, open.temporaryChannelId, open.feeratePerKw, None))
val fundingPubkey = keyManager.fundingPublicKey(localParams.fundingKeyPath).publicKey
val channelVersion = Features.canUseStaticRemoteKey(localParams.localFeatures, remoteInit.localFeatures) match {
val channelVersion = Features.canUseStaticRemoteKey(localParams.globalFeatures, remoteInit.globalFeatures) match {
case false => ChannelVersion.STANDARD
case true => ChannelVersion.STATIC_REMOTEKEY
}
Expand Down
4 changes: 2 additions & 2 deletions eclair-core/src/main/scala/fr/acinq/eclair/io/Peer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class Peer(val nodeParams: NodeParams, remoteNodeId: PublicKey, authenticator: A
stay

case Event(c: Peer.OpenChannel, d: ConnectedData) =>
val channelVersion = Features.canUseStaticRemoteKey(d.localInit.localFeatures, d.remoteInit.localFeatures) match {
val channelVersion = Features.canUseStaticRemoteKey(d.localInit.globalFeatures, d.remoteInit.globalFeatures) match {
case false => ChannelVersion.STANDARD
case true => ChannelVersion.STATIC_REMOTEKEY
}
Expand All @@ -306,7 +306,7 @@ class Peer(val nodeParams: NodeParams, remoteNodeId: PublicKey, authenticator: A

case Event(msg: wire.OpenChannel, d: ConnectedData) =>
d.transport ! TransportHandler.ReadAck(msg)
val channelVersion = Features.canUseStaticRemoteKey(d.localInit.localFeatures, d.remoteInit.localFeatures) match {
val channelVersion = Features.canUseStaticRemoteKey(d.localInit.globalFeatures, d.remoteInit.globalFeatures) match {
case false => ChannelVersion.STANDARD
case true => ChannelVersion.STATIC_REMOTEKEY
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ trait StateTestsHelperMethods extends TestKitBase with fixture.TestSuite with Pa
val channelFlags = if (tags.contains("channels_public")) ChannelFlags.AnnounceChannel else ChannelFlags.Empty
val pushMsat = if (tags.contains("no_push_msat")) 0.msat else TestConstants.pushMsat
val (aliceParams, bobParams) = if(tags.contains("static_remotekey")) {
(Alice.channelParams.copy(localFeatures = hex"2000", localPaymentBasepoint = Some(Helpers.getWalletPaymentBasepoint(wallet))),
Bob.channelParams.copy(localFeatures = hex"2000", localPaymentBasepoint = Some(Helpers.getWalletPaymentBasepoint(wallet))))
(Alice.channelParams.copy(globalFeatures = hex"2000", localPaymentBasepoint = Some(Helpers.getWalletPaymentBasepoint(wallet))),
Bob.channelParams.copy(globalFeatures = hex"2000", localPaymentBasepoint = Some(Helpers.getWalletPaymentBasepoint(wallet))))
} else {
(Alice.channelParams, Bob.channelParams)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class WaitForFundingCreatedStateSpec extends TestkitBaseClass with StateTestsHel
}
val channelVersion = if(test.tags.contains("static_remotekey")) ChannelVersion.STATIC_REMOTEKEY else ChannelVersion.STANDARD
val (aliceParams, bobParams) = if(test.tags.contains("static_remotekey"))
(Alice.channelParams.copy(localFeatures = hex"2000"), Bob.channelParams.copy(localFeatures = hex"2000"))
(Alice.channelParams.copy(globalFeatures = hex"2000"), Bob.channelParams.copy(globalFeatures = hex"2000"))
else
(Alice.channelParams, Bob.channelParams)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1044,8 +1044,8 @@ class NormalStateSpec extends TestkitBaseClass with StateTestsHelperMethods {
import f._
val sender = TestProbe()

assert(alice.stateData.asInstanceOf[DATA_NORMAL].commitments.localParams.localFeatures == hex"2000")
assert(bob.stateData.asInstanceOf[DATA_NORMAL].commitments.localParams.localFeatures == hex"2000")
assert(alice.stateData.asInstanceOf[DATA_NORMAL].commitments.localParams.globalFeatures == hex"2000")
assert(bob.stateData.asInstanceOf[DATA_NORMAL].commitments.localParams.globalFeatures == hex"2000")

def aliceToRemoteScript() = {
val toRemoteAmount = alice.stateData.asInstanceOf[DATA_NORMAL].commitments.localCommit.spec.toRemote
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class IntegrationSpec extends TestKit(ActorSystem("test")) with BitcoindService
))

val commonConfig = ConfigFactory.parseMap(Map(
"eclair.local-features" -> "8a",
"eclair.global-features" -> "0200", // don't use static_remotekey by default
"eclair.chain" -> "regtest",
"eclair.server.public-ips.1" -> "127.0.0.1",
"eclair.bitcoind.port" -> bitcoindPort,
Expand Down Expand Up @@ -143,15 +143,15 @@ class IntegrationSpec extends TestKit(ActorSystem("test")) with BitcoindService
import collection.JavaConversions._
instantiateEclairNode("A", ConfigFactory.parseMap(Map("eclair.node-alias" -> "A", "eclair.expiry-delta-blocks" -> 130, "eclair.server.port" -> 29730, "eclair.api.port" -> 28080, "eclair.channel-flags" -> 0)).withFallback(commonConfig)) // A's channels are private
instantiateEclairNode("B", ConfigFactory.parseMap(Map("eclair.node-alias" -> "B", "eclair.expiry-delta-blocks" -> 131, "eclair.server.port" -> 29731, "eclair.api.port" -> 28081)).withFallback(commonConfig))
instantiateEclairNode("C", ConfigFactory.parseMap(Map("eclair.node-alias" -> "C", "eclair.expiry-delta-blocks" -> 132, "eclair.server.port" -> 29732, "eclair.api.port" -> 28082, "eclair.payment-handler" -> "noop", "eclair.local-features" -> "208a")).withFallback(commonConfig))
instantiateEclairNode("C", ConfigFactory.parseMap(Map("eclair.node-alias" -> "C", "eclair.expiry-delta-blocks" -> 132, "eclair.server.port" -> 29732, "eclair.api.port" -> 28082, "eclair.payment-handler" -> "noop", "eclair.global-features" -> "2000")).withFallback(commonConfig))
instantiateEclairNode("D", ConfigFactory.parseMap(Map("eclair.node-alias" -> "D", "eclair.expiry-delta-blocks" -> 133, "eclair.server.port" -> 29733, "eclair.api.port" -> 28083)).withFallback(commonConfig))
instantiateEclairNode("E", ConfigFactory.parseMap(Map("eclair.node-alias" -> "E", "eclair.expiry-delta-blocks" -> 134, "eclair.server.port" -> 29734, "eclair.api.port" -> 28084)).withFallback(commonConfig))
instantiateEclairNode("F1", ConfigFactory.parseMap(Map("eclair.node-alias" -> "F1", "eclair.expiry-delta-blocks" -> 135, "eclair.server.port" -> 29735, "eclair.api.port" -> 28085, "eclair.payment-handler" -> "noop")).withFallback(commonConfig)) // NB: eclair.payment-handler = noop allows us to manually fulfill htlcs
instantiateEclairNode("F2", ConfigFactory.parseMap(Map("eclair.node-alias" -> "F2", "eclair.expiry-delta-blocks" -> 136, "eclair.server.port" -> 29736, "eclair.api.port" -> 28086, "eclair.payment-handler" -> "noop")).withFallback(commonConfig))
instantiateEclairNode("F3", ConfigFactory.parseMap(Map("eclair.node-alias" -> "F3", "eclair.expiry-delta-blocks" -> 137, "eclair.server.port" -> 29737, "eclair.api.port" -> 28087, "eclair.payment-handler" -> "noop")).withFallback(commonConfig))
instantiateEclairNode("F4", ConfigFactory.parseMap(Map("eclair.node-alias" -> "F4", "eclair.expiry-delta-blocks" -> 138, "eclair.server.port" -> 29738, "eclair.api.port" -> 28088, "eclair.payment-handler" -> "noop")).withFallback(commonConfig))
instantiateEclairNode("F5", ConfigFactory.parseMap(Map("eclair.node-alias" -> "F5", "eclair.expiry-delta-blocks" -> 139, "eclair.server.port" -> 29739, "eclair.api.port" -> 28089, "eclair.payment-handler" -> "noop")).withFallback(commonConfig))
instantiateEclairNode("F6", ConfigFactory.parseMap(Map("eclair.node-alias" -> "F6", "eclair.expiry-delta-blocks" -> 139, "eclair.server.port" -> 29741, "eclair.api.port" -> 28091, "eclair.local-features" -> "208a")).withFallback(commonConfig))
instantiateEclairNode("F6", ConfigFactory.parseMap(Map("eclair.node-alias" -> "F6", "eclair.expiry-delta-blocks" -> 139, "eclair.server.port" -> 29741, "eclair.api.port" -> 28091, "eclair.global-features" -> "2000")).withFallback(commonConfig))
instantiateEclairNode("G", ConfigFactory.parseMap(Map("eclair.node-alias" -> "G", "eclair.expiry-delta-blocks" -> 140, "eclair.server.port" -> 29740, "eclair.api.port" -> 28090, "eclair.fee-base-msat" -> 1010, "eclair.fee-proportional-millionths" -> 102)).withFallback(commonConfig))

// by default C has a normal payment handler, but this can be overriden in tests
Expand Down

0 comments on commit 58a5da0

Please sign in to comment.