mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-02 19:44:03 +02:00
watchtower/wtclient/backup_task: make sweep pkscript independent of session
This commit changes when the sweep pkscript is assigned in the construction of the justice transaction. Currently, the sweep pkscript is assigned when the task is bound to a session. However, we will moving to an assignment where a unique sweep pkscript is used per channel to prevent address inflation. Hence, this commit makes the sweep pkscript a state dependent variable, since it can be known at the time the channel id is assigned.
This commit is contained in:
@ -397,7 +397,7 @@ func TestBackupTask(t *testing.T) {
|
||||
|
||||
func testBackupTask(t *testing.T, test backupTaskTest) {
|
||||
// Create a new backupTask from the channel id and breach info.
|
||||
task := newBackupTask(&test.chanID, test.breachInfo)
|
||||
task := newBackupTask(&test.chanID, test.breachInfo, test.expSweepScript)
|
||||
|
||||
// Assert that all parameters set during initialization are properly
|
||||
// populated.
|
||||
@ -452,7 +452,7 @@ func testBackupTask(t *testing.T, test backupTaskTest) {
|
||||
// Now, bind the session to the task. If successful, this locks in the
|
||||
// session's negotiated parameters and allows the backup task to derive
|
||||
// the final free variables in the justice transaction.
|
||||
err := task.bindSession(test.session, test.expSweepScript)
|
||||
err := task.bindSession(test.session)
|
||||
if err != test.bindErr {
|
||||
t.Fatalf("expected: %v when binding session, got: %v",
|
||||
test.bindErr, err)
|
||||
@ -509,9 +509,7 @@ func testBackupTask(t *testing.T, test backupTaskTest) {
|
||||
|
||||
// Now, we'll construct, sign, and encrypt the blob containing the parts
|
||||
// needed to reconstruct the justice transaction.
|
||||
hint, encBlob, err := task.craftSessionPayload(
|
||||
test.expSweepScript, test.signer,
|
||||
)
|
||||
hint, encBlob, err := task.craftSessionPayload(test.signer)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to craft session payload: %v", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user