@@ -94,6 +94,8 @@ trait Eclair {
94
94
95
95
def spliceOut (channelId : ByteVector32 , amountOut : Satoshi , scriptOrAddress : Either [ByteVector , String ])(implicit timeout : Timeout ): Future [CommandResponse [CMD_SPLICE ]]
96
96
97
+ def rbfSplice (channelId : ByteVector32 , targetFeerate : FeeratePerKw , fundingFeeBudget : Satoshi , lockTime_opt : Option [Long ])(implicit timeout : Timeout ): Future [CommandResponse [CMD_BUMP_FUNDING_FEE ]]
98
+
97
99
def close (channels : List [ApiTypes .ChannelIdentifier ], scriptPubKey_opt : Option [ByteVector ], closingFeerates_opt : Option [ClosingFeerates ])(implicit timeout : Timeout ): Future [Map [ApiTypes .ChannelIdentifier , Either [Throwable , CommandResponse [CMD_CLOSE ]]]]
98
100
99
101
def forceClose (channels : List [ApiTypes .ChannelIdentifier ])(implicit timeout : Timeout ): Future [Map [ApiTypes .ChannelIdentifier , Either [Throwable , CommandResponse [CMD_FORCECLOSE ]]]]
@@ -227,16 +229,18 @@ class EclairImpl(appKit: Kit) extends Eclair with Logging {
227
229
}
228
230
229
231
override def rbfOpen (channelId : ByteVector32 , targetFeerate : FeeratePerKw , fundingFeeBudget : Satoshi , lockTime_opt : Option [Long ])(implicit timeout : Timeout ): Future [CommandResponse [CMD_BUMP_FUNDING_FEE ]] = {
230
- sendToChannelTyped(channel = Left (channelId),
231
- cmdBuilder = CMD_BUMP_FUNDING_FEE (_, targetFeerate, fundingFeeBudget, lockTime_opt.getOrElse(appKit.nodeParams.currentBlockHeight.toLong)))
232
+ sendToChannelTyped(
233
+ channel = Left (channelId),
234
+ cmdBuilder = CMD_BUMP_FUNDING_FEE (_, targetFeerate, fundingFeeBudget, lockTime_opt.getOrElse(appKit.nodeParams.currentBlockHeight.toLong))
235
+ )
232
236
}
233
237
234
238
override def spliceIn (channelId : ByteVector32 , amountIn : Satoshi , pushAmount_opt : Option [MilliSatoshi ])(implicit timeout : Timeout ): Future [CommandResponse [CMD_SPLICE ]] = {
235
- sendToChannelTyped(channel = Left (channelId),
236
- cmdBuilder = CMD_SPLICE (_,
237
- spliceIn_opt = Some ( SpliceIn (additionalLocalFunding = amountIn, pushAmount = pushAmount_opt.getOrElse( 0 .msat)) ),
238
- spliceOut_opt = None
239
- ) )
239
+ val spliceIn = SpliceIn (additionalLocalFunding = amountIn, pushAmount = pushAmount_opt.getOrElse( 0 .msat))
240
+ sendToChannelTyped(
241
+ channel = Left (channelId ),
242
+ cmdBuilder = CMD_SPLICE (_, spliceIn_opt = Some (spliceIn), spliceOut_opt = None )
243
+ )
240
244
}
241
245
242
246
override def spliceOut (channelId : ByteVector32 , amountOut : Satoshi , scriptOrAddress : Either [ByteVector , String ])(implicit timeout : Timeout ): Future [CommandResponse [CMD_SPLICE ]] = {
@@ -247,11 +251,18 @@ class EclairImpl(appKit: Kit) extends Eclair with Logging {
247
251
case Right (script) => Script .write(script)
248
252
}
249
253
}
250
- sendToChannelTyped(channel = Left (channelId),
251
- cmdBuilder = CMD_SPLICE (_,
252
- spliceIn_opt = None ,
253
- spliceOut_opt = Some (SpliceOut (amount = amountOut, scriptPubKey = script))
254
- ))
254
+ val spliceOut = SpliceOut (amount = amountOut, scriptPubKey = script)
255
+ sendToChannelTyped(
256
+ channel = Left (channelId),
257
+ cmdBuilder = CMD_SPLICE (_, spliceIn_opt = None , spliceOut_opt = Some (spliceOut))
258
+ )
259
+ }
260
+
261
+ override def rbfSplice (channelId : ByteVector32 , targetFeerate : FeeratePerKw , fundingFeeBudget : Satoshi , lockTime_opt : Option [Long ])(implicit timeout : Timeout ): Future [CommandResponse [CMD_BUMP_FUNDING_FEE ]] = {
262
+ sendToChannelTyped(
263
+ channel = Left (channelId),
264
+ cmdBuilder = CMD_BUMP_FUNDING_FEE (_, targetFeerate, fundingFeeBudget, lockTime_opt.getOrElse(appKit.nodeParams.currentBlockHeight.toLong))
265
+ )
255
266
}
256
267
257
268
override def close (channels : List [ApiTypes .ChannelIdentifier ], scriptPubKey_opt : Option [ByteVector ], closingFeerates_opt : Option [ClosingFeerates ])(implicit timeout : Timeout ): Future [Map [ApiTypes .ChannelIdentifier , Either [Throwable , CommandResponse [CMD_CLOSE ]]]] = {
@@ -558,9 +569,9 @@ class EclairImpl(appKit: Kit) extends Eclair with Logging {
558
569
case Left (channelId) => appKit.register ? Register .Forward (null , channelId, request)
559
570
case Right (shortChannelId) => appKit.register ? Register .ForwardShortId (null , shortChannelId, request)
560
571
}).map {
561
- case t : R @ unchecked => t
562
- case t : Register .ForwardFailure [C ]@ unchecked => throw ChannelNotFound (Left (t.fwd.channelId))
563
- case t : Register .ForwardShortIdFailure [C ]@ unchecked => throw ChannelNotFound (Right (t.fwd.shortChannelId))
572
+ case t : R @ unchecked => t
573
+ case t : Register .ForwardFailure [C ] @ unchecked => throw ChannelNotFound (Left (t.fwd.channelId))
574
+ case t : Register .ForwardShortIdFailure [C ] @ unchecked => throw ChannelNotFound (Right (t.fwd.shortChannelId))
564
575
}
565
576
566
577
private def sendToChannelTyped [C <: Command , R <: CommandResponse [C ]](channel : ApiTypes .ChannelIdentifier , cmdBuilder : akka.actor.typed.ActorRef [Any ] => C )(implicit timeout : Timeout ): Future [R ] =
@@ -571,9 +582,9 @@ class EclairImpl(appKit: Kit) extends Eclair with Logging {
571
582
case Right (shortChannelId) => Register .ForwardShortId (replyTo, shortChannelId, cmd)
572
583
}
573
584
}.map {
574
- case t : R @ unchecked => t
575
- case t : Register .ForwardFailure [C ]@ unchecked => throw ChannelNotFound (Left (t.fwd.channelId))
576
- case t : Register .ForwardShortIdFailure [C ]@ unchecked => throw ChannelNotFound (Right (t.fwd.shortChannelId))
585
+ case t : R @ unchecked => t
586
+ case t : Register .ForwardFailure [C ] @ unchecked => throw ChannelNotFound (Left (t.fwd.channelId))
587
+ case t : Register .ForwardShortIdFailure [C ] @ unchecked => throw ChannelNotFound (Right (t.fwd.shortChannelId))
577
588
}
578
589
579
590
/**
0 commit comments