walletdb: add new ErrDryRunRollBack error

We need a way to signal that a DB transaction should be rolled back
because its changes were a dry-run only. We add a new specific error for
that case so the automatic rollback on error in the walletdb.View and
walletdb.Update comes to play. But we can still return the result of a
dry-run where we need to by inspecting for this specific error.
This commit is contained in:
Oliver Gugger 2021-07-19 13:27:58 +02:00
parent 33a0a065f9
commit 9c839caddf
No known key found for this signature in database
GPG key ID: 8E4256593F177720

View file

@ -39,6 +39,10 @@ var (
// ErrInvalid is returned if the specified database is not valid.
ErrInvalid = errors.New("invalid database")
// ErrDryRunRollBack is returned if a database transaction should be
// rolled back because its changes were a dry-run only.
ErrDryRunRollBack = errors.New("dry run only; should roll back")
)
// Errors that can occur when beginning or committing a transaction.