Skip to content

Commit

Permalink
fix: small fixes from self-review
Browse files Browse the repository at this point in the history
  • Loading branch information
aloknerurkar committed Aug 19, 2021
1 parent c2c16a3 commit 0b481e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/debugapi/postage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ func TestPostageAccessHandler(t *testing.T) {
{
name: "dilute batch ok",
method: http.MethodPatch,
url: fmt.Sprintf("/stamps/dilute/%s/10", batchOkStr),
url: fmt.Sprintf("/stamps/dilute/%s/18", batchOkStr),
respCode: http.StatusAccepted,
resp: &debugapi.PostageCreateResponse{
BatchID: batchOk,
Expand Down Expand Up @@ -671,7 +671,7 @@ func TestPostageAccessHandler(t *testing.T) {
{
name: "dilute batch not ok",
method: http.MethodPatch,
url: fmt.Sprintf("/stamps/dilute/%s/10", batchOkStr),
url: fmt.Sprintf("/stamps/dilute/%s/18", batchOkStr),
respCode: http.StatusTooManyRequests,
resp: &jsonhttp.StatusResponse{
Code: http.StatusTooManyRequests,
Expand Down
4 changes: 2 additions & 2 deletions pkg/postage/postagecontract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (c *postageContract) CreateBatch(ctx context.Context, initialBalance *big.I
}

for _, ev := range receipt.Logs {
if ev.Address == c.postageContractAddress && ev.Topics[0] == batchCreatedTopic {
if ev.Address == c.postageContractAddress && len(ev.Topics) > 0 && ev.Topics[0] == batchCreatedTopic {
var createdEvent batchCreatedEvent
err = transaction.ParseEvent(&postageStampABI, "BatchCreated", &createdEvent, *ev)
if err != nil {
Expand Down Expand Up @@ -312,7 +312,7 @@ func (c *postageContract) DiluteBatch(ctx context.Context, batchID []byte, newDe
}

for _, ev := range receipt.Logs {
if ev.Address == c.postageContractAddress && ev.Topics[0] == batchDiluteTopic {
if ev.Address == c.postageContractAddress && len(ev.Topics) > 0 && ev.Topics[0] == batchDiluteTopic {
return nil
}
}
Expand Down

0 comments on commit 0b481e0

Please sign in to comment.