-
Notifications
You must be signed in to change notification settings - Fork 28
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
Conversation
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.
pool/boltupgrades.go
Outdated
// 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 |
There was a problem hiding this comment.
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
// 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) | ||
} |
There was a problem hiding this comment.
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.
pool/paymentmgr.go
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be reverted.
pool/paymentmgr.go
Outdated
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
pool/paymentmgr_test.go
Outdated
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
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.