mirror of
https://github.com/ACINQ/eclair.git
synced 2025-02-21 14:04:10 +01:00
Remove old compatibility workaround for eclair mobile (#1625)
This commit is contained in:
parent
8d6af35086
commit
4e567053ab
3 changed files with 1 additions and 33 deletions
|
@ -91,23 +91,6 @@ case class Features(activated: Set[ActivatedFeature], unknown: Set[UnknownFeatur
|
|||
buf.reverse.bytes
|
||||
}
|
||||
|
||||
/**
|
||||
* Eclair-mobile thinks feature bit 15 (payment_secret) is gossip_queries_ex which creates issues, so we mask
|
||||
* off basic_mpp and payment_secret. As long as they're provided in the invoice it's not an issue.
|
||||
* We use a long enough mask to account for future features.
|
||||
* TODO: remove that once eclair-mobile is patched.
|
||||
*/
|
||||
def maskFeaturesForEclairMobile(): Features = {
|
||||
Features(
|
||||
activated = activated.filter {
|
||||
case ActivatedFeature(PaymentSecret, _) => false
|
||||
case ActivatedFeature(BasicMultiPartPayment, _) => false
|
||||
case _ => true
|
||||
},
|
||||
unknown = unknown
|
||||
)
|
||||
}
|
||||
|
||||
override def toString: String = {
|
||||
val a = activated.map(f => f.feature.rfcName + ":" + f.support).mkString(",")
|
||||
val u = unknown.map(_.bitIndex).mkString(",")
|
||||
|
|
|
@ -72,7 +72,7 @@ class Switchboard(nodeParams: NodeParams, watcher: ActorRef, relayer: ActorRef,
|
|||
case authenticated: PeerConnection.Authenticated =>
|
||||
// if this is an incoming connection, we might not yet have created the peer
|
||||
val peer = createOrGetPeer(authenticated.remoteNodeId, offlineChannels = Set.empty)
|
||||
val features = nodeParams.featuresFor(authenticated.remoteNodeId).maskFeaturesForEclairMobile()
|
||||
val features = nodeParams.featuresFor(authenticated.remoteNodeId)
|
||||
val doSync = nodeParams.syncWhitelist.isEmpty || nodeParams.syncWhitelist.contains(authenticated.remoteNodeId)
|
||||
authenticated.peerConnection ! PeerConnection.InitializeConnection(peer, nodeParams.chainHash, features, doSync)
|
||||
|
||||
|
|
|
@ -67,19 +67,4 @@ class SwitchboardSpec extends TestKitBaseClass with AnyFunSuiteLike {
|
|||
sendFeatures(remoteNodeId, Alice.nodeParams.features, Set(randomKey.publicKey, randomKey.publicKey, randomKey.publicKey), Alice.nodeParams.features, expectedSync = false)
|
||||
}
|
||||
|
||||
test("on peer authentication, mask off MPP and PaymentSecret features") {
|
||||
val testCases = Seq(
|
||||
(bin" 00000010", bin" 00000010"), // option_data_loss_protect
|
||||
(bin" 0000101010001010", bin" 0000101010001010"), // option_data_loss_protect, initial_routing_sync, gossip_queries, var_onion_optin, gossip_queries_ex
|
||||
(bin" 1000101010001010", bin" 0000101010001010"), // option_data_loss_protect, initial_routing_sync, gossip_queries, var_onion_optin, gossip_queries_ex, payment_secret
|
||||
(bin" 0100101010001010", bin" 0000101010001010"), // option_data_loss_protect, initial_routing_sync, gossip_queries, var_onion_optin, gossip_queries_ex, payment_secret
|
||||
(bin"000000101000101010001010", bin" 0000101010001010"), // option_data_loss_protect, initial_routing_sync, gossip_queries, var_onion_optin, gossip_queries_ex, payment_secret, basic_mpp
|
||||
(bin"000010101000101010001010", bin"000010000000101010001010") // option_data_loss_protect, initial_routing_sync, gossip_queries, var_onion_optin, gossip_queries_ex, payment_secret, basic_mpp and large_channel_support (optional)
|
||||
)
|
||||
|
||||
for ((configuredFeatures, sentFeatures) <- testCases) {
|
||||
sendFeatures(randomKey.publicKey, Features(configuredFeatures), Set.empty, Features(sentFeatures), expectedSync = true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue