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:
3 files changed
+35
-14
No files matched your search
@@ -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