Commit Graph
100 Commits
Author SHA1 Message Date
Johan T. Halseth 80c5232d4f Merge pull request #3978 from bhandras/hotfix
invoices: fix log messages
2020-02-04 12:56:18 +01:00
Johan T. Halseth b39e21f6dd Merge pull request #3926 from C-Otto/master
Fix typos
2020-01-31 11:34:34 +01:00
Johan T. Halseth 1dadce7cfd Merge pull request #3945 from joostjager/node-level-penalty
routing: penalize node-level failures harder
2020-01-25 12:50:09 +01:00
Johan T. Halseth a8ec8f2db6 Merge pull request #3582 from hsjoberg/pendingchannelevent
rpc: Add PendingOpenChannel to SubscribeChannelEvents
2020-01-24 14:42:40 +01:00
Johan T. Halseth fd75f29480 Merge pull request #3908 from halseth/mobile-trim-spaces
[mobile] trim arg spaces before comparison
2020-01-23 11:54:25 +01:00
Johan T. Halseth bebb6395ec Merge pull request #2137 from halseth/payintent-recv-eof
rpcserver: fix error handling in bidirectional sendPayment
2020-01-23 11:53:56 +01:00
Johan T. Halseth 2b6575463b mobile: bump falafel dep to 0.7 2020-01-21 20:45:58 +01:00
Johan T. Halseth dc23810118 rpcServer: wait for all goroutines to finish before exiting
Returning from the sendPayments method closes the underlying stream, so
we would risk payments still being in flight when returning.

We add the running goroutines to a waitgroup, such that we can wait for
them all to exit before exiting and closing the stream.

In case an error is encountered in the process, we will return directly,
which will close the `reqQuit` channel and prompt the gorpoutines to
shut down.
2020-01-21 12:45:12 +01:00
Johan T. Halseth 5b85721c04 rpcServer: ensure all payIntents are handled before exiting
This commit fixes a problem that could arise when handling a continuous
stream of payIntents. We would risk the client sending a set of payment
intents and closing the stream, but we wouldn't be sure the sendLoop had
read all messages on the `payChan` before exiting with the nil error
from the `errChan`.

Instead, we close the `payChan` to indicate that no more payments are
going to be received.
2020-01-21 12:45:12 +01:00
Johan T. Halseth c49ba0c5cb rpcServer: ensure we don't get blocked on bidirectional payment errors
This commit fixes a potential issue in the bidirectional sendPayment
case, where multiple goroutines could be sending on an errChan with
buffer 1. Instead we select on default as well, as it is enough to
handle the first error that was received.
2020-01-21 12:45:12 +01:00
Johan T. Halseth f20f29696a rpcserver: let sendPayment sendLoop listen for shutdown
Intead of checking for shutdown in the receive loop, we let the sendLoop
handle it, as it can return the error directly. This works since the
returning sendLoop will trigger a close of the `reqQuit` channel, which
will ensure the receive loop exits.
2020-01-21 12:28:31 +01:00
Johan T. Halseth 80ad0fdd5c lntest: restart Alice after on-chain settle
To ensure lnd is able to pick up an on-chain preimage properly after a
restart, we suspend Alice and check that the payment is listed correctly
as succeeded after a restart.
2020-01-20 14:01:19 +01:00
Johan T. Halseth bb619352be lntest: check payment status settled after claim test 2020-01-20 13:55:13 +01:00
Johan T. Halseth daa08be62a Merge pull request #3907 from halseth/mobile-walletunlocker-tls
[mobile] Set walletunlocker TLS credentials
2020-01-14 10:30:02 +01:00
Johan T. Halseth 56230f5de2 mobile: add note about using lnddir
On both Android and iOS (when not using a simulator) the application
procees doesn't have write permissions to the default lnd directory.
This commit adds a note about using the app directory given by the used
platform.
2020-01-14 09:30:09 +01:00
Johan T. Halseth f5a9813304 mobile: add TLS options to wallet unlocker listener
The wallet unlocker service also requires the TLS certificates to be
added, but this was not set. This commit sets the options similar to
what is done for the regular RPC server.
2020-01-14 09:30:09 +01:00
Johan T. Halseth a870ed5fb7 lnd: add WalletUnlockerAuthOptions
Similar to what was done for the regular RPC server, we add auth dial
options for the wallet unlocker, as it also requires TLS now.
2020-01-14 09:30:09 +01:00
Johan T. Halseth dae5dddfd2 mobile: trim arg spaces before comparison
Since spaces where trimmed only after checking for empty strings, an
empty flag '-- ' would be passed along to lnd. Intead we trim first to
properly ingore such flags.
2020-01-13 13:25:14 +01:00
Johan T. Halseth 3aca9d24b8 Merge pull request #3829 from halseth/pluggable-commitments-lnwallet
Pluggable commitments
2020-01-07 09:58:12 +01:00
Johan T. Halseth 9c3218c51e lnwallet/channel: reuse derived SingleTweak on local force close
When creating the keyring, the tweak is already calculated in the remote
commitment case. We add the calculation also for our own commitment, so
we can use it in all cases without deriving the tweak.
2020-01-06 12:08:29 +01:00
Johan T. Halseth 3711597fef input: remove duplicate commit weight constant 2020-01-06 12:08:25 +01:00
Johan T. Halseth a56ed72bd7 lnwallet: use channel type to derive remote script
Based on the current channel type, we derive the script used for the
to_remote output. Currently only the unencumbered p2wkh type is used,
but that will change with upcoming channel types.
2020-01-06 12:08:19 +01:00
Johan T. Halseth 9b5809a884 input: update SignDescriptor doc to note only segwit is supported
Also update the WitnessScript doc to note it should be set also for
p2wkh.
2020-01-06 12:08:14 +01:00
Johan T. Halseth f92c7a3af0 lnwallet: nil single tweak when creating keyring
To make the channel state machine less concerned about the type of
commitment, we nil the local tweak when creating the keyring, depending
on the commitment type.
2020-01-06 12:08:09 +01:00
Johan T. Halseth 5e3718a1b5 lnwallet: use channel type to derive keys
We abstract away how keys are generated for the different channel types
types (currently tweak(less)).

