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 23, 2024
1 parent 814efb3 commit 18002c0
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 @@ -1150,9 +1150,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 @@ -1185,8 +1183,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 18002c0

Please sign in to comment.