@@ -204,9 +204,8 @@ func (c *ChainSync) Start() error {
204
204
isPoolBech32 := strings .HasPrefix (filterPoolId , "pool" )
205
205
foundMatch := false
206
206
for _ , certificate := range v .Certificates {
207
- switch certificate .(type ) {
207
+ switch cert := certificate .(type ) {
208
208
case * ledger.StakeDelegationCertificate :
209
- cert := & ledger.StakeDelegationCertificate {}
210
209
b := & ledger.Blake2b224 {}
211
210
copy (b [:], cert .PoolKeyHash [:])
212
211
if b .String () == filterPoolId {
@@ -229,6 +228,52 @@ func (c *ChainSync) Start() error {
229
228
filterMatched = true
230
229
break
231
230
}
231
+ case * ledger.PoolRetirementCertificate :
232
+ b := & ledger.Blake2b224 {}
233
+ copy (b [:], cert .PoolKeyHash [:])
234
+ if b .String () == filterPoolId {
235
+ foundMatch = true
236
+ } else if isPoolBech32 {
237
+ // lifted from gouroboros/ledger
238
+ convData , err := bech32 .ConvertBits (certificate .Cbor (), 8 , 5 , true )
239
+ if err != nil {
240
+ continue
241
+ }
242
+ encoded , err := bech32 .Encode ("pool" , convData )
243
+ if err != nil {
244
+ continue
245
+ }
246
+ if encoded == filterPoolId {
247
+ foundMatch = true
248
+ }
249
+ }
250
+ if foundMatch {
251
+ filterMatched = true
252
+ break
253
+ }
254
+ case * ledger.PoolRegistrationCertificate :
255
+ b := & ledger.Blake2b224 {}
256
+ copy (b [:], cert .Operator [:])
257
+ if b .String () == filterPoolId {
258
+ foundMatch = true
259
+ } else if isPoolBech32 {
260
+ // lifted from gouroboros/ledger
261
+ convData , err := bech32 .ConvertBits (certificate .Cbor (), 8 , 5 , true )
262
+ if err != nil {
263
+ continue
264
+ }
265
+ encoded , err := bech32 .Encode ("pool" , convData )
266
+ if err != nil {
267
+ continue
268
+ }
269
+ if encoded == filterPoolId {
270
+ foundMatch = true
271
+ }
272
+ }
273
+ if foundMatch {
274
+ filterMatched = true
275
+ break
276
+ }
232
277
}
233
278
}
234
279
if foundMatch {
0 commit comments