Commit Graph
100 Commits
Author SHA1 Message Date
Olaoluwa Osuntokun 5ef1f85998 Merge pull request #3578 from wpaulino/no-freelist-sync-option
config: add sync freelist cli flag
2019-10-04 15:16:30 -07:00
Olaoluwa Osuntokun 52c933ed28 Merge pull request #3576 from Roasbeef/chain-action-cnct-supplement-fix
contractcourt: use legacy chain actions of commitSet not found
2019-10-04 15:04:32 -07:00
Olaoluwa Osuntokun 5c154febcc Merge pull request #3575 from cfromknecht/disable-str-custom-tlvs
lnrpc+routerrpc: disable custom tlv records via rpc
2019-10-04 12:34:12 -07:00
Olaoluwa Osuntokun c03fb8aca0 Merge pull request #3561 from Roasbeef/chan-validation-cleanup
chanvalidate: create new channel validation package
2019-10-04 12:32:07 -07:00
Olaoluwa Osuntokun 7a491776a1 contractcourt: use legacy chain actions of commitSet not found
In this commit, we fix a bug that would prevent users that had
unresolved contracts at the time of update from starting their nodes.
Before we added the conf commit set, the information needed to
supplement the resolvers was found in the chain action map. As a result,
if the conf commit set is nil, then we also need to check this legacy
data to ensure that we can supplement the resolvers to the best of our
ability based on the available data.

Fixes #3549.
2019-10-04 12:30:55 -07:00
Olaoluwa Osuntokun d6bbb11cac README: update dev slack link 2019-10-03 21:43:14 -07:00
Olaoluwa Osuntokun 46cecb2461 Merge pull request #3545 from Roasbeef/reproducible-builds
build/release: create new release package for reproducible builds
2019-10-03 17:27:06 -07:00
Olaoluwa Osuntokun 0e41f07c47 build/release: create new release package for reproducible builds
In this commit, we create a new `build/release` package which houses the
build instructions and scripts that we need to do deterministic builds
across Windows, Linux, and MacOS.

With this new system, it's now possible for all `lnd` developers, as
well as users to verify the posted build binaries. This wasn't possible
in prior release as only in Go 1.13 did deterministic builds becomes
easier/possible. See the new `README.md` for further details.
2019-10-03 17:25:04 -07:00
Olaoluwa Osuntokun 0e13c5ac3f lnwallet+funding: expose new ValidateChannel method for 1st party validation
In this commit, we use the recently added `chanvalidate` package to
verify channels once they have been confirmed in the funding manager. We
expose a new method on the `LightningWallet` struct: `ValidateChannels`
which calls the new shared 1st party verification code.

After the channel is fully confirmed in the funding manager, we'll now
use this newly exposed method to handle all validation. As a result, we
can remove the existing validation code in the funding manager, and rely
on the new code in isolation.
2019-10-03 16:23:23 -07:00
Olaoluwa Osuntokun 6ebada112f routing: update 3d party channel verification to use new chanvalidate package
In the process of moving to use the new package, we no longer need to
fetch the outpoint directly, and instead only need to pass the funding
transaction into the new verification logic.
2019-10-03 16:23:17 -07:00
Olaoluwa Osuntokun c199ad30ac lnwallet/chanvalidate: create new channel validation package
In this commit, we create a new `chanvalidate` package which it to house
all logic required for 1st and 3rd party channel verification. 1st party
verification occurs when we find a channel in the chain that is
allegedly ours, while 3rd party verification will occur when a peer
sends us a channel proof of a new channel.

