mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-27 01:02:56 +02:00
contractcourt: add resolver report function to ContractReport
Our current set of reports contain much of the information we will need to persist contract resolutions. We add a function to create resolver reports from our exiting set of resolutions.
This commit is contained in:
parent
fa46db9c48
commit
0a01d5d17c
@ -8,6 +8,7 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
@ -204,6 +205,21 @@ type ContractReport struct {
|
|||||||
RecoveredBalance btcutil.Amount
|
RecoveredBalance btcutil.Amount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// resolverReport creates a resolve report using some of the information in the
|
||||||
|
// contract report.
|
||||||
|
func (c *ContractReport) resolverReport(spendTx *chainhash.Hash,
|
||||||
|
resolverType channeldb.ResolverType,
|
||||||
|
outcome channeldb.ResolverOutcome) *channeldb.ResolverReport {
|
||||||
|
|
||||||
|
return &channeldb.ResolverReport{
|
||||||
|
OutPoint: c.Outpoint,
|
||||||
|
Amount: c.Amount,
|
||||||
|
ResolverType: resolverType,
|
||||||
|
ResolverOutcome: outcome,
|
||||||
|
SpendTxID: spendTx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// htlcSet represents the set of active HTLCs on a given commitment
|
// htlcSet represents the set of active HTLCs on a given commitment
|
||||||
// transaction.
|
// transaction.
|
||||||
type htlcSet struct {
|
type htlcSet struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user