-
Notifications
You must be signed in to change notification settings - Fork 602
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
Improve account related test coverage #239
Conversation
e005e48
to
51bd2af
Compare
used: true, | ||
tests := []struct { | ||
name string | ||
addrType btcutil.Address |
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.
Is this field needed? doesn't look used and the address in the p2sh address test is actually a p2pkh addr.
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.
I'm using this field now, to switch between managedAddress
and scriptAddress
so that both paths are covered in the test cases.
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.
The type itself is used, but not the data. I would consider using constants here instead:
func testMarkUsed(tc *testContext) bool {
type addrType byte
const (
addrPubKeyHash addrType = iota
addrScriptHash
)
tests := []struct {
typ addrType
// ...
}
// ...
switch test.typ {
case addrPubKeyHash:
// ...
case addrScriptHash:
// ...
default:
panic("unreachable")
}
// ...
}
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.
Thanks, updated to use addrType
const
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.
Thanks, removed it.
72983f2
to
7ddf007
Compare
@@ -53,6 +53,149 @@ var ( | |||
|
|||
// waddrmgrNamespaceKey is the namespace key for the waddrmgr package. | |||
waddrmgrNamespaceKey = []byte("waddrmgrNamespace") | |||
|
|||
// expectedExternalAddrs is the list of expected external addresses |
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.
Please remove tab characters between the // and the comment text.
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.
Sorry, slipped past my editor, removed.
a1ba83d
to
9b42268
Compare
|
||
const ( | ||
addrPubKeyHash addrType = iota | ||
addrPubKey addrType = iota |
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.
Unneeded type and iota here
9b42268
to
eb81b1f
Compare
This looks ok now. Can you squash and rebase? |
eb81b1f
to
aebf7ba
Compare
@jrick Thanks, rebased now. |
OK |
Need rebase to latest master. |
aebf7ba
to
ee72c81
Compare
OK, squashed and rebased to latest master. |
Added test coverage for account related manager funcs.