maidsafe / sn_dbc

Safe Network DBCs
BSD 3-Clause "New" or "Revised" License
15 stars 16 forks source link

Should we confirm amount matches commitment in Dbc::confirm_valid()? #127

Closed dan-da closed 2 years ago

dan-da commented 2 years ago

Should we also call self.confirm_provided_amount_matches_commitment(..)?

_Originally posted by @davidrusu in https://github.com/maidsafe/sn_dbc/pull/121#discussion_r805205141_

danda:

maybe, but that would be "invalid" in a different sense than other confirm_valid() errors.

Presently we can distinguish between:

Dbc is valid and amount secrets are valid Dbc is valid and amount secrets are invalid Dbc is invalid and amount secrete are invalid Dbc is invalid and amount secrets are valid

Of these, I think 1 and 2 are most important. Not much need to distinguish between 3 and 4 usually I guess.

One way to retain same granularity would be to return an Enum from confirm_valid() instead of just ().

Or maybe we just keep the present API.

dan-da commented 2 years ago

see also: https://github.com/maidsafe/sn_dbc/pull/121#discussion_r805207503

dan-da commented 2 years ago

addressed by #150