Skip to content

Commit

Permalink
Validate CertificatesPerDomain transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
beautifulentropy committed Nov 30, 2023
1 parent ed095ae commit b314b69
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions ratelimits/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,28 @@ func (builder *TransactionBuilder) CertificatesPerDomainTransactions(regId int64
}
// Add a check-and-spend transaction for each per account per domain
// bucket.
txns = append(txns, newTransaction(perAccountLimit, perAccountPerDomainKey, perAccountPerDomainCost))
txn := newTransaction(perAccountLimit, perAccountPerDomainKey, perAccountPerDomainCost)
err = txn.validate()
if err != nil {
return nil, err
}
txns = append(txns, txn)

// Add a spend-only transaction for each per domain bucket.
txns = append(txns, newSpendOnlyTransaction(perDomainLimit, perDomainBucketKey, 1))
txn = newSpendOnlyTransaction(perDomainLimit, perDomainBucketKey, 1)
err = txn.validate()
if err != nil {
return nil, err
}
txns = append(txns, txn)
} else {
// Add a check-and-spend transaction for each per domain bucket.
txns = append(txns, newTransaction(perDomainLimit, perDomainBucketKey, 1))
txn := newTransaction(perDomainLimit, perDomainBucketKey, 1)
err = txn.validate()
if err != nil {
return nil, err
}
txns = append(txns, txn)
}
}
return txns, nil
Expand Down

0 comments on commit b314b69

Please sign in to comment.