Skip to content

Commit 5a771cc

Browse files
committed
fix
1 parent 690381f commit 5a771cc

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

harness/finalityprovider.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,16 @@ func (fpi *FinalityProviderInstance) register(
199199
Pop: pop,
200200
}
201201

202-
if err := fpi.client.SendMsgs(ctx, []sdk.Msg{msgNewVal}); err != nil {
203-
return err
202+
for i := 0; i < 3; i++ {
203+
if err := fpi.client.SendMsgs(ctx, []sdk.Msg{msgNewVal}); err != nil {
204+
if i == 2 { // Last attempt
205+
return fmt.Errorf("failed to register finality provider after 3 attempts: %w", err)
206+
}
207+
fmt.Printf("🔄 Finality provider registration attempt %d failed, retrying in 2s: %v\n", i+1, err)
208+
time.Sleep(2 * time.Second)
209+
continue
210+
}
211+
break // Success
204212
}
205213

206214
return nil

harness/headergenerator.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,18 @@ func (s *BTCHeaderGenerator) CatchUpBTCLightClient(ctx context.Context) error {
2929
return err
3030
}
3131

32+
var btclcHeight uint32
3233
tipResp, err := s.client.BTCHeaderChainTip()
3334
if err != nil {
34-
return err
35+
fmt.Printf("🧱 BTC light client not ready yet, will sync incrementally: %v\n", err)
36+
return nil
37+
}
38+
btclcHeight = tipResp.Header.Height
39+
40+
if btclcHeight >= uint32(btcHeight) {
41+
fmt.Printf("🧱 BTC light client already up to date (LC: %d, BTC: %d)\n", btclcHeight, btcHeight)
42+
return nil
3543
}
36-
btclcHeight := tipResp.Header.Height
3744

3845
headers := make([]*wire.BlockHeader, 0, btcHeight)
3946
for i := int(btclcHeight + 1); i <= int(btcHeight); i++ {
@@ -102,7 +109,8 @@ func (g *BTCHeaderGenerator) genBlocks(ctx context.Context) error {
102109

103110
tipResp, err := g.client.BTCHeaderChainTip()
104111
if err != nil {
105-
return err
112+
fmt.Printf("🚫 Failed to get BTC light client tip: %v\n", err)
113+
return nil // Don't fail the entire process, just skip this iteration
106114
}
107115
btclcHeight := tipResp.Header.Height
108116

0 commit comments

Comments
 (0)