Commit Graph
100 Commits
Author SHA1 Message Date
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
Johan T. Halseth 7fcac54dff Merge pull request #3531 from LightningPeach/fix-tx-subscr
Add BlockHeight param to SubscribeTransactions when tx is confirmed
2019-09-26 09:26:25 +02:00
Johan T. Halseth e5f0b8e793 Merge pull request #3393 from wroscoe/patch-1
fixed 1-line errant docker-compose command in instructions
2019-09-25 15:28:48 +02:00
Johan T. Halseth 97093b4223 lntest/itest: wait for on-chain balance restore
We add a wait predicate to make sure the node's on-chain balance is
restored before continuing the restore test case.

This is needed since the DLP test scenario includes several restarts of
the node, and if the node isn't done scanning for on-chain balance
before the restart happens, it would be unlocked without a recovery
window, causing funds to be left undiscovered.
2019-09-25 14:04:44 +02:00
Johan T. Halseth 2d194c9672 htlcswitch/link: remove chan sync delay
Earlier this delay was needed to increase the likelihood that the DLP
scanario was successfully completed. Since we would risk the connection
being torn down, and the link exit, we could end up with the remote
marking the channel borked, but not finishing the force close.

With the previous set of commits, we should now trigger the force close
before we merk the channel borked, which should ensure we'll resume the
orocess on next restart/connect.
2019-09-25 14:04:44 +02:00
Johan T. Halseth 2a6ad6e634 channeldb+lnwallet: don't pass isRestoredChan to ChanSyncMsg
Since we have access to the internal state of the channel, we can
instead get it directly instead of passing it in as a parameter.
2019-09-25 14:04:44 +02:00
Johan T. Halseth c90b1dd17d chancloser: mark commitment broadcast before publish
We call MarkCommitmentBroadcasted before publishing the closing tx to
ensure we can attempt to republish at startup if something goes wrong.
2019-09-25 14:04:44 +02:00
Johan T. Halseth 2cb80c4449 contractcourt/chain_arbitrator: mark commitment broadcasted before publish
Before publishing the close tx to the network and commit to the
StateCommitmentBroadcasted state, we mark the commitment as broadcasted
and store it to the db. This ensures it will get re-published on startup
if we go down.
2019-09-25 14:04:44 +02:00
Johan T. Halseth 9423fadf56 htlcswitch/link: don't mark channel borked on force close scanarios
Instead of marking the channel Borked in cases where we want to force
close it, we immediately let the peer fail the link. The channel state
will instead be updated by the channel arbitrator, which will transition
to StateBroadcastCommit, marking the channel borked, then marking the
commitment tx broadcasted right before publishing the force close tx. We
do this to avoid the case where we would mark it Borked, but go down
before being able to publish the closing tx.

Storing the force close tx ensures it will be re-published on startup.
2019-09-25 14:04:44 +02:00
Johan T. Halseth 6e361d04cf lnwallet+link: move marking channel states to link
Instead of marking the database state when processing the channel
reestablishment message, we wait for the result of this processing to
arrive in the link, and mark it accordingly in the database here.

We do this move the logic determining whether we should force close the
channel or not, and what state to mark it in the DB, to the same place,
as these need to be consistent.
2019-09-25 14:04:43 +02:00
Johan T. Halseth f40f4620f7 lnwallet/channel: make ErrCommitSyncLocalDataLoss type
This commit converts the ErrCommitSyncLocalDataLoss error into a struct,
that also holds the received last unrevoked commit point from the remote
party.
2019-09-25 14:04:43 +02:00
Johan T. Halseth d75feeb953 contractcourt/chain_arbitrator_test: add TestChainArbitratorRepublishCommitment
TestChainArbitratorRepulishCommitment testst that the chain arbitrator
will republish closing transactions for channels marked
CommitementBroadcast in the database at startup.
2019-09-25 14:04:43 +02:00
Johan T. Halseth 07a42971bf lnwallet/test_utils: make CreateTestChannel return random funding op
Previously it would always be the same, resulting in multiple calls to
the method not being usabel to create more than one set of channels.
2019-09-25 14:04:43 +02:00
Johan T. Halseth 425afd28ea contractcourt/chain_arbitrator: republish closeTx for open channels 2019-09-25 14:04:43 +02:00
Johan T. Halseth ac0e9b6016 channeldb/channel: add BroadcastedCommitment 2019-09-25 14:04:43 +02:00
Johan T. Halseth 02b2787e44 multi: make MarkCommitmentBroadcasted take closeTx 2019-09-25 14:04:43 +02:00
Johan T. Halseth a810092e53 channeldb/channel: make putChanStatus take optional extra closures 2019-09-25 14:04:43 +02:00
Johan T. Halseth 1974bfa4cf peer: send channel reestablish message for borked channels
When loading active channels for a connected peer, we gather channel
sync messages for all borked channels, and send them to the peer. This
should help a peer realize that the state is irreconcible, as we have
already realized.
2019-09-25 14:04:42 +02:00
Johan T. Halseth eb1b84c0b4 channeldb+lnwallet: make ChanSyncMsg method on OpenChannel 2019-09-25 14:04:42 +02:00
Johan T. Halseth 0122dda88a channeldb/channel: remove unused FullSync method
The exported FullSync method is only used by test code, so we remove it
and instead use SyncPending.
2019-09-25 14:04:42 +02:00
Johan T. Halseth b7e1bb0bf0 Merge pull request #3510 from halseth/lnwallet-rbf
Handle RBF signaling publication failures in wallet
2019-09-25 14:04:03 +02:00
Johan T. Halseth bc8308f42f Merge pull request #3538 from fridokus/master
trivial: fix typo in config.go
2019-09-25 08:17:21 +02:00
Johan T. Halseth 2e9452916e lnwallet/interface_test: add RBF test cases to testPublishTransaction
Checks that we get ErrDoubleSpend as expected when publishing a
conflicting mempool transaction with the same fee as the existing one,
and that we can publish a replacement with a higher fee successfully.
2019-09-25 08:04:04 +02:00
Johan T. Halseth 61e1b48f57 lnwallet/btcwallet: check publication error types, handle replacement
error

