sweep: add a dedicated method to create sweeping txns

This takes the old `createSweepTx` and refactors it to be
sweep-specific. A sweeping txns differs from a normal tx as it doesn't
need to take outputs as params.
This commit is contained in:
yyforyongyu committed 2024-04-19 21:33:32 +08:00
1 parent 59fbcb18d5
commit 59526988cf
4 files changed
+269 -7

No files matched your search

+11 -1
View File
@@ -1169,7 +1169,11 @@ func TestHandleTxConfirmed(t *testing.T) {
//
// NOTE: must be called in a goroutine in case it blocks.
tp.wg.Add(1)
go tp.handleTxConfirmed(record, requestID)
done := make(chan struct{})
go func() {
tp.handleTxConfirmed(record, requestID)
close(done)
}()
select {
case <-time.After(time.Second):
@@ -1185,6 +1189,12 @@ func TestHandleTxConfirmed(t *testing.T) {
require.Equal(t, feerate, result.FeeRate)
}
select {
case <-done:
case <-time.After(time.Second):
t.Fatal("timeout waiting for handleTxConfirmed to return")
}
// We expect the record to be removed from the maps.
_, found := tp.records.Load(requestID)
require.False(t, found)