sweep: start tracking inputs spent by unknown tx

This commit adds a new field `InputsSpent` to the `BumpResult` so they
can be used to track inputs spent by txns not recoginized by the fee
bumper.
This commit is contained in:
yyforyongyu
2025-01-24 05:49:19 +08:00
parent 388183e173
commit 2f1205a394
2 changed files with 83 additions and 7 deletions

View File

@@ -1772,6 +1772,13 @@ func TestProcessRecordsSpent(t *testing.T) {
tp.subscriberChans.Store(requestID, subscriber)
tp.records.Store(requestID, recordConfirmed)
// Mock the fee function to increase feerate.
m.feeFunc.On("Increment").Return(true, nil).Once()
// Create a test feerate and return it from the mock fee function.
feerate := chainfee.SatPerKWeight(1000)
m.feeFunc.On("FeeRate").Return(feerate)
// Call processRecords and expect the results are notified back.
tp.processRecords()
@@ -1785,6 +1792,9 @@ func TestProcessRecordsSpent(t *testing.T) {
require.Equal(t, TxUnknownSpend, result.Event)
require.Equal(t, tx, result.Tx)
// We expect the fee rate to be updated.
require.Equal(t, feerate, result.FeeRate)
// No error should be set.
require.ErrorIs(t, result.Err, ErrUnknownSpent)
require.Equal(t, requestID, result.requestID)