mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-08 05:08:13 +02:00
multi: remove breach tx arg from NewBreachRetribution args
This commit removes the breach transaction from the arguments passed to NewBreachRetribution. We already keep all prior remote commitments on disk in the commitment log, and load that transaction from disk inside the method. In practice, the one loaded from disk will be the same one that is passed in by the caller, so there should be no change in behavior as we've already derived the appropriate state number. This changes makes integration with the watchtower client simpler, since we no longer need to acquire the breaching commitment transaction to be able to construct the BreachRetribution. This simplifies not only the logic surrounding transient backsups, but also on startup (and later, retroactively backing up historic updates).
This commit is contained in:
@@ -725,18 +725,14 @@ func (c *chainWatcher) dispatchContractBreach(spendEvent *chainntnfs.SpendDetail
|
||||
return fmt.Errorf("unable to mark channel as borked: %v", err)
|
||||
}
|
||||
|
||||
var (
|
||||
commitTxBroadcast = spendEvent.SpendingTx
|
||||
spendHeight = uint32(spendEvent.SpendingHeight)
|
||||
)
|
||||
spendHeight := uint32(spendEvent.SpendingHeight)
|
||||
|
||||
// Create a new reach retribution struct which contains all the data
|
||||
// needed to swiftly bring the cheating peer to justice.
|
||||
//
|
||||
// TODO(roasbeef): move to same package
|
||||
retribution, err := lnwallet.NewBreachRetribution(
|
||||
c.cfg.chanState, broadcastStateNum, commitTxBroadcast,
|
||||
spendHeight,
|
||||
c.cfg.chanState, broadcastStateNum, spendHeight,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to create breach retribution: %v", err)
|
||||
|
Reference in New Issue
Block a user