mirror of
https://github.com/ACINQ/eclair.git
synced 2025-02-22 22:25:26 +01:00
We were considering all local outputs as splice outputs, but some may be change.
This commit is contained in:
parent
e4103a2a65
commit
db8e0f9ba6
2 changed files with 9 additions and 2 deletions
|
@ -51,6 +51,10 @@ object Monitoring {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is best effort! It is not possible to attribute a type to a splice in all cases. For example, if remote provides
|
||||
* both inputs and outputs, it could be a splice-in (with change), or a combined splice-in + splice-out.
|
||||
*/
|
||||
def recordSplice(fundingParams: InteractiveTxParams, sharedTx: SharedTransaction): Unit = {
|
||||
if (fundingParams.localContribution > 0.sat) {
|
||||
Metrics.Splices.withTag(Tags.Origin, Tags.Origins.Local).withTag(Tags.SpliceType, Tags.SpliceTypes.SpliceIn).record(fundingParams.localContribution.toLong)
|
||||
|
@ -58,8 +62,8 @@ object Monitoring {
|
|||
if (fundingParams.remoteContribution > 0.sat) {
|
||||
Metrics.Splices.withTag(Tags.Origin, Tags.Origins.Remote).withTag(Tags.SpliceType, Tags.SpliceTypes.SpliceIn).record(fundingParams.remoteContribution.toLong)
|
||||
}
|
||||
if (sharedTx.localOutputs.nonEmpty) {
|
||||
Metrics.Splices.withTag(Tags.Origin, Tags.Origins.Local).withTag(Tags.SpliceType, Tags.SpliceTypes.SpliceOut).record(sharedTx.localOutputs.map(_.amount).sum.toLong)
|
||||
if (sharedTx.localOnlyNonChangeOutputs.nonEmpty) {
|
||||
Metrics.Splices.withTag(Tags.Origin, Tags.Origins.Local).withTag(Tags.SpliceType, Tags.SpliceTypes.SpliceOut).record(sharedTx.localOnlyNonChangeOutputs.map(_.amount).sum.toLong)
|
||||
}
|
||||
if (sharedTx.remoteOutputs.nonEmpty) {
|
||||
Metrics.Splices.withTag(Tags.Origin, Tags.Origins.Remote).withTag(Tags.SpliceType, Tags.SpliceTypes.SpliceOut).record(sharedTx.remoteOutputs.map(_.amount).sum.toLong)
|
||||
|
|
|
@ -28,6 +28,7 @@ import fr.acinq.eclair.blockchain.fee.FeeratePerKw
|
|||
import fr.acinq.eclair.channel.Helpers.Closing.MutualClose
|
||||
import fr.acinq.eclair.channel.Helpers.Funding
|
||||
import fr.acinq.eclair.channel._
|
||||
import fr.acinq.eclair.channel.fund.InteractiveTxBuilder.Output.Local
|
||||
import fr.acinq.eclair.channel.fund.InteractiveTxBuilder.Purpose
|
||||
import fr.acinq.eclair.channel.fund.InteractiveTxSigningSession.UnsignedLocalCommit
|
||||
import fr.acinq.eclair.crypto.keymanager.ChannelKeyManager
|
||||
|
@ -290,6 +291,8 @@ object InteractiveTxBuilder {
|
|||
// Note that the truncation is a no-op: sub-satoshi balances are carried over from inputs to outputs and cancel out.
|
||||
val fees: Satoshi = (localFees + remoteFees).truncateToSatoshi
|
||||
|
||||
def localOnlyNonChangeOutputs: List[Output.Local.NonChange] = localOutputs.collect { case o: Local.NonChange => o }
|
||||
|
||||
def buildUnsignedTx(): Transaction = {
|
||||
val sharedTxIn = sharedInput_opt.map(i => (i.serialId, TxIn(i.outPoint, ByteVector.empty, i.sequence))).toSeq
|
||||
val localTxIn = localInputs.map(i => (i.serialId, TxIn(i.outPoint, ByteVector.empty, i.sequence)))
|
||||
|
|
Loading…
Add table
Reference in a new issue