-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reapply 8644 on 9260 #9313
Closed
aakselrod
wants to merge
169
commits into
lightningnetwork:yy-beat-itest-optimize
from
aakselrod:reapply-8644-on-9260
Closed
Reapply 8644 on 9260 #9313
Changes from all commits
Commits
Show all changes
169 commits
Select commit
Hold shift + click to select a range
001a789
sweep: add new state `TxFatal` for erroneous sweepings
yyforyongyu bdd97d7
sweep: add new error `ErrZeroFeeRateDelta`
yyforyongyu e295cd1
sweep: add new interface method `Immediate`
yyforyongyu fadcf9c
sweep: handle inputs locally instead of relying on the tx
yyforyongyu 027ac83
sweep: add `handleInitialBroadcast` to handle initial broadcast
yyforyongyu 05d0033
sweep: remove redundant error from `Broadcast`
yyforyongyu 7da0eb0
sweep: add method `handleBumpEventError` and fix `markInputFailed`
yyforyongyu 4e04844
sweep: add method `isMature` on `SweeperInput`
yyforyongyu 038a8c0
sweep: make sure defaultDeadline is derived from the mature height
yyforyongyu be5f15f
sweep: remove redundant loopvar assign
yyforyongyu d0d8d4c
sweep: break `initialBroadcast` into two steps
yyforyongyu 6b891a9
sweep: make sure nil tx is handled
yyforyongyu a2d0748
chainio: introduce `chainio` to handle block synchronization
yyforyongyu 8cf0c3d
chainio: implement `Blockbeat`
yyforyongyu 2683dd9
chainio: add helper methods to dispatch beats
yyforyongyu 7bc96e8
chainio: add `BlockbeatDispatcher` to dispatch blockbeats
yyforyongyu f648d3c
chainio: add partial implementation of `Consumer` interface
yyforyongyu d034718
multi: implement `Consumer` on subsystems
yyforyongyu 5274a6e
sweep: remove block subscription in `UtxoSweeper` and `TxPublisher`
yyforyongyu 7512a93
sweep: remove redundant notifications during shutdown
yyforyongyu 472eccb
contractcourt: remove `waitForHeight` in resolvers
yyforyongyu 3a1d1a5
contractcourt: remove block subscription in chain arbitrator
yyforyongyu e72c993
contractcourt: remove block subscription in channel arbitrator
yyforyongyu 1230f57
contractcourt: remove the `immediate` param used in `Resolve`
yyforyongyu 7ac658a
contractcourt: start channel arbitrator with blockbeat
yyforyongyu 6c9bdb2
multi: start consumers with a starting blockbeat
yyforyongyu 06cab5e
lnd: add new method `startLowLevelServices`
yyforyongyu ebbe0d5
lnd: start `blockbeatDispatcher` and register consumers
yyforyongyu 8f3928f
contractcourt: fix linter `funlen`
yyforyongyu ff6b9cf
multi: improve loggings
yyforyongyu 437595d
chainio: use `errgroup` to limit num of goroutines
yyforyongyu 1643508
chainio: update `fn` to `v2`
yyforyongyu 82d77bb
contractcourt: add verbose logging in resolvers
yyforyongyu 3cb48a0
contractcourt: add spend path helpers in timeout/success resolver
yyforyongyu 10d9544
contractcourt: add sweep senders in `htlcSuccessResolver`
yyforyongyu 693287f
contractcourt: add resolver handlers in `htlcSuccessResolver`
yyforyongyu fe29961
contractcourt: remove redundant return value in `claimCleanUp`
yyforyongyu 7e0623c
contractcourt: add sweep senders in `htlcTimeoutResolver`
yyforyongyu 066d351
contractcourt: add methods to checkpoint states
yyforyongyu c108487
contractcourt: add resolve handlers in `htlcTimeoutResolver`
yyforyongyu d78fd7a
contractcourt: add `Launch` method to anchor/breach resolver
yyforyongyu 629c037
contractcourt: add `Launch` method to commit resolver
yyforyongyu 406f443
contractcourt: add `Launch` method to htlc success resolver
yyforyongyu dcf7144
contractcourt: add `Launch` method to htlc timeout resolver
yyforyongyu dfaff63
invoices: exit early when the subscriber chan is nil
yyforyongyu fe4ab4e
contractcourt: add `Launch` method to incoming contest resolver
yyforyongyu dbfe5df
contractcourt: add `Launch` method to outgoing contest resolver
yyforyongyu 1c8cbc8
contractcourt: fix concurrent access to `resolved`
yyforyongyu b6c4dd9
contractcourt: fix concurrent access to `launched`
yyforyongyu b3cec2c
contractcourt: break `launchResolvers` into two steps
yyforyongyu 7751b1b
contractcourt: offer outgoing htlc one block earlier before its expiry
yyforyongyu cea8758
contractcourt: implement `Consumer` on `chainWatcher`
yyforyongyu d1fc5c5
contractcourt: register spend notification during init
yyforyongyu fdbec4c
contractcourt: add method `handleCommitSpend`
yyforyongyu 8436960
contractcourt: handle blockbeat in `chainWatcher`
yyforyongyu 5e59b80
contractcourt: notify blockbeat for `chainWatcher`
yyforyongyu 9b90376
contractcourt: use close height instead of best height
yyforyongyu eec5a59
multi: add new method `ChainArbitrator.RedispatchBlockbeat`
yyforyongyu e5bdf00
contractcourt: add close event handlers in `ChannelArbitrator`
yyforyongyu 3568385
contractcourt: process channel close event on new beat
yyforyongyu e4e67db
contractcourt: register conf notification once and cancel when confirmed
yyforyongyu 304eea2
chainntnfs: skip dispatched conf details
yyforyongyu 0882921
docs: add release notes for `blockbeat` series
yyforyongyu f949dac
multi: optimize loggings around changes from `blockbeat`
yyforyongyu 335a962
lntest+itest: fix `testSweepCPFPAnchorOutgoingTimeout`
yyforyongyu cd4b497
itest: fix `testSweepCPFPAnchorIncomingTimeout`
yyforyongyu 31d7e8e
itest: fix `testSweepHTLCs`
yyforyongyu 5fc9a58
itest: fix `testSweepCommitOutputAndAnchor`
yyforyongyu 1d95d83
itest: fix `testBumpForceCloseFee`
yyforyongyu d358333
itest: fix `testPaymentSucceededHTLCRemoteSwept`
yyforyongyu aa784ce
lntest+itest: start flattening the multi-hop tests
yyforyongyu 7a5e595
itest: simplify and flatten `testMultiHopReceiverChainClaim`
yyforyongyu 50a51b7
lntest+itest: flatten `testMultiHopLocalForceCloseOnChainHtlcTimeout`
yyforyongyu 1c7cfdb
lntest+itest: flatten `testMultiHopRemoteForceCloseOnChainHtlcTimeout`
yyforyongyu 0d5f5c8
itest: flatten `testMultiHopHtlcLocalChainClaim`
yyforyongyu c5a1731
itest: flatten `testMultiHopHtlcRemoteChainClaim`
yyforyongyu ea6ee91
itest: flatten `testMultiHopHtlcAggregation`
yyforyongyu 8715438
itest: flatten `testHtlcTimeoutResolverExtractPreimageLocal`
yyforyongyu 860715a
itest: flatten `testHtlcTimeoutResolverExtractPreimageRemote`
yyforyongyu b985434
itest: rename file to reflect the tests
yyforyongyu 0310594
itest: remove unnecessary force close
yyforyongyu 001dedd
itest: remove redundant block mining in `testFailingChannel`
yyforyongyu aafd4cc
itest: remove redunant block mining in `testChannelFundingWithUnstabl…
yyforyongyu f08cf62
itest: remove redudant block in `testPsbtChanFundingWithUnstableUtxos`
yyforyongyu 75b8e43
itest: remove redundant blocks in channel backup tests
yyforyongyu 552bbcc
itest+lntest: fix channel force close test
yyforyongyu 4c73eec
itest: flatten and fix `testWatchtower`
yyforyongyu 1eb150d
itest: remove redundant block in multiple tests
yyforyongyu 931ec34
itest: assert payment status after sending
yyforyongyu c6ed7aa
lntest+itest: remove the usage of `ht.AssertActiveHtlcs`
yyforyongyu dbd5657
htlcswitch: handle nil circuit properly when settling
yyforyongyu 96256d8
routing: fix nil pointer dereference in `exitWithErr`
yyforyongyu e5ed4c9
lnwallet: add debug logs
yyforyongyu ac63ed0
itest: print num of blocks for debugging
yyforyongyu 2ba9622
itest: shuffle test cases to even out blocks mined in tranches
yyforyongyu 13db8fa
workflows: pass action ID as the shuffle seed
yyforyongyu 723b3c5
itest: remove direct reference to stanby nodes
yyforyongyu a3ef2aa
itest: remove the use of standby nodes
yyforyongyu 3f3bdee
itest: remove unused method `setupFourHopNetwork`
yyforyongyu ea359a9
itest+lntest: remove standby nodes
yyforyongyu 8b547dc
itest: remove unnecessary channel close and node shutdown
yyforyongyu 49cddf8
lntest: make sure node is properly shut down
yyforyongyu fabc5c2
lntest: add human-readble names and check num of nodes
yyforyongyu 50d61fc
itest: fix `testOpenChannelUpdateFeePolicy`
yyforyongyu d03a8b2
itest: fix flake in `testSendDirectPayment`
yyforyongyu 3640d1d
itest: fix spawning temp miner
yyforyongyu 56a1623
itest: fix flake for neutrino backend
yyforyongyu ba56598
itest: flatten PSBT funding test cases
yyforyongyu 75142d3
itest: fix and document flake in sweeping tests
yyforyongyu 90bb09a
itest: remove loop in `wsTestCaseBiDirectionalSubscription`
yyforyongyu 87b68ae
itest: fix flake in `testRevokedCloseRetributionZeroValueRemoteOutput`
yyforyongyu 8f69fb1
itest: fix flake in `testSwitchOfflineDelivery`
yyforyongyu 2e30d9e
itest+routing: fix flake in `runFeeEstimationTestCase`
yyforyongyu 79cfae2
itest: use `ht.CreateSimpleNetwork` whenever applicable
yyforyongyu 555c5be
itest: put mpp tests in one file
yyforyongyu 53513cc
lntest+itest: remove `AssertNumActiveEdges`
yyforyongyu cc45999
itest: fix flake in runPsbtChanFundingWithNodes
yyforyongyu d700d7c
itest: fix flake in `testPrivateUpdateAlias`
yyforyongyu 284fe91
itest: fix flake in `update_pending_open_channels`
yyforyongyu 2ad1a4a
lntest: increase `rpcmaxwebsockets` for `btcd`
yyforyongyu 7ebf527
itest: document details about MPP-related tests
yyforyongyu ca689f1
itest+lntest: fix flake in MPP-related tests
yyforyongyu e9b5227
lntest: fix flakeness in `openChannelsForNodes`
yyforyongyu 565f95d
itest: document a rare flake found in `macOS`
yyforyongyu 598f2a0
itest: document a flake found in `SendToRoute`
yyforyongyu 8baa1a3
itest: optimize blocks mined in `testGarbageCollectLinkNodes`
yyforyongyu 8f4e260
itest: break remote signer into independent cases
yyforyongyu 6d1c3c2
itest: break down channel restore commit types cases
yyforyongyu a9dbd36
itest: break down utxo selection funding tests
yyforyongyu 6f26186
itest: break all multihop test cases
yyforyongyu 428829a
itest: break down scid alias channel update tests
yyforyongyu c8e6d74
itest: break down open channel fee policy
yyforyongyu 41ae04c
itest: break down payment failed tests
yyforyongyu b69e214
itest: break down channel backup restore tests
yyforyongyu c82610c
itest: break down wallet import account tests
yyforyongyu 6bef51d
itest: break down basic funding flow tests
yyforyongyu f42b108
itest: break down single hop send to route
yyforyongyu 80895be
itest: break down taproot tests
yyforyongyu c0ffd29
itest: break down channel fundmax tests
yyforyongyu 93765f2
itest: breakdown `testSendDirectPayment`
yyforyongyu b3f99c3
itest: further reduce block mined in tests
yyforyongyu 5326b1b
itest: track and skip flaky tests for windows
yyforyongyu fc7f282
lntest: increase node start timeout and payment benchmark timeout
yyforyongyu 5aec1ff
lntest: make sure policies are populated in `AssertChannelInGraph`
yyforyongyu 9aea852
workflows: use `btcd` for macOS
yyforyongyu 9a819b8
itest+lntest: add new method `FundNumCoins`
yyforyongyu ef54c92
lntest: limit the num of blocks mined in each test
yyforyongyu 72b0985
docs: update release notes
yyforyongyu b0a1f90
itest: add a prefix before appending a subtest case
yyforyongyu 0ac77d5
itest: even out num of tests per tranche
yyforyongyu 90e84c8
lntest: increase port timeout
yyforyongyu e39ba4d
lntest: add timeouts for windows
yyforyongyu 0a0ab90
lntest: properly handle shutdown error
yyforyongyu 2088e36
workflows: increase num of tranches to 16
yyforyongyu e31c412
lntest: make sure chain backend is synced to miner
yyforyongyu e1407ff
itest: document and fix wallet UTXO flake
yyforyongyu cc89b32
itest: fix flake in `testCoopCloseWithExternalDeliveryImpl`
yyforyongyu 26611ea
go.mod: update btcwallet to latest to eliminate waddrmgr deadlock
aakselrod 6af70e4
go.mod: use local kvdb to reapply removal of global postgres lock
aakselrod 5a55c25
Reapply "kvdb/postgres: remove global application level lock"
aakselrod 82a04f0
log: add sub-logger for kvdb/sqlbase
aakselrod 26564c2
itest: fix flake in multi-hop payments
aakselrod 42afb51
batch: handle serialization errors correctly
aakselrod fa545f1
graph/db: handle previously-unhandled errors
aakselrod feafcc0
sqldb: improve serialization error handling
aakselrod 7f1a72b
Makefile: tune params for db-instance for postgres itests
aakselrod 819bc24
Makefile: log to file instead of console
aakselrod db4bf51
github workflow: save postgres log to zip file
aakselrod 175711a
docs: update release-notes for 0.19.0
aakselrod File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package batch | ||
|
||
import ( | ||
"errors" | ||
"path/filepath" | ||
"sync" | ||
"testing" | ||
"time" | ||
|
||
"github.com/btcsuite/btcwallet/walletdb" | ||
"github.com/lightningnetwork/lnd/kvdb" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestRetry(t *testing.T) { | ||
dbDir := t.TempDir() | ||
|
||
dbName := filepath.Join(dbDir, "weks.db") | ||
db, err := walletdb.Create( | ||
"bdb", dbName, true, kvdb.DefaultDBTimeout, | ||
) | ||
if err != nil { | ||
t.Fatalf("unable to create walletdb: %v", err) | ||
} | ||
t.Cleanup(func() { | ||
db.Close() | ||
}) | ||
|
||
var ( | ||
mu sync.Mutex | ||
called int | ||
) | ||
sched := NewTimeScheduler(db, &mu, time.Second) | ||
|
||
// First, we construct a request that should retry individually and | ||
// execute it non-lazily. It should still return the error the second | ||
// time. | ||
req := &Request{ | ||
Update: func(tx kvdb.RwTx) error { | ||
called++ | ||
|
||
return errors.New("test") | ||
}, | ||
} | ||
err = sched.Execute(req) | ||
|
||
// Check and reset the called counter. | ||
mu.Lock() | ||
require.Equal(t, 2, called) | ||
called = 0 | ||
mu.Unlock() | ||
|
||
require.ErrorContains(t, err, "test") | ||
|
||
// Now, we construct a request that should NOT retry because it returns | ||
// a serialization error, which should cause the underlying postgres | ||
// transaction to retry. Since we aren't using postgres, this will | ||
// cause the transaction to not be retried at all. | ||
req = &Request{ | ||
Update: func(tx kvdb.RwTx) error { | ||
called++ | ||
|
||
return errors.New("could not serialize access") | ||
}, | ||
} | ||
err = sched.Execute(req) | ||
|
||
// Check the called counter. | ||
mu.Lock() | ||
require.Equal(t, 1, called) | ||
mu.Unlock() | ||
|
||
require.ErrorContains(t, err, "could not serialize access") | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It'd be nice to cover batch with a simple unit test to make sure the serialization errors are correctly handled and we don't regress later.