@@ -44,7 +44,6 @@ func NewBabylonController(
44
44
btcParams * chaincfg.Params ,
45
45
logger * zap.Logger ,
46
46
) (* BabylonController , error ) {
47
-
48
47
bbnConfig := config .BBNConfigToBabylonConfig (cfg )
49
48
50
49
if err := bbnConfig .Validate (); err != nil {
@@ -70,6 +69,7 @@ func NewBabylonController(
70
69
func (bc * BabylonController ) mustGetTxSigner () string {
71
70
signer := bc .GetKeyAddress ()
72
71
prefix := bc .cfg .AccountPrefix
72
+
73
73
return sdk .MustBech32ifyAddressBytes (prefix , signer )
74
74
}
75
75
@@ -98,13 +98,13 @@ func (bc *BabylonController) QueryStakingParamsByVersion(version uint32) (*types
98
98
// query btc checkpoint params
99
99
ckptParamRes , err := bc .bbnClient .QueryClient .BTCCheckpointParams ()
100
100
if err != nil {
101
- return nil , fmt .Errorf ("failed to query params of the btccheckpoint module: %v " , err )
101
+ return nil , fmt .Errorf ("failed to query params of the btccheckpoint module: %w " , err )
102
102
}
103
103
104
104
// query btc staking params
105
105
stakingParamRes , err := bc .bbnClient .QueryClient .BTCStakingParamsByVersion (version )
106
106
if err != nil {
107
- return nil , fmt .Errorf ("failed to query staking params with version %d: %v " , version , err )
107
+ return nil , fmt .Errorf ("failed to query staking params with version %d: %w " , version , err )
108
108
}
109
109
110
110
covenantPks := make ([]* btcec.PublicKey , 0 , len (stakingParamRes .Params .CovenantPks ))
@@ -210,8 +210,9 @@ func (bc *BabylonController) QueryVerifiedDelegations(limit uint64) ([]*types.De
210
210
func (bc * BabylonController ) QueryBTCDelegation (stakingTxHashHex string ) (* types.Delegation , error ) {
211
211
resp , err := bc .bbnClient .QueryClient .BTCDelegation (stakingTxHashHex )
212
212
if err != nil {
213
- return nil , fmt .Errorf ("failed to query BTC delegation %s: %v " , stakingTxHashHex , err )
213
+ return nil , fmt .Errorf ("failed to query BTC delegation %s: %w " , stakingTxHashHex , err )
214
214
}
215
+
215
216
return DelegationRespToDelegation (resp .BtcDelegation )
216
217
}
217
218
@@ -230,7 +231,7 @@ func (bc *BabylonController) queryDelegationsWithStatus(status btcstakingtypes.B
230
231
for indexDels < delsLimit {
231
232
res , err := bc .bbnClient .QueryClient .BTCDelegations (status , pagination )
232
233
if err != nil {
233
- return nil , fmt .Errorf ("failed to query BTC delegations: %v " , err )
234
+ return nil , fmt .Errorf ("failed to query BTC delegations: %w " , err )
234
235
}
235
236
236
237
for _ , delResp := range res .BtcDelegations {
@@ -271,6 +272,7 @@ func (bc *BabylonController) queryDelegationsWithStatus(status btcstakingtypes.B
271
272
272
273
func getContextWithCancel (timeout time.Duration ) (context.Context , context.CancelFunc ) {
273
274
ctx , cancel := context .WithTimeout (context .Background (), timeout )
275
+
274
276
return ctx , cancel
275
277
}
276
278
@@ -557,7 +559,7 @@ func (bc *BabylonController) QueryFinalityProviders() ([]*btcstakingtypes.Finali
557
559
}
558
560
res , err := queryClient .FinalityProviders (ctx , queryRequest )
559
561
if err != nil {
560
- return nil , fmt .Errorf ("failed to query finality providers: %v " , err )
562
+ return nil , fmt .Errorf ("failed to query finality providers: %w " , err )
561
563
}
562
564
fps = append (fps , res .FinalityProviders ... )
563
565
if res .Pagination == nil || res .Pagination .NextKey == nil {
@@ -582,7 +584,7 @@ func (bc *BabylonController) QueryBtcLightClientTip() (*btclctypes.BTCHeaderInfo
582
584
queryRequest := & btclctypes.QueryTipRequest {}
583
585
res , err := queryClient .Tip (ctx , queryRequest )
584
586
if err != nil {
585
- return nil , fmt .Errorf ("failed to query BTC tip: %v " , err )
587
+ return nil , fmt .Errorf ("failed to query BTC tip: %w " , err )
586
588
}
587
589
588
590
return res .Header , nil
0 commit comments