Intention is that more of the logic that is unique for each commitment
type lives in commitment.go, making the channel state machine oblivious
to the keys and outputs being created on the commitment tx for a given
channel state.
2020-01-06 12:08:05 +01:00
Johan T. Halseth 4fde31229c lnwallet: rename DelayKey->ToLocalKey, NoDelayKey->ToRemoteKey
Since both parties are going to have their ouputs delayed, we move way
from the DelayKey naming, and instead use ToLocalKey and ToRemoteKey.
2020-01-06 12:08:01 +01:00
Johan T. Halseth 7b9c54996b lnwallet/commitment: clarify keyring key ownership 2020-01-06 12:07:56 +01:00
Johan T. Halseth 76ce51301e lnwallet: return instead evaluated commitment instead of mutating
createCommitmentTx would earlier mutate the passed commitment struct
after evaluating the htlc view and calculating the final balances, which
was confusing since the balances are supposed to only be *after*
subtracting fees.

Instead we take the needed parameters as arguments, and return the final
balances, tx and fee to populate the commitment struct in a proper way.
2020-01-06 12:07:49 +01:00
Johan T. Halseth 613d771daf lnwallet: create CommitmentBuilder
We define a new struct CommitmentBuilder that will be used to craft the
final commitment transaction based on the current active channel type.
2020-01-06 11:42:03 +01:00
Johan T. Halseth 13a108e578 lnwallet: make fundingTxIn not depend on LightningWallet 2020-01-06 11:42:03 +01:00
Johan T. Halseth 83e0d47ba3 lnwallet: move methods to commitment.go
PURE CODE MOVE:
Moving createCommitmentTx, CreateCommitTx, createStateHintObfuscator,
CommitmentKeyRing, DeriveCommitmentKeys, addHTLC, genHtlcScripts

We move the methods and structs to a new file commitment.go in
preparation for defining all the logic that is dependent on the channel
type in this new file.
2020-01-06 11:42:03 +01:00
Johan T. Halseth fff9dbe6f3 lnwallet: pass chan cfgs to CreateCommitTx
Instead of passing delays and dustlimits separately, we pass the correct
channel config to CreateCommitTx from the POV of the local party that
owns the commit tx.

