-
Notifications
You must be signed in to change notification settings - Fork 276
Add metrics to interactive-tx funding #2997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ import fr.acinq.eclair.blockchain.OnChainChannelFunder | |
| 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.Monitoring.Metrics | ||
| import fr.acinq.eclair.channel._ | ||
| import fr.acinq.eclair.channel.fund.InteractiveTxBuilder.Output.Local | ||
| import fr.acinq.eclair.channel.fund.InteractiveTxBuilder.Purpose | ||
|
|
@@ -884,6 +885,10 @@ private class InteractiveTxBuilder(replyTo: ActorRef[InteractiveTxBuilder.Respon | |
| incomingHtlcCount = purpose.remoteNextHtlcId, | ||
| ) | ||
| context.system.eventStream ! EventStream.Publish(ChannelLiquidityPurchased(replyTo.toClassic, channelParams.channelId, remoteNodeId, purchase)) | ||
| // Liquidity requestor will pay the mining fee for the raw splice tx with a negative funding contribution, on top of that we add the mining fee for our inputs bring liquidity | ||
| val userMiningFee = -fundingParams.remoteContribution + p.fees.miningFee | ||
| log.info("funding fee check: serviceFee={} userMiningFee={} actualMiningFee={}", p.fees.serviceFee, userMiningFee, signedTx.tx.fees) | ||
| Metrics.recordInteractiveTxMiningFeeDiff(userMiningFee, signedTx.tx.fees) | ||
|
Comment on lines
+888
to
+891
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that's incorrect? We should compute this by doing |
||
| } | ||
| val signingSession = InteractiveTxSigningSession.WaitingForSigs( | ||
| fundingParams, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ import fr.acinq.bitcoin.scalacompat.Crypto.PublicKey | |
| import fr.acinq.bitcoin.scalacompat.{KotlinUtils, OutPoint, Satoshi, SatoshiLong, Script, ScriptWitness, Transaction, TxIn, TxOut} | ||
| import fr.acinq.eclair.blockchain.OnChainChannelFunder | ||
| import fr.acinq.eclair.blockchain.fee.FeeratePerKw | ||
| import fr.acinq.eclair.channel.Monitoring.Metrics | ||
| import fr.acinq.eclair.channel.fund.InteractiveTxBuilder._ | ||
| import fr.acinq.eclair.transactions.Transactions | ||
| import fr.acinq.eclair.wire.protocol.TxAddInput | ||
|
|
@@ -239,7 +240,12 @@ private class InteractiveTxFunder(replyTo: ActorRef[InteractiveTxFunder.Response | |
| } | ||
| context.pipeToSelf(wallet.fundTransaction(txNotFunded, fundingParams.targetFeerate, replaceable = true, externalInputsWeight = sharedInputWeight, feeBudget_opt = feeBudget_opt)) { | ||
| case Failure(t) => WalletFailure(t) | ||
| case Success(result) => FundTransactionResult(result.tx, result.changePosition) | ||
| case Success(result) => | ||
| Metrics.recordInteractiveTxFunding( | ||
| targetAmount = fundingParams.localContribution, | ||
| inputsCount = result.tx.txIn.size - txNotFunded.txIn.size, | ||
| change = result.changePosition.map(i => result.tx.txOut(i).amount).sum) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this is the right place for this metric: since we have a mechanism to filter inputs below and retry calling I think this should be done in |
||
| FundTransactionResult(result.tx, result.changePosition) | ||
| } | ||
| Behaviors.receiveMessagePartial { | ||
| case FundTransactionResult(fundedTx, changePosition) => | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is confusing: it's very specific to liquidity ads but without knowing this beforehand, it's really hard to figure out from the code. More generally, I think we should also add liquidity ads metrics in this PR:
That's where it would make sense to have this metric, which should be renamed
LiquidityAdsMiningFeeRefund. TheuserMiningFeeparameter from this function should be renamedrefundedMiningFeeIMO.