In the scope of the recent CVE, we actually fully verified 3rd party
channels, but failed to also include those checks in our 1st party
verification code. In order to unify this logic, and prevent future
issues, in this PR we move to concentrate all validation logic into a
single function. Both 1st and 3rd party validation will then use this
function. Additionally, having all the logic in a single place makes it
easier to audit, and also write tests against.
2019-10-03 16:23:14 -07:00
Olaoluwa Osuntokun 1e67040145 lnwallet: copy commitment transaction in getSignedCommitTx
In this commit, we move to make a full deep copy of the commitment
transaction in `getSignedCommitTx` to ensure that we don't mutate the
commitment on disk, possibly resulting in a "hot commitment".
2019-10-03 16:23:10 -07:00
Olaoluwa Osuntokun 450e5a7df4 Merge pull request #3568 from cfromknecht/correct-static-remote-key-feature-bits
lnwire/features: static_remote_key bits, 10/11 -> 12/13
2019-10-03 12:14:40 -07:00
Olaoluwa Osuntokun 113c4346b0 Merge pull request #3562 from cfromknecht/perm-peer-fixes
server: don't prune manual perm connections
2019-10-02 20:46:47 -07:00
Olaoluwa Osuntokun 1ea2aecd3c build: bump version to v0.8.0-beta 2019-09-25 19:19:08 -07:00
Olaoluwa Osuntokun e84fe8f947 Merge pull request #3358 from halseth/mainnet-neutrino
config: allow mainnet neutrino
2019-09-25 19:15:48 -07:00
Olaoluwa Osuntokun b1b4aab779 Merge pull request #3365 from Roasbeef/safu-commitments
multi: implement new safu commitment format
2019-09-25 19:13:56 -07:00
Olaoluwa Osuntokun c6ee42d3e2 chanbackup: create new Single version for tweakless commitment chans
In this commit, we create a new Single version for channels that use the
tweakless commitment scheme. When recovering from an SCB into an open
channel shell, we'll now check this field and use it to determine the
proper channel type. Otherwise, we may attempt to sweep the on chain
funds using the commitment point, when it goes directly to our key, or
the other way around.
2019-09-25 18:26:20 -07:00
Olaoluwa Osuntokun 6d97bcbacd lnwallet+contractcourt: publicly export DeriveCommitmentKeys use in chain watcher
In this commit, we consolidate the number of areas where we derive our
commitment keys. Before this commit, the `isOurCommitment` function in
the chain watcher used a custom routine to derive the expected
scripts/keys for our commitment at that height. With the recent changes,
we now have additional logic in `DeriveCommitmentKeys` that wasn't
copied over to this area. As a result, the prior logic would erroneously
detect if it was our commitment that had hit the chain or not.

In this commit, we remove the old custom code, and use
`DeriveCommitmentKeys` wihtin the chain watcher as well. This ensures
that we only need to maintain the key derivation code in a single place,
preventing future bugs of this nature.
2019-09-25 18:26:13 -07:00
Olaoluwa Osuntokun e497a07d64 lntest/itest: extend basic funding test to cover all tweakless commitment cases 2019-09-25 18:26:10 -07:00
Olaoluwa Osuntokun 8ce76fff51 lnrpc: add new StaticRemoteKey field to ListChannels output 2019-09-25 18:26:07 -07:00
Olaoluwa Osuntokun 2dddbc84d9 lncfg+lnd: gate usage of tweakless commitments based on local/global feature bits
In this commit, we add a new legacy protocol command line flag:
`committweak`. When set, this forces the node to NOT signal usage of the
new commitment format. This allows us to test that we're able to
properly establish channels with legacy nodes. Within the server, we'll
now gate our signalling of this new feature based on the legacy protocol
config. Finally, when accepting/initiating a new channel funding, we'll
now check both the local and remote global feature bits, only using the
new commitment format if both signal the global feature bit.
2019-09-25 18:26:04 -07:00
Olaoluwa Osuntokun 3f8526a0ca peer+lnpeer: add new methods to expose local+global features for lnpeer interface 2019-09-25 18:26:01 -07:00
Olaoluwa Osuntokun a58cfa65ff lnwallet+breacharbiter: update breach logic to be aware of new commitment format
In this commit, we update the brar logic in the channel state machine,
and also the brar itself to be aware of the new commitment format.
Similar to the unilateral close summary, we'll now blank out the
SingleTweak field in `NewBreachRetribution` if it's a tweakless
commitment. The brar will then use this to properly identify the
commitment type, to ensure we use the proper witness generation function
when we're handling our own breach.
2019-09-25 18:25:58 -07:00
Olaoluwa Osuntokun 4b65aea306 watchtower+htlcswitch: update client tower logic to recognize safu commitments
In this commit, we update the tower+link logic to tag a commitment as
the new (tweakless) format if it applies. In order to do this, the
BackupTask method has gained an additional parameter to indicate the
type of commitment that we're attempting to upload. This new tweakless
bool is then threaded through all the way to back up task creation to
ensure that we make the proper input.Input.