To make it more clear which commitment we are actually creating, we
rename variables to denote local and remote, to prepare for the case
when both outputs might be delayed.
2020-01-06 11:42:03 +01:00
Johan T. Halseth 1a4f81ed90 lnwallet: remove duplicate chanCfg fields, use channelState 2020-01-06 11:42:02 +01:00
Johan T. Halseth e2b050aca3 lnwallet: make addHtlc non-LightningChannel method
It has no dependency on LightningChannel
2020-01-06 11:42:02 +01:00
Johan T. Halseth f0019006a7 lnwallet: remove unused initiator param to CreateCooperativeCloseTx 2020-01-06 11:42:02 +01:00
Johan T. Halseth 2c46640dd0 channeldb+lnwallet: note that balance is after subtracting commit fee
It was incorrectly stated that the commitment balance was before
subctracting the commit fee, which led to some confusion.
2020-01-06 11:42:02 +01:00
Johan T. Halseth f28b809778 Merge pull request #3845 from halseth/dialer-withcontext-dialer
[trivial] lncfg+lncli: replace WithDialer->WitchContextDialer
2019-12-19 22:08:02 +01:00
Johan T. Halseth aea902b788 Merge pull request #3847 from halseth/lnd-test-csv-flake
lnd test: fix csv mempool sweep time
2019-12-19 19:40:37 +01:00
Johan T. Halseth 773212bdf8 Merge pull request #3783 from halseth/mobile-macaroons
[mobile] mobile macaroons support
2019-12-18 12:06:26 +01:00
Johan T. Halseth d196a4431a mobile: remove no-macaroons from sample config
Now that macaroons are supported, encourage usage.
2019-12-18 10:30:51 +01:00
Johan T. Halseth 5be6e1c92e mobile: authenticate with rpc server
This makes the mobile bindings work with TLS and macaroons enabled,
which is supported from falafel 0.6.
2019-12-18 10:28:23 +01:00
Johan T. Halseth 200161e04c mobile: update to falafel 0.6 2019-12-18 10:28:23 +01:00
Johan T. Halseth 7077d19589 lnd: add Authenticate method
Adds a global Authenticate method that can be used to get the
atuhentication options needed to call the grpc server.

Currently meant only for used with the mobile bindings, so we use the
admin macaroon.
2019-12-18 10:28:22 +01:00
Johan T. Halseth ca22001bab cert: add bufconn to TLS hostnames 2019-12-18 10:28:22 +01:00
Johan T. Halseth 27337dc973 lnd+rpcserver: use same serverOpts for custom listeners
Earlier we used emtpy grpc server options if custom listeners were set.
This was done to disable TLS. Now, we reuse the same server options as
for the regular listeners, in a move towards enabling TLS also here.
2019-12-18 10:28:22 +01:00
Johan T. Halseth fd4153851d Merge pull request #3397 from carlaKC/peernotifier-addsubscribepeerrpc
lnrpc: Add subscribe peer events rpc
2019-12-17 21:46:24 +01:00
Johan T. Halseth 76dfd6326d Merge pull request #3799 from carlaKC/chanfitness-bugfix
Bugfix: Chanfitness open time for offline peers
2019-12-17 20:54:34 +01:00
Johan T. Halseth 7044219f90 lnd test: fix csv mempool sweep time
Since CSV locked outputs specifies the first block where they are
allowed to be included, they can actually be added one block earlier
into the mempool.

This led to a flake, where the sweep tx was already in the mempool at
the time we mined the last block, causing the next mempool check to
fail.
2019-12-17 15:29:27 +01:00
Johan T. Halseth b3b355659b lncfg+lncli: replace WithDialer->WitchContextDialer
WithDialer is deprecated, use WitchContextDialer instead.
2019-12-17 13:37:29 +01:00
Johan T. Halseth f0bd4e775b Merge pull request #3775 from halseth/mobile-listener-signal
[mobile] make Ready signal for custom listeners
2019-12-17 12:26:04 +01:00
Johan T. Halseth 27430f8bc9 Merge pull request #3832 from cfromknecht/fix-signer-protos
signrpc: fix uncommitted changes from proto
2019-12-13 10:02:17 +01:00
Johan T. Halseth c04ef68cc3 Merge pull request #3826 from arik-so/wrong_chain_error_fix
fix order in wrong chain error message
2019-12-12 09:46:31 +01:00
Johan T. Halseth 509d0fb82d Merge pull request #3767 from matheusdtech/fix-zpay32
zpay32: Fix broken last tagged field
2019-12-05 08:52:14 +01:00
Johan T. Halseth e28c5a1e89 Merge pull request #3762 from halseth/mobile-subserver-goimports
mobile: run goimports on generated files
2019-12-04 11:28:07 +01:00
Johan T. Halseth a6ef03c777 Merge pull request #3743 from cfromknecht/in-order-sids
lnwire: assert sorted short channel ids
2019-12-04 08:56:02 +01:00
Johan T. Halseth 4d2813900e Merge pull request #3776 from matheusdtech/random-ports
lntest: Use TCP ports not based in nodeID
2019-12-04 08:46:37 +01:00
Johan T. Halseth 260704f3cd mobile: call Start callback when lnd ready, add unlock callback
Use the custom listeners' Ready channels to provide callbacks to the
mobile application when the gRPC services are ready.

