Skip to content

Commit

Permalink
Fix the WriteAddressUtxos and add a DeleteUtxosForAddress method to t…
Browse files Browse the repository at this point in the history
…he rawdb
  • Loading branch information
gameofpointers committed Aug 8, 2024
1 parent 759921b commit cf573e1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions core/rawdb/accessors_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1245,9 +1245,7 @@ func WriteOutpointsForAddress(db ethdb.KeyValueWriter, address string, outpoints
if err := db.Put(addressUtxosKey(address), data); err != nil {
db.Logger().WithField("err", err).Fatal("Failed to store utxos")
}

// And finally, store the data in the database under the appropriate key
return db.Put(AddressUtxosPrefix, data)
return nil
}

func ReadOutpointsForAddress(db ethdb.Reader, address string) map[string]*types.OutpointAndDenomination {
Expand Down Expand Up @@ -1280,8 +1278,8 @@ func ReadOutpointsForAddress(db ethdb.Reader, address string) map[string]*types.
return outpoints
}

func DeleteAddressUtxos(db ethdb.KeyValueWriter, hash common.Hash, number uint64) {
if err := db.Delete(AddressUtxosPrefix); err != nil {
func DeleteOutpointsForAddress(db ethdb.KeyValueWriter, address string) {
if err := db.Delete(addressUtxosKey(address)); err != nil {
db.Logger().WithField("err", err).Fatal("Failed to delete utxos")
}
}
Expand Down

0 comments on commit cf573e1

Please sign in to comment.