@@ -6,6 +6,7 @@ package atomic
66import (
77 "bytes"
88 "errors"
9+ "fmt"
910
1011 "github.com/ava-labs/avalanchego/database"
1112 "github.com/ava-labs/avalanchego/database/linkeddb"
@@ -16,7 +17,10 @@ import (
1617 "github.com/ava-labs/avalanchego/utils/set"
1718)
1819
19- var errDuplicatedOperation = errors .New ("duplicated operation on provided value" )
20+ var (
21+ errDuplicatePut = errors .New ("duplicate put" )
22+ errDuplicateRemove = errors .New ("duplicate remove" )
23+ )
2024
2125type dbElement struct {
2226 // Present indicates the value was removed before existing.
@@ -86,7 +90,7 @@ func (s *state) SetValue(e *Element) error {
8690 }
8791
8892 // This key was written twice, which is invalid
89- return errDuplicatedOperation
93+ return fmt . Errorf ( "%w: Key=0x%x Value=0x%x" , errDuplicatePut , e . Key , e . Value )
9094 }
9195 if err != database .ErrNotFound {
9296 // An unexpected error occurred, so we should propagate that error
@@ -160,7 +164,7 @@ func (s *state) RemoveValue(key []byte) error {
160164
161165 // Don't allow the removal of something that was already removed.
162166 if ! value .Present {
163- return errDuplicatedOperation
167+ return fmt . Errorf ( "%w: Key=0x%x" , errDuplicateRemove , key )
164168 }
165169
166170 // Remove [key] from the indexDB for each trait that has indexed this key.
0 commit comments