@@ -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 ]]]]
@@ -228,17 +230,18 @@ class EclairImpl(appKit: Kit) extends Eclair with Logging {
228
230
}
229
231
230
232
override def rbfOpen (channelId : ByteVector32 , targetFeerate : FeeratePerKw , fundingFeeBudget : Satoshi , lockTime_opt : Option [Long ])(implicit timeout : Timeout ): Future [CommandResponse [CMD_BUMP_FUNDING_FEE ]] = {
231
- sendToChannelTyped(channel = Left (channelId),
232
- cmdBuilder = CMD_BUMP_FUNDING_FEE (_, targetFeerate, fundingFeeBudget, lockTime_opt.getOrElse(appKit.nodeParams.currentBlockHeight.toLong), requestFunding_opt = None ))
233
+ sendToChannelTyped(
234
+ channel = Left (channelId),
235
+ cmdBuilder = CMD_BUMP_FUNDING_FEE (_, targetFeerate, fundingFeeBudget, lockTime_opt.getOrElse(appKit.nodeParams.currentBlockHeight.toLong), requestFunding_opt = None )
236
+ )
233
237
}
234
238
235
239
override def spliceIn (channelId : ByteVector32 , amountIn : Satoshi , pushAmount_opt : Option [MilliSatoshi ])(implicit timeout : Timeout ): Future [CommandResponse [CMD_SPLICE ]] = {
236
- sendToChannelTyped(channel = Left (channelId),
237
- cmdBuilder = CMD_SPLICE (_,
238
- spliceIn_opt = Some (SpliceIn (additionalLocalFunding = amountIn, pushAmount = pushAmount_opt.getOrElse(0 .msat))),
239
- spliceOut_opt = None ,
240
- requestFunding_opt = None ,
241
- ))
240
+ val spliceIn = SpliceIn (additionalLocalFunding = amountIn, pushAmount = pushAmount_opt.getOrElse(0 .msat))
241
+ sendToChannelTyped(
242
+ channel = Left (channelId),
243
+ cmdBuilder = CMD_SPLICE (_, spliceIn_opt = Some (spliceIn), spliceOut_opt = None , requestFunding_opt = None )
244
+ )
242
245
}
243
246
244
247
override def spliceOut (channelId : ByteVector32 , amountOut : Satoshi , scriptOrAddress : Either [ByteVector , String ])(implicit timeout : Timeout ): Future [CommandResponse [CMD_SPLICE ]] = {
@@ -249,12 +252,18 @@ class EclairImpl(appKit: Kit) extends Eclair with Logging {
249
252
case Right (script) => Script .write(script)
250
253
}
251
254
}
252
- sendToChannelTyped(channel = Left (channelId),
253
- cmdBuilder = CMD_SPLICE (_,
254
- spliceIn_opt = None ,
255
- spliceOut_opt = Some (SpliceOut (amount = amountOut, scriptPubKey = script)),
256
- requestFunding_opt = None ,
257
- ))
255
+ val spliceOut = SpliceOut (amount = amountOut, scriptPubKey = script)
256
+ sendToChannelTyped(
257
+ channel = Left (channelId),
258
+ cmdBuilder = CMD_SPLICE (_, spliceIn_opt = None , spliceOut_opt = Some (spliceOut), requestFunding_opt = None )
259
+ )
260
+ }
261
+
262
+ override def rbfSplice (channelId : ByteVector32 , targetFeerate : FeeratePerKw , fundingFeeBudget : Satoshi , lockTime_opt : Option [Long ])(implicit timeout : Timeout ): Future [CommandResponse [CMD_BUMP_FUNDING_FEE ]] = {
263
+ sendToChannelTyped(
264
+ channel = Left (channelId),
265
+ cmdBuilder = CMD_BUMP_FUNDING_FEE (_, targetFeerate, fundingFeeBudget, lockTime_opt.getOrElse(appKit.nodeParams.currentBlockHeight.toLong), requestFunding_opt = None )
266
+ )
258
267
}
259
268
260
269
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 ]]]] = {
@@ -575,9 +584,9 @@ class EclairImpl(appKit: Kit) extends Eclair with Logging {
575
584
case Left (channelId) => appKit.register ? Register .Forward (null , channelId, request)
576
585
case Right (shortChannelId) => appKit.register ? Register .ForwardShortId (null , shortChannelId, request)
577
586
}).map {
578
- case t : R @ unchecked => t
579
- case t : Register .ForwardFailure [C ]@ unchecked => throw ChannelNotFound (Left (t.fwd.channelId))
580
- case t : Register .ForwardShortIdFailure [C ]@ unchecked => throw ChannelNotFound (Right (t.fwd.shortChannelId))
587
+ case t : R @ unchecked => t
588
+ case t : Register .ForwardFailure [C ] @ unchecked => throw ChannelNotFound (Left (t.fwd.channelId))
589
+ case t : Register .ForwardShortIdFailure [C ] @ unchecked => throw ChannelNotFound (Right (t.fwd.shortChannelId))
581
590
}
582
591
583
592
private def sendToChannelTyped [C <: Command , R <: CommandResponse [C ]](channel : ApiTypes .ChannelIdentifier , cmdBuilder : akka.actor.typed.ActorRef [Any ] => C )(implicit timeout : Timeout ): Future [R ] =
@@ -588,9 +597,9 @@ class EclairImpl(appKit: Kit) extends Eclair with Logging {
588
597
case Right (shortChannelId) => Register .ForwardShortId (replyTo, shortChannelId, cmd)
589
598
}
590
599
}.map {
591
- case t : R @ unchecked => t
592
- case t : Register .ForwardFailure [C ]@ unchecked => throw ChannelNotFound (Left (t.fwd.channelId))
593
- case t : Register .ForwardShortIdFailure [C ]@ unchecked => throw ChannelNotFound (Right (t.fwd.shortChannelId))
600
+ case t : R @ unchecked => t
601
+ case t : Register .ForwardFailure [C ] @ unchecked => throw ChannelNotFound (Left (t.fwd.channelId))
602
+ case t : Register .ForwardShortIdFailure [C ] @ unchecked => throw ChannelNotFound (Right (t.fwd.shortChannelId))
594
603
}
595
604
596
605
/**
0 commit comments