-
Notifications
You must be signed in to change notification settings - Fork 636
wallet+wtxmgr: check credit in FetchOutpointInfo
#1011
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
Conversation
dee5d91
to
d092695
Compare
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.
Thank you for the fix 🙏
|
||
// Create a tx that has two outputs - output1 belongs to the wallet, | ||
// output2 is external. | ||
output1 := wire.NewTxOut(100000, p2shAddr) |
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 why do they they pay to the same addr thought therefore we created addr above ?
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.
doesn't matter but still better to have a proper logic in.
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.
they are dummy values - techinically they should be the same so we know the result doesn't depend on the pkscript, but again I don't think it matters.
wallet/utxos_test.go
Outdated
name: "no credit found", | ||
prevOut: &wire.OutPoint{ | ||
Hash: tx.TxHash(), | ||
Index: 1000, |
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.
wrong index probably you wanted to use 1 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.
correct
wallet/utxos_test.go
Outdated
Hash: tx.TxHash(), | ||
Index: 1000, | ||
}, | ||
errExpected: "invalid output index", |
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.
wrong error (when using with the right index (index 1) ?
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.
missing the success case as well ?
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.
see TestFetchOutpointInfo
To decide whether an outpoint belongs to the wallet or not, we need to further check that the specified output index is indeed a credit paid to us.
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.
LGTM
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.
LGTM, thanks for the fix!
To decide whether an outpoint belongs to the wallet or not, we need to further check that the specified output index is indeed a credit paid to us.