NOTE: this changes the Start() API by adding one extra callback.
2019-11-29 11:59:01 +01:00
Johan T. Halseth dc6c040803 lnd: make Ready signal for custom listeners
This allows the caller to know when lnd is ready to accept RPC calls,
which is inmportant for mobile applications where eveything happens in
process.
2019-11-29 11:59:01 +01:00
Johan T. Halseth e8e5fd7abc mobile: run goimports on generated files
Subservers might depend on each other (notably walletrpc depends on
signrpc) so running goimports ensures they properly import each other.
2019-11-26 14:57:17 +01:00
Johan T. Halseth ddeb9fbbbb chainntnfs/txnotifier: promote historical spend log to info
And add some more details.
2019-11-21 15:18:27 +01:00
Johan T. Halseth 339543857a chainntnfs/txnotifier: add more debug logs aroung spend dispatch
To track down missing spends.
2019-11-21 15:18:20 +01:00
Johan T. Halseth 1c832789d6 chainntnfs/bitcoind: log finished hitsorical spend dispatch 2019-11-21 15:18:15 +01:00
Johan T. Halseth fa40fa6950 chainntnfs/interface: add String method for SpendDetaill 2019-11-21 15:18:10 +01:00
Johan T. Halseth 2e85647ec4 chainntnfs/txnotifier: include script in SpendRequest string representation 2019-11-21 15:18:01 +01:00
Johan T. Halseth ddbd7a68ac lntest/node: add numActiveNodesMtx
Fixes a slight race condition that could happen since Alice and Bob are
created in different goroutines, leading to using the same listening
ports.
2019-11-21 13:57:30 +01:00
Johan T. Halseth 08803e2e41 lnd_test: fix race condition on simultanous force closes
This fixes an issue that would lead to a flake during intergration
tests. Carol would start up with a outdated state and attempt to force
close the channel. At the same time she would connect to Dave,
triggering the dataloss protection. Dave would respond by force closing
the channel, and Dave transaction would in some cases have a higher fee,
resulting Carol's tx being replaced.

We fix this by suspending Dave until Carol's close tx is mined.
2019-11-21 13:43:29 +01:00
Johan T. Halseth 2754f5dea0 mobile: 80 char limit readme 2019-11-21 12:35:52 +01:00
Johan T. Halseth 27abe4a301 mobile: halseth/falafel -> lightninglabs/falafel 2019-11-21 12:34:38 +01:00
Johan T. Halseth 1b543b919e mobile: add comments to build script 2019-11-21 12:33:48 +01:00
Johan T. Halseth b1e6d9c5cf Merge pull request #1152 from guggero/macaroon-integrationtest
itest: add tests for macaroon authentication
2019-11-21 09:22:28 +01:00
Johan T. Halseth 8755a35860 Merge pull request #3667 from cfromknecht/log-fixes
fundingmanager+routing log touch ups
2019-11-20 15:57:05 +01:00
Johan T. Halseth 79051ac63f Merge pull request #2520 from yancyribbens/choose-git-state-during-docker-prod-build
specify a tag, branch or commit during docker prod build
2019-11-19 14:56:09 +01:00
Johan T. Halseth d4d8b03d5b Merge pull request #3705 from joostjager/payment-fail-log
routing+htlcswitch: improve failed payment logging
2019-11-15 10:41:48 +01:00
Johan T. Halseth 840051cc3d Merge pull request #3644 from joostjager/commit-sweep-no-nursery
cnct: commit sweep without nursery
2019-11-15 10:38:57 +01:00
Johan T. Halseth f0048bb662 chainntnfs/txnotifier_test: add TestTxNotifierSpendDuringHistoricalRescan 2019-11-14 15:05:50 +01:00
Johan T. Halseth a8837478f4 mod: update neutrino dep 2019-11-11 10:45:09 +01:00
Johan T. Halseth 3b22540fc1 Merge pull request #2533 from yancyribbens/persistent-lnd-volume-docker-compose
add named volume to lnd service for persisting data accross container…
2019-11-11 09:47:30 +01:00
Johan T. Halseth d50b3a9c81 Merge pull request #3684 from alexbosworth/patch-12
trivial: fix typo
2019-11-07 12:00:35 +01:00
Johan T. Halseth 2947036633 Merge pull request #3664 from joostjager/outgoing-contest-resolver-test
cnct/test: add outgoing contest resolver test
2019-11-07 10:54:45 +01:00
Johan T. Halseth e0744a3983 Merge pull request #3650 from guggero/update-grpc-gateway
proto+lnrpc: update gRPC-REST gateway to v1.8.6
2019-11-01 09:03:48 +01:00
Johan T. Halseth 5a8ecfcc49 autopilot/agent_test: add TestAgentHeuristicUpdateSignal
TestAgentHeuristicUpdateSignal tests that upon notification about a
heuristic update, the agent reconsults the heuristic.
2019-10-31 10:19:50 +01:00
Johan T. Halseth 7524265ab1 autopilot: trigger agent channel open on new scores
This commit adds a new signal to the autopilot agent, meant to signal
when any of the available heuristics has gotten an update.

