mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-31 17:51:33 +02:00
sweep: make sure nil tx is handled
After previous commit, it should be clear that the tx may be failed to created in a `TxFailed` event. We now make sure to catch it to avoid panic.
This commit is contained in:
@@ -91,13 +91,6 @@ func TestBumpResultValidate(t *testing.T) {
|
||||
}
|
||||
require.ErrorIs(t, b.Validate(), ErrInvalidBumpResult)
|
||||
|
||||
// A failed event without a tx will give an error.
|
||||
b = BumpResult{
|
||||
Event: TxFailed,
|
||||
Err: errDummy,
|
||||
}
|
||||
require.ErrorIs(t, b.Validate(), ErrInvalidBumpResult)
|
||||
|
||||
// A fatal event without a failure reason will give an error.
|
||||
b = BumpResult{
|
||||
Event: TxFailed,
|
||||
@@ -118,6 +111,13 @@ func TestBumpResultValidate(t *testing.T) {
|
||||
}
|
||||
require.NoError(t, b.Validate())
|
||||
|
||||
// Tx is allowed to be nil in a TxFailed event.
|
||||
b = BumpResult{
|
||||
Event: TxFailed,
|
||||
Err: errDummy,
|
||||
}
|
||||
require.NoError(t, b.Validate())
|
||||
|
||||
// Tx is allowed to be nil in a TxFatal event.
|
||||
b = BumpResult{
|
||||
Event: TxFatal,
|
||||
|
Reference in New Issue
Block a user