Finally, we've added a new test case for each existing test case to test
each case w/ and w/o the tweakless modifier.
2019-09-25 18:25:55 -07:00
Olaoluwa Osuntokun d22f2a1936 contractcourt: don't wait for DLP point if commit is tweakless on remote close
In this commit, we update the logic in the `chainWatcher` to no longer
wait until the DLP point has been populated in the database before we
dispatch the force close summary to any registered clients. Instead, we
can sweep immediately, as we have all the information we need to sweep
the funds (just our key).
2019-09-25 18:25:52 -07:00
Olaoluwa Osuntokun fdec603279 contractcourt: update the commitSweepResolver to be aware of tweakless commits
In this commit, we update the `commitSweepResolver` to be aware of
tweakless commitments. We'll now use the new behavior of the uni close
summary (leaving out the single tweak) to detect if we're dealing with a
new, or modern commitment. Depending on the commitment type, we'll then
set the witness type accordingly so we can generate the proper signature
within the sweeper.
2019-09-25 18:25:49 -07:00
Olaoluwa Osuntokun 0b62126067 multi: update funding workflow to be aware of new tweakless commits
In this commit, we update the funding workflow to be aware of the new
channel type that doesn't tweak the remote party's output within the
non-delay script on their commitment transaction. To do this, we now
allow the caller of `InnitChannelReservation` to signal if they want the
old or new (tweakless) commitment style.

The funding tests are also updated to test both funding variants, as
we'll still need to understand the legacy format for older nodes.
2019-09-25 18:25:46 -07:00
Olaoluwa Osuntokun b399203e71 lnwallet: update channel state machine to be aware of tweakless commits
In this commit, we update the channel state machine to be aware of
tweakless commits. In several areas, we'll now check the channel's type
to see if it's `SingleFunderTweakless`. If so, then we'll opt to use the
remote party's non-delay based point directly in the script, skipping
any additional cryptographic operations. Along the way we move the
`validateCommitmentSanity` method to be defined _before_ it's used as is
cutomary within the codebase.

Notably, within the `NewUnilateralCloseSummary` method, we'll now _blank
out_ the `SingleTweak` value if the commitment is tweakless. This
indicates to callers the witness type they should map to, as the value
isn't needed at all any longer when sweeping a non-delay output.

We also update the signing+verification tests to also test that we're
able to properly generate a valid witness for the new tweakless
commitment format.
2019-09-25 18:25:43 -07:00
Olaoluwa Osuntokun 21133e1856 channeldb: define new channel type, SingleFunderTweakless
In this commit, we define a new channel type: SingleFunderTweakless.
We'll use this channel type to denote channels with commitments that
don't tweak the remote party's key in their non-delay output.
2019-09-25 18:25:40 -07:00
Olaoluwa Osuntokun bee777ab5f input: update CommitSpendNoDelay to be aware of tweakless commits, add new witness type
In this commit, we update the `CommitSpendNoDelay` method to be aware of
the alternate spending mechanism for commitments that don't have a tweak
for the remote party's non-delay output. We also add a new witness type
so callers can convey their expected signing path.
2019-09-25 18:25:37 -07:00
Olaoluwa Osuntokun a9541b8f6a lnwire: define new feature bits for commitment's with tweakless remote outputs 2019-09-25 18:25:32 -07:00
Olaoluwa Osuntokun c57bb9d86b Merge pull request #3480 from Roasbeef/proper-resolution-supplements
contractcourt: supplement resolvers with confirmed commit set HTLCs
2019-09-25 17:08:35 -07:00
Olaoluwa Osuntokun 0c076bf82a Merge pull request #3016 from halseth/republish-close-tx-on-startup
[contractcourt] Republish close tx on startup
2019-09-25 16:45:48 -07:00
Olaoluwa Osuntokun 1e456a6bc9 Merge pull request #3535 from cfromknecht/link-updater-refactor
peer: link updater refactor
2019-09-25 16:37:40 -07:00
Olaoluwa Osuntokun 820cd2a875 Merge pull request #3540 from wpaulino/wtclient-docs
docs: update watchtower docs to include wtclientrpc info
2019-09-25 16:33:01 -07:00
Olaoluwa Osuntokun b1d122773e Merge pull request #1910 from halseth/fundingmanager-state-machine
Fundingmanager state machine cleanup
2019-09-25 16:31:51 -07:00
Olaoluwa Osuntokun e0d7854432 Merge pull request #3039 from Crypt-iQ/predicate_channel_accept_0428
rpc: bi-directional streaming for predicate-based channel acceptance
2019-09-25 16:29:48 -07:00
Olaoluwa Osuntokun 16941d7aad build: nerf linter 2019-09-25 16:05:31 -07:00
Olaoluwa Osuntokun d0df5a4ddd contractcourt: supplement resolvers with confirmed commit set HTLCs
In this commit, we fix an existing bug in the package, causing
resolutions to be restarted without their required supplementary
information. This can happen if a distinct HTLC set gets confirmed
compared to the HTLCs that we may have had our commitment at time of
close. Due to this bug, on restart certain HTLCS would be rejected as
they would present their state to the invoice registry, but be rejected
due to checks such as amount value.

