watchtower/wtclient/backup_task: bind to ClientSession instead of SessionInfo

This commit is contained in:
Conner Fromknecht committed 2019-03-15 02:30:59 -07:00
1 parent b1903451d9
commit 4642954e72
2 files changed
+16 -15

No files matched your search

+8 -7
View File
@@ -34,9 +34,8 @@ import (
// necessary components are stripped out and encrypted before being sent to
// the tower in a StateUpdate.
type backupTask struct {
chanID lnwire.ChannelID
commitHeight uint64
breachInfo *lnwallet.BreachRetribution
id wtdb.BackupID
breachInfo *lnwallet.BreachRetribution
// state-dependent variables
@@ -96,8 +95,10 @@ func newBackupTask(chanID *lnwire.ChannelID,
}
return &backupTask{
chanID: *chanID,
commitHeight: breachInfo.RevokedStateNum,
id: wtdb.BackupID{
ChanID: *chanID,
CommitHeight: breachInfo.RevokedStateNum,
},
breachInfo: breachInfo,
toLocalInput: toLocalInput,
toRemoteInput: toRemoteInput,
@@ -125,7 +126,7 @@ func (t *backupTask) inputs() map[wire.OutPoint]input.Input {
// SessionInfo's policy. If no error is returned, the task has been bound to the
// session and can be queued to upload to the tower. Otherwise, the bind failed
// and should be rescheduled with a different session.
func (t *backupTask) bindSession(session *wtdb.SessionInfo) error {
func (t *backupTask) bindSession(session *wtdb.ClientSession) error {
// First we'll begin by deriving a weight estimate for the justice
// transaction. The final weight can be different depending on whether
@@ -154,7 +155,7 @@ func (t *backupTask) bindSession(session *wtdb.SessionInfo) error {
// in the current session's policy.
outputs, err := session.Policy.ComputeJusticeTxOuts(
t.totalAmt, int64(weightEstimate.Weight()),
t.sweepPkScript, session.RewardAddress,
t.sweepPkScript, session.RewardPkScript,
)
if err != nil {
return err