-
Notifications
You must be signed in to change notification settings - Fork 590
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
chain: add mempool lookup for outpoints #910
Conversation
472d3ac
to
9344055
Compare
e82ccac
to
79348ac
Compare
79348ac
to
fc0d8ca
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.
utACK, LGTM 🎉
chain/btcd.go
Outdated
// disconnected. | ||
func NewRPCClientWithConfig(cfg *RPCClientConfig) (*RPCClient, error) { | ||
// Make sure the config is supplied. | ||
if cfg == nil { |
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.
nit: the way Go
works, this check could be in the validate()
method.
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.
Won't that cause a nil deference? Or you mean before initializing the client we do a validation on config in lnd
?
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.
No, the thing is, in Go you can call a method on a struct, even if the struct itself is nil.
So you can do:
// validate checks the required config options are set.
func (r *RPCClientConfig) validate() error {
// Make sure the config is supplied.
if r == nil {
return errors.New("missing rpc config")
}
// Make sure retry attempts is positive.
if r.ReconnectAttempts < 0 {
return errors.New("reconnectAttempts must be positive")
}
...
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.
Ohhh cool, TILed, thanks!
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.
Yeh at time a check on the nil pointer can actually be useful.
Can be rebased with the |
This commit adds a new method to look up mempool spent for a given outpoint.
fc0d8ca
to
cdfd988
Compare
This commit adds a new method to init the RPC client. Unlike the `NewRPCClient`, it now takes a config to allow users specifying notification handlers. In the future, `NewRPCClient` should be replaced by this method. For now we implement it this way so other callsites relying on this method can stay out of being affected.
cdfd988
to
524b1eb
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.
LGTM 🎢
This PR adds a new method
LookupInputMempoolSpend
to directly check whether a given input has been spent or not in the mempool.