We currently use this to trigger a new channel opening after the
external scores have been updated.
2019-10-31 10:17:31 +01:00
Johan T. Halseth f0ba4be758 autopilot/manager: fix slice modifications
When appending to a slice, there is no guarantee the slice won't be
modified. So instead of appending to the global slice
availableHeuristics, we create a temporary local one.
2019-10-31 10:17:31 +01:00
Johan T. Halseth df5baa4275 autopilot/agent: trace log reason nodes being skipped 2019-10-31 10:17:31 +01:00
Johan T. Halseth 64e5d06cd1 Merge pull request #2598 from skwp/docker-caching
Add source after installing apk packages to avoid breaking docker cache
2019-10-30 15:47:57 +01:00
Johan T. Halseth 1a0ab538d5 Merge pull request #3332 from carlaKC/chanfitness-trackchanneluptime
Chanfitness: Track peer uptime
2019-10-25 14:29:59 +02:00
Johan T. Halseth 12a1d05127 fundingmanager: make SendToPeer sync
Since the funding flow requires messages to go through, make use of
sync version of SendToPeer. Using the async version we would risk that
the message was dropped and the process would stall (it would properly
continue after a restart though).
2019-10-24 13:08:08 +02:00
Johan T. Halseth 018737a80a Merge pull request #3627 from guggero/witness-timelock-type
input+sweep: log input witness types instead of CSV/CLTV count
2019-10-24 11:08:33 +02:00
Johan T. Halseth fd906475dd Merge pull request #3569 from guggero/chainntfs-addr-reuse
chainntnfs: fix nil pointer on address reuse
2019-10-23 12:45:57 +02:00
Johan T. Halseth 753f30a6ff chainntnfs/neutrino: don't ignore failed filter fetches
Earlier GetCFilter could return a nil-error along with a nil-filter in
cases where we failed to fetch the filter. We would just ignore the
block causing us to miss potential crucial information.

Now that GetCFilter will return an error in cases where the fetch
failed, the filter will never be nil (even for blocks with only coinbase
transactions), and we'll instead return an error.

We also increase the number of retries for the filter from the default 2
to 5.
2019-10-15 11:25:31 +02:00
Johan T. Halseth 610a93e2ff routing/chainview: check GetCFilter error
Since the filter will never be nil in non-error cases now, remove the
nil-check.
2019-10-15 10:31:25 +02:00
Johan T. Halseth 5cbef663e4 go mod: update btcd+neutrino+btcwallet 2019-10-15 10:31:23 +02:00
Johan T. Halseth d15209abf2 make: default backend variable to btcd
This fixes the logging of used backend in the default (btcd) case.
2019-10-08 15:14:11 +02:00
Johan T. Halseth 1a5e39db88 Merge pull request #3541 from halseth/itest-connection-refused-ignore
lnd_test: give peers more time to successfully attempt connection
2019-10-07 10:23:52 +02:00
Johan T. Halseth a3a04992b4 lnd_test: give peers more time to successfully attempt connection
We might hit a connection refused error in cases where the peer connects
to us exactly as we try to connect to it. We retry the connection within
a wait predicat, as it should be the case that the other peer
establishes the connection, and the two peers actually connects.
2019-10-07 09:46:23 +02:00
Johan T. Halseth 6765b8668a Merge pull request #3574 from wpaulino/max-fee-allocation-fee-floor
htlcswitch: enforce fee floor on max fee allocation
2019-10-04 14:12:02 +02:00
Johan T. Halseth e88c635b7e Merge pull request #3573 from wpaulino/log-conf-ntfn-once
chainntnfs: only log confirmation notification registration once
2019-10-04 13:06:42 +02:00
Johan T. Halseth 989de44a69 Merge pull request #3563 from joostjager/link-test-context
htlcswitch/test: create link test context
2019-10-03 09:45:36 +02:00
Johan T. Halseth 43b02d3035 Merge pull request #3481 from legacycode/fix-dockerfile
Fixed dockerfile by adding version numbers to base containers
2019-10-01 15:02:07 +02:00
Johan T. Halseth f8621fe6d7 Merge pull request #3554 from alrs/stdlib-context
Use stdlib "context" Package
2019-09-30 10:15:34 +02:00