sweep: Remove publishing last-tx logic.

We remove the publishing of the last published sweep tx during the
startup of the sweeper. This republishing can lead to situations
where funds of the default wallet might be locked for neutrino
backend clients.
Moreover all related tests are removed as well.
This commit is contained in:
ziggie
2023-08-09 14:14:08 +02:00
parent c6a68d193c
commit 07502a8fb0
5 changed files with 0 additions and 169 deletions

View File

@@ -404,16 +404,6 @@ func TestSuccess(t *testing.T) {
}
ctx.finish(1)
// Assert that last tx is stored in the database so we can republish
// on restart.
lastTx, err := ctx.store.GetLastPublishedTx()
if err != nil {
t.Fatal(err)
}
if lastTx == nil || sweepTx.TxHash() != lastTx.TxHash() {
t.Fatalf("last tx not stored")
}
}
// TestDust asserts that inputs that are not big enough to raise above the dust
@@ -780,9 +770,6 @@ func TestRestart(t *testing.T) {
// Restart sweeper.
ctx.restartSweeper()
// Expect last tx to be republished.
ctx.receiveTx()
// Simulate other subsystem (e.g. contract resolver) re-offering inputs.
spendChan1, err := ctx.sweeper.SweepInput(input1, defaultFeePref)
if err != nil {
@@ -830,9 +817,6 @@ func TestRestart(t *testing.T) {
// Restart sweeper again. No action is expected.
ctx.restartSweeper()
// Expect last tx to be republished.
ctx.receiveTx()
ctx.finish(1)
}
@@ -861,9 +845,6 @@ func TestRestartRemoteSpend(t *testing.T) {
// Restart sweeper.
ctx.restartSweeper()
// Expect last tx to be republished.
ctx.receiveTx()
// Replace the sweep tx with a remote tx spending input 1.
ctx.backend.deleteUnconfirmed(sweepTx.TxHash())
@@ -918,9 +899,6 @@ func TestRestartConfirmed(t *testing.T) {
// Restart sweeper.
ctx.restartSweeper()
// Expect last tx to be republished.
ctx.receiveTx()
// Mine the sweep tx.
ctx.backend.mine()
@@ -939,35 +917,6 @@ func TestRestartConfirmed(t *testing.T) {
ctx.finish(1)
}
// TestRestartRepublish asserts that sweeper republishes the last published
// tx on restart.
func TestRestartRepublish(t *testing.T) {
ctx := createSweeperTestContext(t)
_, err := ctx.sweeper.SweepInput(spendableInputs[0], defaultFeePref)
if err != nil {
t.Fatal(err)
}
ctx.tick()
sweepTx := ctx.receiveTx()
// Restart sweeper again. No action is expected.
ctx.restartSweeper()
republishedTx := ctx.receiveTx()
if sweepTx.TxHash() != republishedTx.TxHash() {
t.Fatalf("last tx not republished")
}
// Mine the tx to conclude the test properly.
ctx.backend.mine()
ctx.finish(1)
}
// TestRetry tests the sweeper retry flow.
func TestRetry(t *testing.T) {
ctx := createSweeperTestContext(t)