-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for push amount with dual funding (#2433)
When using dual funding, both sides may push an initial amount to the remote side. This is done with an experimental tlv that can be added to `open_channel2` and `accept_channel2`.
- Loading branch information
Showing
31 changed files
with
289 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ import fr.acinq.eclair.crypto.keymanager.ChannelKeyManager | |
import fr.acinq.eclair.transactions.Transactions | ||
import fr.acinq.eclair.transactions.Transactions.TxOwner | ||
import fr.acinq.eclair.wire.protocol._ | ||
import fr.acinq.eclair.{Logs, MilliSatoshiLong, UInt64, randomKey} | ||
import fr.acinq.eclair.{Logs, MilliSatoshi, UInt64, randomKey} | ||
import scodec.bits.ByteVector | ||
|
||
import scala.concurrent.{ExecutionContext, Future} | ||
|
@@ -197,6 +197,8 @@ object InteractiveTxBuilder { | |
def apply(remoteNodeId: PublicKey, | ||
fundingParams: InteractiveTxParams, | ||
keyManager: ChannelKeyManager, | ||
localPushAmount: MilliSatoshi, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
t-bast
Author
Member
|
||
remotePushAmount: MilliSatoshi, | ||
localParams: LocalParams, | ||
remoteParams: RemoteParams, | ||
commitTxFeerate: FeeratePerKw, | ||
|
@@ -213,7 +215,7 @@ object InteractiveTxBuilder { | |
Behaviors.withMdc(Logs.mdc(remoteNodeId_opt = Some(remoteNodeId), channelId_opt = Some(fundingParams.channelId))) { | ||
Behaviors.receiveMessagePartial { | ||
case Start(replyTo, previousTransactions) => | ||
val actor = new InteractiveTxBuilder(replyTo, fundingParams, keyManager, localParams, remoteParams, commitTxFeerate, remoteFirstPerCommitmentPoint, channelFlags, channelConfig, channelFeatures, wallet, previousTransactions, stash, context) | ||
val actor = new InteractiveTxBuilder(replyTo, fundingParams, keyManager, localPushAmount, remotePushAmount, localParams, remoteParams, commitTxFeerate, remoteFirstPerCommitmentPoint, channelFlags, channelConfig, channelFeatures, wallet, previousTransactions, stash, context) | ||
actor.start() | ||
case Abort => Behaviors.stopped | ||
} | ||
|
@@ -263,6 +265,8 @@ object InteractiveTxBuilder { | |
private class InteractiveTxBuilder(replyTo: ActorRef[InteractiveTxBuilder.Response], | ||
fundingParams: InteractiveTxBuilder.InteractiveTxParams, | ||
keyManager: ChannelKeyManager, | ||
localPushAmount: MilliSatoshi, | ||
remotePushAmount: MilliSatoshi, | ||
localParams: LocalParams, | ||
remoteParams: RemoteParams, | ||
commitTxFeerate: FeeratePerKw, | ||
|
@@ -701,7 +705,7 @@ private class InteractiveTxBuilder(replyTo: ActorRef[InteractiveTxBuilder.Respon | |
|
||
def signCommitTx(completeTx: SharedTransaction, fundingOutputIndex: Int): Behavior[Command] = { | ||
val fundingTx = completeTx.buildUnsignedTx() | ||
Funding.makeFirstCommitTxs(keyManager, channelConfig, channelFeatures, fundingParams.channelId, localParams, remoteParams, fundingParams.localAmount, fundingParams.remoteAmount, 0 msat, commitTxFeerate, fundingTx.hash, fundingOutputIndex, remoteFirstPerCommitmentPoint) match { | ||
Funding.makeFirstCommitTxs(keyManager, channelConfig, channelFeatures, fundingParams.channelId, localParams, remoteParams, fundingParams.localAmount, fundingParams.remoteAmount, localPushAmount, remotePushAmount, commitTxFeerate, fundingTx.hash, fundingOutputIndex, remoteFirstPerCommitmentPoint) match { | ||
case Left(cause) => | ||
replyTo ! RemoteFailure(cause) | ||
unlockAndStop(completeTx) | ||
|
Oops, something went wrong.
@t-bast Shouldn't those have been put in
InteractiveTxParams
?