To fix this, we'll now pass in the set of confirmed HTLCs into the
resolvers when we re-launch them, giving us access to all the
information we need to supplement the HTLCS.

We also add a new test that ensures that the proper fields of a resolver
are set after a restart.
2019-09-25 16:05:25 -07:00
Olaoluwa Osuntokun c3bf8d2054 contractcourt: create new channel arb test context struct
In this commit, we create a new channel arb test context struct as the
current `createTestChannelArbitrator` has several return parameters, and
upcoming changes will likely at first glance need to add one or more
additional parameters. Rather than extend the existing set of return
parameters, we opt to instead create this struct that wraps the existing
state.

Along the way we add several new utility methods to this context, and
use them in the existing tests where applicable:
  * `AssertStateTransitions`
  * `AssertState`
  * `Restart`
  * `CleanUp`
2019-09-25 16:05:21 -07:00
Olaoluwa Osuntokun 46e0117a4f Merge pull request #3543 from jonathancross/readme-gpg-link
README: Fixing link to gpg key for security@lightning.engineering
2019-09-25 14:47:46 -07:00
Olaoluwa Osuntokun 18f88cbd8d Merge pull request #3440 from joostjager/buildroute
routing: add build route functionality
2019-09-24 20:24:24 -07:00
Olaoluwa Osuntokun fa063dd45c Merge pull request #3536 from guggero/queue-tidy
lnd+queue: specify go 1.12 in all go.mod files
2019-09-24 17:50:42 -07:00
Olaoluwa Osuntokun 9b1ecbd3fa Merge pull request #2485 from halseth/error-codes-dont-send
[lnwire+funding] Don't send ErrorCode on wire
2019-09-23 17:50:27 -07:00
Olaoluwa Osuntokun 9da8951cf0 Merge pull request #3523 from joostjager/enable-update-max-htlc
multi: enable max htlc update
2019-09-23 17:42:22 -07:00
Olaoluwa Osuntokun 20a5ee2f1e Merge pull request #3519 from LightningK0ala/patch-4
Update Dockerfile go version to 1.13
2019-09-19 18:27:06 -07:00
Olaoluwa Osuntokun 796308a8a5 Merge pull request #3524 from fguisso/config-file
config: fix configfile flags
2019-09-19 18:25:42 -07:00
Olaoluwa Osuntokun c978ebc7ac Merge pull request #3369 from cfromknecht/eligible-to-forward-reestablish
htlcswitch/link: remove channel_reestablish timeout
2019-09-19 18:23:50 -07:00
Olaoluwa Osuntokun f36a47e065 Merge pull request #3525 from cfromknecht/trimpath-for-release-only
Makefile+release: only use -trimpath on release script
2019-09-19 18:02:10 -07:00
Olaoluwa Osuntokun c69fc35a8e Merge pull request #3515 from cfromknecht/default-wtclientrpc
make: compile wtclientrpc by default
2019-09-18 21:54:20 -07:00
Olaoluwa Osuntokun 003c576406 Merge pull request #3513 from halseth/lint-skip-generated
[trivial] lint: skip generated files
2019-09-18 21:51:16 -07:00
Olaoluwa Osuntokun e6cd88e1bb Merge pull request #3512 from halseth/chanarb-breach-close
[contractcourt] Gracefully advance channel arbitrator state machine on breach
2019-09-18 21:42:15 -07:00
Olaoluwa Osuntokun 53925a889e Merge pull request #3522 from Roasbeef/rescan-fix-neutrino
build: update to latest version of neutrino
2019-09-18 21:10:08 -07:00
Olaoluwa Osuntokun 484e6df6a7 build: update to latest version of neutrino
In this commit, we update to the latest version of neutrino with a
series of important bug fixes in the core rescan logic.
2019-09-18 20:29:51 -07:00
Olaoluwa Osuntokun baa235c240 Merge pull request #3521 from cfromknecht/make-no-update
Makefile: remove -u when installing go-acc, consolidate dep installation
2019-09-18 16:37:13 -07:00
Olaoluwa Osuntokun cd3c2b508e Merge pull request #3511 from lieteau2/patch-1
Rename chainnotifer_server.go to chainnotifier_server.go
2019-09-17 03:19:18 +03:00
Olaoluwa Osuntokun 550a7a0729 Merge pull request #3485 from joostjager/remove-migrations
channeldb: remove older migrations
2019-09-14 11:23:01 +03:00
Olaoluwa Osuntokun 7b1166bbb7 Merge pull request #3458 from Roasbeef/go1.13
build: update travis and Makefile to build using Go 1.13
2019-09-14 11:18:51 +03:00
Olaoluwa Osuntokun 9f1c6e9394 build: update to latest version of lightning-onion 2019-09-11 05:57:08 -07:00
Olaoluwa Osuntokun 5ecde6d552 lnwallet+chainntnfs: update to use latest neutrino APIs 2019-09-11 05:57:06 -07:00
Olaoluwa Osuntokun 5fc003d6a1 build: update to latest versions of btcwallet and neutrino 2019-09-11 05:57:05 -07:00
Olaoluwa Osuntokun 6691c039ec docs: update docs to build using go 1.13 2019-09-11 05:56:47 -07:00
Olaoluwa Osuntokun a4e2bb47d2 build: update travis to build against go 1.13
In this commit, we update Travis to start building against the newly
released go 1.13. Additionally, we'll now utilize the new `trimpath` to
the `go build` and `go install` commands. This new flag serves to remove
all file system paths from the compiled Go executable, which will make
our binaries more reproducible.
2019-09-11 05:54:33 -07:00
Olaoluwa Osuntokun 2cf10ada0f Merge pull request #3465 from cfromknecht/tlv-parsed-types
tlv+htlcswitch: validate presence/omission of parsed onion payload types
2019-09-09 05:42:03 -07:00
Olaoluwa Osuntokun 330de2b174 Merge pull request #3483 from Roasbeef/migration-9-test-fix
channeldb: ensure test for migration 9 is fully enclosed
2019-09-09 05:41:25 -07:00
Olaoluwa Osuntokun 62dcc4b7d5 channeldb: ensure test for migration 9 is fully enclosed
In this commit, we ensure that the test for migration 9 uses the same
encoding/decoding functions as was present in the repo when the
migration was first added. Otherwise, the test will fail as it'll try to
use the decoding functions of master (migration 10 and onwards) rather
than the decoding function of migration 9.
2019-09-09 03:57:52 -07:00
Olaoluwa Osuntokun 1f92b7587c Merge pull request #3468 from joostjager/move-onion-processor
htlcswitch: move hop iterator into htlcswitch/hop package
2019-09-09 03:29:41 -07:00
Olaoluwa Osuntokun 918fd9e8ff Merge pull request #3282 from halseth/mobile-rpcs
[mobile] Mobile RPCs
2019-09-09 02:23:26 -07:00
Olaoluwa Osuntokun acb38a8b8b Merge pull request #3479 from Roasbeef/migration-9-10-fix-min-version
channeldb: fix migration bug due to interplay between migration #9 an…
2019-09-09 02:20:49 -07:00
Olaoluwa Osuntokun 754809406d channeldb: fix migration bug due to interplay between migration #9 and #10
In this commit, we fix an issue that was recently introduced as a result
of migration #10. The new TLV format ended up modifying the
serialization functions called in `serializePaymentAttemptInfo`.
Migration #9, also used this `serializePaymentAttemptInfo` method to
serialize the _new_ (pre TLV, but new payment attempt structure) routes
into the database during its migration. However, migration #10 failed to
copy over the existing unmodified `serializePaymentAttemptInfo` method
into the legacy serialization for migration #9. As a result, once
migration #9 was run, the routes/payments were serialized using the
_new_ format, rather than the format used for v0.7.1. This then lead to
de-serialization either failing, or causing partial payment corruption
as migration #10 was expecting the "legacy" format (no TLV info).

