standardsats / plugin-fiat-channels

Eclair plugin implementing Fiat hosted channels RFC
Apache License 2.0
4 stars 3 forks source link

fc-invoke causes ConcurrentModificationException #10

Open Filiprogrammer opened 2 months ago

Filiprogrammer commented 2 months ago

I am running two eclair v0.7.0-patch-disconnect nodes on regtest. Both of the nodes are running plugin-fiat-channels. Opening a fiat-channel with the fc-invoke command from one node to another fails with a ConcurrentModificationException.

eclair-cli -p <password> -a 127.0.0.1:8080 fc-invoke --nodeId=<remote node id also running plugin-fiat-channels> --refundAddress=bcrt1q4qcu7f7qduej5nq5wm75xg5qhg554wvqyldk67 --secret=9834567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef --ticker=USD

2024-04-13 00:52:12,062 INFO  f.a.e.i.Peer n:02cf55705088b5739d3555988fb28bfa2ce7a04a4fc8b0eb88e6ccb89e49249280 - IN msg=UnknownMessage(55535,ByteVector(95 bytes, 0x06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f00160014
a831cf27c06f332a4c1476fd432280ba294ab98000209834567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef0003555344))
2024-04-13 00:52:12,065 INFO  f.a.e.i.Peer n:02cf55705088b5739d3555988fb28bfa2ce7a04a4fc8b0eb88e6ccb89e49249280 - OUT msg=UnknownMessage(55533,ByteVector(53 bytes, 0x00000002540be4000000000000001388000a00000002540be4000000000000000000000
000000016d5ab00035553440002ceecceee))                                                                                 
2024-04-13 00:52:12,069 INFO  f.a.e.i.Peer n:02cf55705088b5739d3555988fb28bfa2ce7a04a4fc8b0eb88e6ccb89e49249280 - IN msg=UnknownMessage(55529,ByteVector(84 bytes, 0x000000000000000000000000000000000016d5abee77417f06c0127bbbe56af48abf5904
69b4ebd23a4293c156e8882a5f2603350cc083cd208d25bbda5539355de8753b58434253a1efe2862026c98c8307dab3))                    
2024-04-13 00:52:12,072 INFO  f.a.f.a.c.HostedChannel - PLGN FC, database error when trying to store new HC, peer=02cf55705088b5739d3555988fb28bfa2ce7a04a4fc8b0eb88e6ccb89e49249280
2024-04-13 00:52:12,072 INFO  f.a.e.i.Peer n:02cf55705088b5739d3555988fb28bfa2ce7a04a4fc8b0eb88e6ccb89e49249280 - OUT msg=UnknownMessage(53497,ByteVector(38 bytes, 0x2ebf3fda275ffd2b39e651544556ef887e7e5ee316ae3a2d798840436aae64cd0004303
03037))                                                    
2024-04-13 00:52:12,072 ERROR a.a.OneForOneStrategy - nulljava.util.ConcurrentModificationException: null
        at com.google.common.collect.HashBiMap$View$1.checkForComodification(HashBiMap.java:678)
        at com.google.common.collect.HashBiMap$View$1.hasNext(HashBiMap.java:684)
        at java.base/java.util.Map.forEach(Map.java:703)
        at fr.acinq.fc.app.Worker$$anonfun$receive$1.applyOrElse(Worker.scala:147)
        at akka.actor.Actor.aroundReceive(Actor.scala:537)
        at akka.actor.Actor.aroundReceive$(Actor.scala:535) 
        at fr.acinq.fc.app.Worker.aroundReceive(Worker.scala:43)
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:580)
        at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1(DeathWatch.scala:79)
        at akka.actor.dungeon.DeathWatch.$anonfun$receivedTerminated$1$adapted(DeathWatch.scala:70)
        at scala.Option.foreach(Option.scala:437)
        at akka.actor.dungeon.DeathWatch.receivedTerminated(DeathWatch.scala:70)
        at akka.actor.dungeon.DeathWatch.receivedTerminated$(DeathWatch.scala:69)
        at akka.actor.ActorCell.receivedTerminated(ActorCell.scala:411)
        at akka.actor.ActorCell.autoReceiveMessage(ActorCell.scala:563)
        at akka.actor.ActorCell.invoke(ActorCell.scala:546) 
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270)
        at akka.dispatch.Mailbox.run(Mailbox.scala:231)
        at akka.dispatch.Mailbox.exec(Mailbox.scala:243)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)

2024-04-13 00:52:12,074 INFO  fr.acinq.fc.app.Worker - PLGN PHC, in-memory NodeIds, hot=, client=
2024-04-13 00:52:12,075 INFO  fr.acinq.fc.app.Worker - PLGN PHC, all HCs have the same NodeId which matches current NodeId=true
evd0kim commented 2 months ago

The public-hosted channel feature has not been tested with fiat channels. It has no sense and should probably be removed.

Filiprogrammer commented 2 months ago

According to the API reference the hosted channel is private by default.

evd0kim commented 2 months ago

No, this whole functionality is mainly required for opening PHC. However, fc-invoke should work. The bug may be due to additional required parameters that weren't provided by the command. Fiat channels plugin is experimental and may lack critical functions that exist in original HC plugin.