Since btcwallet will return typed errors now, we can simplify the
matching logic in order to return ErrDoubleSpend.

In case a transaction cannot be published since it did not satisfy the
requirements for a valid replacement, return ErrDoubleSpend to indicate
it was not propagated.
2019-09-25 08:04:04 +02:00
Johan T. Halseth 96ebce6842 go mod: update btcwallet dependency
We update to a new version of btcwallet where specific errors
(ErrDoubleSpend and ErrReplacement) will be returned from
PublishTransaction.
2019-09-25 08:03:21 +02:00
Johan T. Halseth 7897b96e6a lnwallet/interface_test: extract local utility functions
In preparation for extending the testPublishTransaction test, shorten it
by moving utility methods out of the local scope.
2019-09-25 08:01:42 +02:00
Johan T. Halseth 9f3fbda71f fundingmanager: remove unnecessary Peer param to sendFundingLocked 2019-09-24 21:24:40 +02:00
Johan T. Halseth 5b8e97da29 funding: update comment aboute offline peers
Since fundingLocked now are being sent reliably, the only message left
to be sent reliably is the node announcement for private channels.
2019-09-24 21:24:40 +02:00
Johan T. Halseth 9ff6de5be1 funding: add TODO for consistency check 2019-09-24 21:24:39 +02:00
Johan T. Halseth bda0e40dad fundingmanager: save markedOpen before marking the channel open
This commit fixes a potential issue within the fundingmanager, where
failing to write the channel opening state could cause the channel being
marked open in the DB, but the opening state not being set. On startup
this would cause the channel state machine to not be able to resume.

We fix this by saving the channel opening state _first_. This works
because saving the opening state is idempotent, and in case a channel is
found pending at startup, it will re-register for confirmation
notifications and re-do the process.
2019-09-24 21:24:39 +02:00
Johan T. Halseth 88f5e06427 fundingmanager: unify handling of pending and non-pending channels at startup
Since the advanceFundingState now can handle pending channels, we'll
call it for both pending and non-pending channels, just making sure that
we re-initialize the channel barriers and re-publish the funding tx fro
pending channels.
2019-09-24 21:24:39 +02:00
Johan T. Halseth 8a61af6a55 fundingmanager: make advanceFundingState handle pending channels
This commit makes advanceFundingState check whether a channel is still
pending before checking the channel opening state. This lets us call it
directly, without checking whether a channel has confirmed first.
2019-09-24 21:24:39 +02:00
Johan T. Halseth 30614d3840 funding tests: increase epoch channel buffer
Since the initiator no longer registers for block epochs, we increase
the buffer on the mocked channel to not block during tests.
2019-09-24 21:24:39 +02:00
Johan T. Halseth 893c6cbc59 fundingmanager: make waitForFundingTimeout sync
This commit makes the waitForFundingTimeout method synchronous, and
return ErrConfirmationTimeout in case the timeout is reached.

We also simplify the internals by using waitForTimout defined earlier.
2019-09-24 21:24:35 +02:00
Johan T. Halseth 47fae26dc4 fundingmanager: define method waitForTimeout
This commit defines a new method waitForTimeout, that will be used to
listen for channels timing out. It handles a subset of what is already
handled by waitForFundingWithTimeout, but we want to break that one up
in smaller parts, and waitForTimeout is the first of these.
2019-09-24 21:24:34 +02:00
Johan T. Halseth ea196f6e8f fundingmanager make waitForFundingConfirmation decrement waitgroup
Since waitForFundingConfirmation is always called in a goroutine, we
make this explicit by requireing the caller to always increment the
waitgroup before calling it.
2019-09-24 21:24:34 +02:00
Johan T. Halseth 76857dbcdc fundingmanager: move handleFundingConfirmation out of waitForFundingWithTimeout
Similarly to what we did in the previous commit, we move the
responsibility of marking the channel open by calling
handleFundingConfirmation out from waitForFundingWithTimeout to the
caller.
2019-09-24 21:24:34 +02:00