We fix this issue by adding a new fully enclosed
`serializePaymentAttemptInfoMigration9`method that will be used for
migration #9. Note that our tests didn't catch this, as they test the
migration in isolation, rather than in series which is how users will
encounter the migrations.

Fixes #3463.
2019-09-09 02:16:13 -07:00
Olaoluwa Osuntokun 866867a4b0 Merge pull request #3401 from wpaulino/channel-initiator-max-fee
htlcswitch: avoid proposing fee updates exceeding max fee allowed
2019-09-04 20:38:52 -07:00
Olaoluwa Osuntokun b43a9f2e20 Merge pull request #1583 from halseth/multibackend-integration-test
[itests] Bitcoind integration test
2019-09-04 20:12:26 -07:00
Olaoluwa Osuntokun 00682584aa Merge pull request #3441 from cfromknecht/truncated-sid
htlcswitch+routing: omit next_hop_id in final hop payload
2019-09-04 19:55:38 -07:00
Olaoluwa Osuntokun 7eca7b02a6 Merge pull request #3390 from joostjager/invoice-circuits
channeldb+cnct+invoices: track invoice htlcs
2019-09-04 19:51:37 -07:00
Olaoluwa Osuntokun c397a2ea78 Merge pull request #3438 from alrs/fix-cmd-error
cmd/lncli: Fix dropped error
2019-09-03 19:59:30 -07:00
Olaoluwa Osuntokun 78c1c4930e Merge pull request #3455 from wpaulino/cli-missing-chan-backup
cmd/lncli: return error upon missing channel backup when parsing
2019-09-03 19:39:12 -07:00
Olaoluwa Osuntokun b592760eee Merge pull request #3456 from wpaulino/pending-waiting-close-channel-fields
rpc: populate missing fields for waiting close channels
2019-09-03 19:35:49 -07:00
Olaoluwa Osuntokun 3868bdc490 Merge pull request #3405 from wpaulino/chainrpc-sane-defaults
chainntnfs: validate conf/spend ntfn registration parameters
2019-08-26 16:25:06 -07:00
Olaoluwa Osuntokun ebb3e987b1 lnrpc/routerrpc: complete JSON naming for mc responses 2019-08-23 16:36:35 -07:00
Olaoluwa Osuntokun 557083c41b Merge pull request #3372 from joostjager/mc-successes
routing: process payment successes in mission control
2019-08-23 16:33:18 -07:00
Olaoluwa Osuntokun 441b15055b channeldb: properly compare payment attempts in serialization test 2019-08-23 12:50:25 -07:00
Olaoluwa Osuntokun 64c7a0faa8 Merge pull request #3362 from Roasbeef/tlv-onion-payload
multi: update the switch+router to be aware of the new TLV EOB format
2019-08-22 19:10:19 -07:00
Olaoluwa Osuntokun b1aea41d20 lntest/itest: force dave to use the legacy onion payload in multi-hop pay test
In this commit, we force Dave to use the legacy onion payload for the
multi-hop test to ensure that we're able to properly mix the old and new
formats, and have all nodes properly decode+forward the HTLC.
2019-08-22 18:53:10 -07:00
Olaoluwa Osuntokun 653d557fec config: add new legacy protocol build tag protected sub-config for legacy onion
In this commit, we add a new build tag protected sub-config for legacy
protocol features. The goal of this addition is to be able to default to
new feature within lnd, but expose hooks at the config level to allow
integration tests to force the old behavior to ensure that we're able to
support both the old+new versions.
2019-08-22 18:53:08 -07:00
Olaoluwa Osuntokun 1345ca2038 server: set new optional global TLV feature bit by default 2019-08-22 18:53:07 -07:00
Olaoluwa Osuntokun 9145c0fd38 lnwire: add new TLV onion feature bits 2019-08-22 18:53:06 -07:00
Olaoluwa Osuntokun 23cc8389f2 multi: add TLV awareness to htlcswitch, pass extra EOB to the invoice registry
In this commit, we update the `HopIterator` to gain awareness of the new
TLV hop payload. The default `HopIterator` will now hide the details of
the TLV from the caller, and return the same `ForwardingInfo` struct in
a uniform manner. We also add a new method: `ExtraOnionBlob` to allow
the caller to obtain the raw EOB (the serialized TLV stream) to pass
around.

