Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce an errors package #284

Merged
merged 5 commits into from
Nov 6, 2020
Merged

Introduce an errors package #284

merged 5 commits into from
Nov 6, 2020

Conversation

jholdstock
Copy link
Member

This change supports extracting database code into a database package. Both the pool package and database package would be dependent on errors.go, and so a circular dependency would be introduced unless an errors package is introduced.

This change supports extracting database code into a database package. Both the pool package and database package would be dependent on errors.go, and so a circular dependency would be introduced unless an errors package is introduced.
// understood by the program. Databases with recorded versions higher than
// this will fail to open (meaning any upgrades prevent reverting to older
// software).
LatestBoltDBVersion = paymentUUIDVersion
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably just be BoltDBVersion.

errors/error.go Outdated
Comment on lines 165 to 175
// Is returns whether err equals or wraps target.
func Is(err, target error) bool {
return errors.Is(err, target)
}

// As attempts to assign the error pointed to by target with the first error in
// err's error chain with a compatible type. Returns true if target is
// assigned.
func As(err error, target interface{}) bool {
return errors.As(err, target)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, looking at the call sites for these i think a namespace alias is a better fit than these funcs.

@@ -29,7 +30,7 @@ const (

// maxRoundingDiff is the maximum amount of atoms the total
// output value of a transaction is allowed to be short of the
// provided input due to rounding errors.
// provided input due to rounding e.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be reverted.

@@ -607,20 +608,20 @@ func (pm *PaymentMgr) generatePayoutTxDetails(ctx context.Context, txC TxCreator

// Ensure the transaction outputs do not source more value than possible
// from the provided inputs and also are consuming all of the input
// value after rounding errors.
// value after rounding e.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

cancel()
t.Fatalf("expected an input output mismatch error")
}

// Ensure generating payout tx details returns an error if the outputs of
// the transaction do not exhaust all remaining input value after rounding
// errors.
// e.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

Copy link
Member

@dnldd dnldd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@jholdstock jholdstock merged commit fcf8ab6 into decred:master Nov 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants