Skip to content

Commit 57da71b

Browse files
authored
Merge pull request #1705 from lightninglabs/itest-fixes
itest: fix flakes
2 parents 2e3a2b2 + b28f9ee commit 57da71b

File tree

3 files changed

+50
-8
lines changed

3 files changed

+50
-8
lines changed

authmailbox/receive_subscription.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,15 @@ func (s *receiveSubscription) connectAndAuthenticate(ctx context.Context,
106106

107107
err := s.connectServerStream(ctx, initialBackoff, reconnectRetries)
108108
if err != nil {
109+
if errors.Is(err, ErrClientShutdown) {
110+
log.DebugS(ctx, "Client is shutting down, not "+
111+
"connecting to server stream")
112+
113+
// Allow the main server to identify this as the request
114+
// being canceled by the client. Which will cause the
115+
// error not to be treated as a fatal error.
116+
return context.Canceled
117+
}
109118
return fmt.Errorf("connecting server stream failed: %w", err)
110119
}
111120

itest/supply_commit_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ func testSupplyCommitIgnoreAsset(t *harnessTest) {
155155

156156
t.Log("Minting asset group with a single normal asset and " +
157157
"universe/supply commitments enabled")
158-
mintReq := issuableAssets[0]
158+
mintReq := CopyRequest(issuableAssets[0])
159159
mintReq.Asset.EnableSupplyCommitments = true
160160
rpcAssets := MintAssetsConfirmBatch(
161161
t.t, t.lndHarness.Miner().Client, t.tapd,

proof/archive.go

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -879,21 +879,54 @@ func (m *MultiArchiver) FetchIssuanceProof(ctx context.Context,
879879
// intended to be a performance optimized lookup compared to fetching a proof
880880
// and checking for ErrProofNotFound. The multi archiver only considers a proof
881881
// to be present if all backends have it.
882-
func (m *MultiArchiver) HasProof(ctx context.Context, id Locator) (bool, error) {
882+
func (m *MultiArchiver) HasProof(ctx context.Context,
883+
id Locator) (bool, error) {
884+
885+
var (
886+
someHaveProof = false
887+
allHaveProof = true
888+
)
883889
for _, archive := range m.backends {
884890
ok, err := archive.HasProof(ctx, id)
885891
if err != nil {
886892
return false, err
887893
}
888894

889-
// We are expecting all backends to have the proof, otherwise we
890-
// consider the proof not to be found.
891-
if !ok {
892-
return false, nil
893-
}
895+
someHaveProof = someHaveProof || ok
896+
allHaveProof = allHaveProof && ok
897+
}
898+
899+
// If all backends have the proof, then we don't need to do anything
900+
// further and can return that result.
901+
if allHaveProof {
902+
return true, nil
894903
}
895904

896-
return true, nil
905+
// If no backends have the proof, then this is just a proof we don't
906+
// know about, which is fine too.
907+
if !someHaveProof {
908+
return false, nil
909+
}
910+
911+
// If only some but not all backends have the proof, it's possible that
912+
// the other ones are in the process of importing it right now. So we
913+
// re-try a couple of times to see if the proof becomes available
914+
// eventually.
915+
return fn.RetryFuncN(
916+
ctx, fn.DefaultRetryConfig(), func() (bool, error) {
917+
allHaveProof = true
918+
for _, archive := range m.backends {
919+
ok, err := archive.HasProof(ctx, id)
920+
if err != nil {
921+
return false, err
922+
}
923+
924+
allHaveProof = allHaveProof && ok
925+
}
926+
927+
return allHaveProof, nil
928+
},
929+
)
897930
}
898931

899932
// FetchProofs fetches all proofs for assets uniquely identified by the passed

0 commit comments

Comments
 (0)