lnrpc/walletrpc: reject nil outpoints as args

In this commit, we modify the parsing of user provided outpoints to
ensure that we catch a nil (empty) output early. Otherwise, passing a
set of incorrect arguments would cause `lnd` to crash.
This commit is contained in:
Olaoluwa Osuntokun 2019-06-17 16:56:16 -07:00
parent c5357d383d
commit 94a20e30e1
No known key found for this signature in database
GPG Key ID: CE58F7F8E20FD9A2

@ -420,6 +420,10 @@ func (w *WalletKit) PendingSweeps(ctx context.Context,
// unmarshallOutPoint converts an outpoint from its lnrpc type to its canonical
// type.
func unmarshallOutPoint(op *lnrpc.OutPoint) (*wire.OutPoint, error) {
if op == nil {
return nil, fmt.Errorf("empty outpoint provided")
}
var hash chainhash.Hash
switch {
case len(op.TxidBytes) == 0 && len(op.TxidStr) == 0: