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