mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
cnct: add resolver report output type
This commit prepares for the commit sweep resolver to report on its state.
This commit is contained in:
parent
7e472c9e8c
commit
1597a92160
@ -129,13 +129,27 @@ type ChannelArbitratorConfig struct {
|
||||
ChainArbitratorConfig
|
||||
}
|
||||
|
||||
// ReportOutputType describes the type of output that is being reported
|
||||
// on.
|
||||
type ReportOutputType uint8
|
||||
|
||||
const (
|
||||
// ReportOutputIncomingHtlc is an incoming hash time locked contract on
|
||||
// the commitment tx.
|
||||
ReportOutputIncomingHtlc ReportOutputType = iota
|
||||
|
||||
// ReportOutputOutgoingHtlc is an outgoing hash time locked contract on
|
||||
// the commitment tx.
|
||||
ReportOutputOutgoingHtlc
|
||||
)
|
||||
|
||||
// ContractReport provides a summary of a commitment tx output.
|
||||
type ContractReport struct {
|
||||
// Outpoint is the final output that will be swept back to the wallet.
|
||||
Outpoint wire.OutPoint
|
||||
|
||||
// Incoming indicates whether the htlc was incoming to this channel.
|
||||
Incoming bool
|
||||
// Type indicates the type of the reported output.
|
||||
Type ReportOutputType
|
||||
|
||||
// Amount is the final value that will be swept in back to the wallet.
|
||||
Amount btcutil.Amount
|
||||
|
@ -293,7 +293,7 @@ func (h *htlcIncomingContestResolver) report() *ContractReport {
|
||||
|
||||
return &ContractReport{
|
||||
Outpoint: h.htlcResolution.ClaimOutpoint,
|
||||
Incoming: true,
|
||||
Type: ReportOutputIncomingHtlc,
|
||||
Amount: finalAmt,
|
||||
MaturityHeight: h.htlcExpiry,
|
||||
LimboBalance: finalAmt,
|
||||
|
@ -166,7 +166,7 @@ func (h *htlcOutgoingContestResolver) report() *ContractReport {
|
||||
|
||||
return &ContractReport{
|
||||
Outpoint: h.htlcResolution.ClaimOutpoint,
|
||||
Incoming: false,
|
||||
Type: ReportOutputOutgoingHtlc,
|
||||
Amount: finalAmt,
|
||||
MaturityHeight: h.htlcResolution.Expiry,
|
||||
LimboBalance: finalAmt,
|
||||
|
@ -34,6 +34,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/chanbackup"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/channelnotifier"
|
||||
"github.com/lightningnetwork/lnd/contractcourt"
|
||||
"github.com/lightningnetwork/lnd/discovery"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
@ -2451,8 +2452,10 @@ func (r *rpcServer) arbitratorPopulateForceCloseResp(chanPoint *wire.OutPoint,
|
||||
reports := arbitrator.Report()
|
||||
|
||||
for _, report := range reports {
|
||||
incoming := report.Type == contractcourt.ReportOutputIncomingHtlc
|
||||
|
||||
htlc := &lnrpc.PendingHTLC{
|
||||
Incoming: report.Incoming,
|
||||
Incoming: incoming,
|
||||
Amount: int64(report.Amount),
|
||||
Outpoint: report.Outpoint.String(),
|
||||
MaturityHeight: report.MaturityHeight,
|
||||
|
Loading…
Reference in New Issue
Block a user