lnd/htlcswitch
Olaoluwa Osuntokun 01c64712a3
multi: ensure link is always torn down due to db failures, add exponential back off for sql-kvdb failures (#7927)
* lnwallet: fix log output msg

The log message is off by one.

* htlcswitch: fail channel when revoking it fails.

When the revocation of a channel state fails after receiving a new
CommitmentSigned msg we have to fail the channel otherwise we
continue with an unclean state.

* docs: update release-docs

* htlcswitch: tear down connection if revocation processing fails

If we couldn't revoke due to a DB error, then we want to also tear down
the connection, as we don't want the other party to continue to send
updates. That may lead to de-sync'd state an eventual force close.
Otherwise, the database might be able to recover come the next
reconnection attempt.

* kvdb: use sql.LevelSerializable for all backends

In this commit, we modify the default isolation level to be
`sql.LevelSerializable. This is the strictness isolation type for
postgres. For sqlite, there's only ever a single writer, so this doesn't
apply directly.

* kvdb/sqlbase: add randomized exponential backoff for serialization failures

In this commit, we add randomized exponential backoff for serialization
failures. For postgres, we''ll his this any time a transaction set fails
to be linearized. For sqlite, we'll his this if we have many writers
trying to grab the write lock at time same time, manifesting as a
`SQLITE_BUSY` error code.

As is, we'll retry up to 10 times, waiting a minimum of 50 miliseconds
between each attempt, up to 5 seconds without any delay at all. For
sqlite, this is also bounded by the busy timeout set, which applies on
top of this retry logic (block for busy timeout seconds, then apply this
back off logic).

* docs/release-notes: add entry for sqlite/postgres tx retry

---------

Co-authored-by: ziggie <ziggie1984@protonmail.com>
2023-08-30 16:48:00 -07:00
..
hodl multi: add golang 1.17 compatible build tags 2021-09-29 17:31:37 -07:00
hop multi: update to tlv/v1.1.0 and use new *P2P tlv decoding variants 2022-12-05 09:32:56 -05:00
testdata multi: update linter, fix new issues 2023-06-13 11:58:33 +02:00
circuit_map_test.go htlcswitch+lntest: modify Switch to persist resolution messages 2022-04-29 16:40:19 -04:00
circuit_map.go htlcswitch: improve loggings for Keystone 2023-01-12 22:08:02 +08:00
circuit_test.go htlcswitch: clean up test resources and temporary files 2022-10-10 10:32:39 -07:00
circuit.go multi: create channeldb/models package 2023-01-16 07:14:55 -08:00
decayedlog_test.go htlcswitch: use T.TempDir to create temporary test directory 2022-08-24 09:03:01 +08:00
decayedlog.go htlcswitch: fix duplicate close 2022-01-10 08:42:32 +01:00
failure_detail.go htlcswitch: add linkError field to htlcpacket 2020-02-06 19:43:29 +02:00
failure_test.go multi: update linter, fix new issues 2023-06-13 11:58:33 +02:00
failure.go htlcswitch: add linkError field to htlcpacket 2020-02-06 19:43:29 +02:00
held_htlc_set_test.go multi: create channeldb/models package 2023-01-16 07:14:55 -08:00
held_htlc_set.go multi: create channeldb/models package 2023-01-16 07:14:55 -08:00
htlcnotifier.go multi: create channeldb/models package 2023-01-16 07:14:55 -08:00
interceptable_switch.go multi: create channeldb/models package 2023-01-16 07:14:55 -08:00
interfaces.go multi: use fwding policy from models pkg 2023-08-22 06:22:33 +08:00
link_isolated_test.go lnwallet+htlcswitch: add NewCommitState struct, modify send/recv sig to accept 2023-08-22 16:31:18 -07:00
link_test.go funding+peer: add support for new musig2 channel funding flow 2023-08-22 16:32:07 -07:00
link.go multi: ensure link is always torn down due to db failures, add exponential back off for sql-kvdb failures (#7927) 2023-08-30 16:48:00 -07:00
linkfailure.go multi: ensure link is always torn down due to db failures, add exponential back off for sql-kvdb failures (#7927) 2023-08-30 16:48:00 -07:00
log.go htlcswitch/hop: fix logging 2019-09-09 13:52:35 +02:00
mailbox_test.go htlcswitch: use mock clock in TestMailBoxAddExpiry 2023-01-12 22:08:15 +08:00
mailbox.go htlcswitch: TODO for obviating type assertions 2023-07-31 09:52:33 -05:00
mock.go funding+peer: add support for new musig2 channel funding flow 2023-08-22 16:32:07 -07:00
packet.go server+htlcswitch: prevent privacy leaks, allow alias routing 2022-07-07 17:10:28 -04:00
payment_result_test.go htlcswitch: clean up test resources and temporary files 2022-10-10 10:32:39 -07:00
payment_result.go multimutex: remove HashMutex, make Mutex type a type param 2023-06-01 17:39:49 -07:00
resolution_store_test.go htlcswitch: use T.TempDir to create temporary test directory 2022-08-24 09:03:01 +08:00
resolution_store.go htlcswitch: introduce resolutionStore to persist cnct messages 2022-04-29 16:40:16 -04:00
sequencer.go kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
switch_test.go multi: update "funding locked" comments 2023-04-27 20:02:34 +02:00
switch.go multi: use fwding policy from models pkg 2023-08-22 06:22:33 +08:00
test_utils.go input+wallet: extract musig2 session management into new module 2023-08-22 16:30:39 -07:00