@@ -18,7 +18,6 @@ import (
18
18
"encoding/hex"
19
19
"encoding/json"
20
20
"errors"
21
- "fmt"
22
21
"io"
23
22
"math/big"
24
23
"os"
@@ -235,47 +234,40 @@ func (g *ShelleyGenesis) GenesisUtxos() ([]common.Utxo, error) {
235
234
236
235
// InitialPools returns all pools and their delegators from the genesis data
237
236
func (g * ShelleyGenesis ) InitialPools () (map [string ]common.PoolRegistrationCertificate , map [string ][]common.Address , error ) {
238
-
239
237
pools := make (map [string ]common.PoolRegistrationCertificate )
240
238
poolStake := make (map [string ][]common.Address )
241
239
242
- // Check for empty staking data
243
240
if reflect .DeepEqual (g .Staking , GenesisStaking {}) {
244
241
return pools , poolStake , nil
245
242
}
246
243
247
- // Process stake delegations first
248
244
for stakeAddr , poolId := range g .Staking .Stake {
249
- // Validate stake address format
250
245
if len (stakeAddr ) != 56 {
251
- return nil , nil , fmt . Errorf ("invalid stake address length: %d (expected 56 hex chars)" , len ( stakeAddr ) )
246
+ return nil , nil , errors . New ("invalid stake address length" )
252
247
}
253
248
254
249
stakeKeyBytes , err := hex .DecodeString (stakeAddr )
255
250
if err != nil {
256
- return nil , nil , fmt . Errorf ("failed to decode stake key %s: %w" , stakeAddr , err )
251
+ return nil , nil , errors . New ("failed to decode stake key" )
257
252
}
258
253
259
- // Create stake address
260
254
stakeAddrBytes := append ([]byte {0xE1 }, stakeKeyBytes ... )
261
255
addr , err := common .NewAddressFromBytes (stakeAddrBytes )
262
256
if err != nil {
263
- return nil , nil , fmt . Errorf ("failed to create stake address: %w" , err )
257
+ return nil , nil , errors . New ("failed to create stake address" )
264
258
}
265
259
266
260
poolStake [poolId ] = append (poolStake [poolId ], addr )
267
261
}
268
262
269
- // Process pools
270
263
for poolId , pool := range g .Staking .Pools {
271
- // Validate pool ID format
272
264
if len (poolId ) != 56 {
273
- return nil , nil , fmt . Errorf ("invalid pool ID length: %d (expected 56 hex chars)" , len ( poolId ) )
265
+ return nil , nil , errors . New ("invalid pool ID length" )
274
266
}
275
267
276
268
operatorBytes , err := hex .DecodeString (poolId )
277
269
if err != nil {
278
- return nil , nil , fmt . Errorf ("failed to decode pool operator key: %w" , err )
270
+ return nil , nil , errors . New ("failed to decode pool operator key" )
279
271
}
280
272
281
273
pools [poolId ] = common.PoolRegistrationCertificate {
@@ -296,7 +288,6 @@ func (g *ShelleyGenesis) InitialPools() (map[string]common.PoolRegistrationCerti
296
288
297
289
// PoolById returns a specific pool by its ID along with its delegators
298
290
func (g * ShelleyGenesis ) PoolById (poolId string ) (* common.PoolRegistrationCertificate , []common.Address , error ) {
299
- // Validate input
300
291
if len (poolId ) != 56 {
301
292
return nil , nil , errors .New ("invalid pool ID length" )
302
293
}
@@ -306,7 +297,6 @@ func (g *ShelleyGenesis) PoolById(poolId string) (*common.PoolRegistrationCertif
306
297
return nil , nil , errors .New ("pool not found" )
307
298
}
308
299
309
- // Decode pool operator key
310
300
operatorBytes , err := hex .DecodeString (poolId )
311
301
if err != nil {
312
302
return nil , nil , errors .New ("failed to decode pool operator key" )
@@ -334,7 +324,6 @@ func (g *ShelleyGenesis) PoolById(poolId string) (*common.PoolRegistrationCertif
334
324
}
335
325
}
336
326
337
- // Return pool with delegators
338
327
return & common.PoolRegistrationCertificate {
339
328
Operator : common .Blake2b224 (operatorBytes ),
340
329
VrfKeyHash : pool .VrfKeyHash ,
0 commit comments