Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/postage/postagecontract/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func (c *postageContract) CreateBatch(ctx context.Context, initialBalance *big.I
if err != nil {
return
}
txHash = receipt.TxHash

for _, ev := range receipt.Logs {
if ev.Address == c.postageStampContractAddress && len(ev.Topics) > 0 && ev.Topics[0] == c.batchCreatedTopic {
var createdEvent batchCreatedEvent
Expand All @@ -415,6 +415,7 @@ func (c *postageContract) CreateBatch(ctx context.Context, initialBalance *big.I
if err != nil {
return
}
txHash = receipt.TxHash
return
}
}
Expand Down Expand Up @@ -447,7 +448,6 @@ func (c *postageContract) TopUpBatch(ctx context.Context, batchID []byte, topupB

receipt, err := c.sendTopUpBatchTransaction(ctx, batch.ID, topupBalance)
if err != nil {
txHash = receipt.TxHash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is obvious panic, if error happens, receipt is nil

return
}

Expand Down Expand Up @@ -483,9 +483,10 @@ func (c *postageContract) DiluteBatch(ctx context.Context, batchID []byte, newDe
if err != nil {
return
}
txHash = receipt.TxHash

for _, ev := range receipt.Logs {
if ev.Address == c.postageStampContractAddress && len(ev.Topics) > 0 && ev.Topics[0] == c.batchDepthIncreaseTopic {
txHash = receipt.TxHash
return
}
}
Expand Down
Loading