Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate fee addr check. #361

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
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
14 changes: 0 additions & 14 deletions database/ticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,6 @@ func (vdb *VspDatabase) InsertNewTicket(ticket Ticket) error {
return fmt.Errorf("could not create bucket for ticket: %w", err)
}

// Error if a ticket already exists with the same fee address.
err = ticketBkt.ForEach(func(k, v []byte) error {
tbkt := ticketBkt.Bucket(k)

if string(tbkt.Get(feeAddressK)) == ticket.FeeAddress {
return fmt.Errorf("ticket with fee address %s already exists", ticket.FeeAddress)
}

return nil
})
if err != nil {
return err
}

err = putTicketInBucket(newTicketBkt, ticket)
if err != nil {
return fmt.Errorf("putting ticket in bucket failed: %w", err)
Expand Down
8 changes: 0 additions & 8 deletions database/ticket_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ func testInsertNewTicket(t *testing.T) {
t.Fatal("expected an error inserting ticket with duplicate hash")
}

// Inserting a ticket with the same fee address should fail.
ticket3 := exampleTicket()
ticket3.FeeAddress = ticket.FeeAddress
err = db.InsertNewTicket(ticket3)
if err == nil {
t.Fatal("expected an error inserting ticket with duplicate fee addr")
}

// Inserting a ticket with empty hash should fail.
ticket.Hash = ""
err = db.InsertNewTicket(ticket)
Expand Down