Within the link, we'll now pass the EOB information into the invoice
registry. This allows the registry to parse out any additional
information from the EOB that it needs to settle the payment, such as a
preimage shard in the AMP case.
2019-08-22 18:53:05 -07:00
Olaoluwa Osuntokun c78e3aaa9d channeldb: update route.Hop serialization to include new EOB related fields
We also include a migration for the existing routes stored on disk.
2019-08-22 18:53:04 -07:00
Olaoluwa Osuntokun 763cb6c09d lnrpc+lnrpc/routerrpc: add a new TLV record field to the Hop proto
In this commit, we add a new field to the Hop proto to allow callers to
be able to specify TLV records for the SendToRoute call, and also to be
able to display TLV records that were used during regular path finding.

We also update SendPayment to support dest TLV records.
2019-08-22 18:53:03 -07:00
Olaoluwa Osuntokun 4697cfde30 routing: extend path finding to be TLV-EOB aware, allow dest TLV records
In this commit, we extend the path finding to be able to recognize when
a node needs the new TLV format, or the legacy format based on the
feature bits they expose. We also extend the `LightningPayment` struct
to allow the caller to specify an arbitrary set of TLV records which can
be used for a number of use-cases including various variants of
spontaneous payments.
2019-08-22 18:53:01 -07:00
Olaoluwa Osuntokun 5b4c8ac232 routing/route+tlv: add new TLV-EOB awareness to Hop+Route
In this commit, we extend the Hop struct to carry an arbitrary set of
TLV values, and add a new field that allows us to distinguish between
the modern and legacy TLV payload.

