mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2026-02-19 13:34:25 +01: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:
@@ -8,6 +8,7 @@ import (
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
@@ -204,6 +205,21 @@ type ContractReport struct {
|
||||
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
|
||||
// transaction.
|
||||
type htlcSet struct {
|
||||
|
||||
Reference in New Issue
Block a user