We add a new `PackPayload` method that will be used to encode the
combined required routing TLV fields along any set of TLV fields that
were specified as part of path finding.

Finally, the `ToSphinxPath` has been extended to be able to recognize if
a hop needs the modern, or legacy payload.
2019-08-22 18:53:00 -07:00
Olaoluwa Osuntokun e60b36751c tlv: display the unknown primitive type in MakePrimitiveRecord error message 2019-08-22 18:52:59 -07:00
Olaoluwa Osuntokun aea529d9f6 tlv: add new Type() and Encode() methods to Record
In this commit, we add two new method so the `Record` struct: Type() and
Encode(). These are useful when a caller is handling a record and may
not know its underlying type and may need to encode a record in
isolation.
2019-08-22 18:52:58 -07:00
Olaoluwa Osuntokun ac6f56566e build: point to latest lightning-onion w/ EOB support 2019-08-22 18:52:53 -07:00
Olaoluwa Osuntokun 0a5080c144 Merge pull request #3424 from cfromknecht/tlv-limit-decode
tlv: limit decoded record size
2019-08-21 18:17:38 -07:00
Olaoluwa Osuntokun 216d1e8017 Merge pull request #3419 from Roasbeef/sign-create-key-if-not-found
lnwallet: when signing create account if not found
2019-08-20 20:53:01 -07:00
Olaoluwa Osuntokun cc4daa04ad lnwallet: when signing create account if not found
In this commit, we address an edge case that can happen a user rescans
w/ their seed, while retaining their existing `channel.db`. Once they
rescan, if they go to sign for a channel sweep for example, the
commitment key family (actually an account) may not yet have been
created, causing the signing attempt to fail.

We remedy this always creating the account if we go to sign, and the
account isn't found. The change has been structured to make this the
exception, so we'll avoid always needing to do 2 DB hits (check if
account exists, sign), each time we sign.

A new test has been added to exercise this behavior. If the diff from
the `signer.go` file is removed, then the test will fail.
2019-08-20 19:08:03 -07:00
Olaoluwa Osuntokun 2f8d3c4526 Merge pull request #3256 from joostjager/failure-attribution
routing: failure attribution
2019-08-20 16:53:56 -07:00
Olaoluwa Osuntokun 701244012a Merge pull request #3402 from joostjager/remove-debug-invoice
multi: remove debug invoices
2019-08-19 18:42:34 -07:00