Commit Graph

10103 Commits

Author SHA1 Message Date
niftynei 3a7b3762a1 hsmd: method to sign liquidity ad offer
When we accept a bid to create a channel lease, we send back a signature
committing to our max channel lease amounts.
2021-07-20 13:28:38 -04:00
niftynei b1982f04be amount: add 'is_zero' helper
convenience, mostly
2021-07-20 13:28:38 -04:00
niftynei 3ae64efbe4 tests: add test for setting/updating node announce
Make sure everything updates/flows through as expected.
2021-07-20 13:28:38 -04:00
niftynei 13e4a72188 contrib: offer a liquidity-ad lease in developer mode 2021-07-20 13:28:38 -04:00
niftynei 9387e4645b funder-liqudity-ads: support options + setliquidity ad
Implement support for liquidity ads in `funder` plugin. We set the
command line options for the leases, as well as sending the updated ads
to lightningd (who then passes them through to gossipd)
2021-07-20 13:28:38 -04:00
niftynei 9431984cef funder_policy: set default to 0
As we move to advertising liquidity, set the default to not have any
fuzz. This means we won't randomly reject an offer to buy liquidity.
2021-07-20 13:28:38 -04:00
niftynei d6b302b52f funder: make policy a pointer, most places 2021-07-20 13:28:38 -04:00
niftynei 9e839b177c gossipd: turn off lease offers if the rates are empty
If received lease rates are empty (all zeroes), turn them off
2021-07-20 13:28:38 -04:00
niftynei c934fe095b libplugin: add u16_option parsing
A couple of the fields for liquidity_ads are u16
2021-07-20 13:28:38 -04:00
niftynei f668e72dd6 option_will_fund: print out lease rates in listnodes
Note that we use the names from the spec.

Changelog-Experimental: JSON-RPC: `listnodes` now includes the `lease_rates`, if available
2021-07-20 13:28:38 -04:00
niftynei 876ff6821e setleaserates: new RPC to pass in lease rates
Changelog-Experimental: JSON-RPC: new RPC `setleaserates`, for passing in the rates to advertise for a channel lease (option_will_fund)
2021-07-20 13:28:38 -04:00
niftynei 48d244c304 gossipd: signal whether node_ann is updated, are we starting up?
If there's a rate-card for liquidity, we don't know about it until
after startup (the plugin *should* call us at init to tell us what their
current rates are)
2021-07-20 13:28:38 -04:00
niftynei 55f5a5caba gossip/liquidity-ad: node_ann comparison, optional TLV check
Correctly mark whether or not the TLV's are the same/different, given two
node announcements
2021-07-20 13:28:38 -04:00
niftynei 49bae2a873 lease_rates: parse them out of node_announcements
When we get a node announcement out, we can now pull out its offer
characteristic
2021-07-20 13:28:38 -04:00
niftynei 5b3c02f401 liquidity-ads: import from spec
Import the wires from spec. Here we go!
2021-07-20 13:28:38 -04:00
niftynei 376e6f8bd1 dual-funding: update fee_step to be a feerate
Using a 'feestep' is more restrictive than you'd want, instead we
enforce that the next feerate must be at least 1/64th more than the
last, but put no upper limit on it

Includes update to lnprototest changes

Contributed-By: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Changelog-EXPERIMENTAL: Protocol: Replaces init_rbf's `fee_step` for RBF of v2 opens with `funding_feerate_perkw`, breaking change
2021-07-19 16:13:24 -04:00
niftynei 04b6ad06cb change fees: more accurate rounding for change amount
We were getting off-by-one for the total amount that the change is for,
since it rounds the fee *down*, independent of the total weight of the
entire tx.

We fix this by using the diff btw the fee of the total weight (w/ and
w/o the change output)
2021-07-19 16:13:24 -04:00
Rusty Russell 914e3dd082 Github actions: reduce lnprototest.
Setting VALGRIND=1 actually does nothing here; reduce it to two cases,
covering gcc and clang, sqlite3 and postgres.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-19 14:44:37 -04:00
nathanael 3ebf2325f3 chore: add 3 gpg pubkeys of maintainers to the repository
changelog-none - closes #4393
2021-07-19 13:22:33 +09:30
nathanael 3e10099725 docs: fix typo and wording
changelog-none
2021-07-19 12:49:08 +09:30
LightningHelper dbb7f31d39 added minimum word list needed
Not every user know the minimum word list that is needed.
2021-07-19 12:47:11 +09:30
LightningHelper 3ec2167590 improve hsm_secret doc 2021-07-19 12:45:44 +09:30
Michael Schmoock 896da4fc65 pytest: rescan restarts plugin on update 2021-07-15 13:26:05 -04:00
Michael Schmoock ec9693863d plugin: rescan restarts plugin on update
This adds a `u32 checksum` field to the plugin struct that is used
to identify if a plugin is outdated and needs to be restarted on `rescan`.

Note: Only affects non-important plugins.

Changelog-Added: Plugin: Restart plugin on `rescan` when binary was changed.
2021-07-15 13:26:05 -04:00
Christian Decker 0f18f203e2 pytest: Add a `keysend` test that includes `routehints` 2021-07-15 12:13:06 -04:00
Christian Decker 94d11d1f9f keysend: Add `routehints` argument to the `keysend` command
So far we could not reach non-publicly reachable nodes with the
keysend command since we couldn't compute a route to them. With this
change we can add some routehints that we may have gotten from an
address book or a previous invoice, and make it more likely that we
can reach the destination.

Changelog-Added: keysend: `keysend` can now reach non-public nodes by providing the `routehints` argument if they are known.
2021-07-15 12:13:06 -04:00
Christian Decker 415c2bfe3c jsonrpc: Add parsers for routehint-arrays
We'll start passing routehints manually to keysend to reach non-public
nodes as well.
2021-07-15 12:13:06 -04:00
Christian Decker ce66466cfb opts: Add option to register extra TLV types to accept
Incoming HTLCs are rejected by the HTLC logic if the payload contains
an even type that `lightningd` doesn't recognize. This is to prevent
us from accidentally accepting a payment that has extra semantics
attached (for example if we get a keysend payment and don't know what
to do with the TLV field containing the message we should reject it,
otherwise the overall semantics of the message delivery fail).
2021-07-15 12:13:06 -04:00
niftynei 8654c817da sendcustommsg: promote to non-dev
Enable non-dev builds to send custom messages.

Preserves 'dev-' for compat-enabled builds.

Changelog-Changed: JSON-RPC: moved dev-sendcustommsg to sendcustommsg
2021-07-14 14:39:44 -05:00
Rusty Russell 28553e9bea route: assume modern TLV support if we don't see a node_announcement.
This is in preparation for removing support (next release?).

Changelog-Changed: Protocol: We now assume nodes support TLV onions (non-legacy) unless we have a node_announcement which says they don't.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-14 14:38:00 -05:00
Rusty Russell e7716c86fb lightningd: insist on payment_secret if bit compulsory on invoices.
This grandfathers in old invoices for the moment.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-14 14:38:00 -05:00
Rusty Russell 9eb531868f lightningd: make invoices insist on payment_secret.
In fact, we make it compulsory, which means if you don't understand it
you'll hang up on us!

Add some logging for that in future.

Changelog-Changed: Protocol: All new invoices require a payment_secret (i.e. modern TLV format onion)
Changelog-Changed: Protocol: We can no longer connect to peers which don't support `payment_secret`.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-14 14:38:00 -05:00
Rusty Russell 8f86b45f26 pytest: make test_sendonion_rpc use a TLV onion for final hop.
It's going to be compulsory soon!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-14 14:38:00 -05:00
Rusty Russell ed30dad7ca plugins/keysend: add the payment_secret to the payload.
It's about to become compulsory.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-14 14:38:00 -05:00
Rusty Russell 4e881e56ce pytest: always provide payment_secret when making payments.
They're about to become compulsory.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-14 14:38:00 -05:00
Rusty Russell 3f5d5a1de5 invoice: output payment_secret in JSON.
This makes it easier to access (rather than decoding bolt11).

Changelog-Added: JSON-RPC: `invoice` now outputs explicit `payment_secret` it its own field.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-14 14:38:00 -05:00
Michael Schmoock 246d230486 pytest: listchannels filter by destination 2021-07-14 14:34:00 -05:00
Michael Schmoock 0f5aab2b3c doc: listchannels filter by destination 2021-07-14 14:34:00 -05:00
Michael Schmoock 89c45b379a pyln: rpc support for listchannels by destination 2021-07-14 14:34:00 -05:00
Michael Schmoock fc238bc61c topology: listchannels by destination
Changelog-Added: JSON-RPC: Have `listchannels` also be queried by `destination`.
2021-07-14 14:34:00 -05:00
Rusty Russell 6aaecbc7b3 plugins/offers: fix crash when we report unpaid prev invoice.
And add annotation so compiler spots it!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-14 14:33:18 -05:00
Rusty Russell 2aa833d424 doc: fix up bolt12 quotes.
The one about size needs the offers PR rebased onto the latest
onion-message PR.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-14 14:33:18 -05:00
Rusty Russell 3b40bfa801 bolt12_merkle: change offer merkle to latest spec.
And fix up the mess we'd made:
1. We didn't order merkles by lesser-first.
2. We didn't correctly construct tree with last nodes on shortest path.

Now we have tests!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-EXPERIMENTAL: protocol: offer signature format changed.
2021-07-14 14:33:18 -05:00
Rusty Russell a29847f0c6 DEVELOPER: allow fetchinvoice to force they payer_secret.
We usually assume we're fetching an invoice we are going to pay, so we
look up the previous payment for the payer key, and other sanity
checks.

This adds a developer option to fetchinvoice, which allows it to force
its own payer key, which it uses to sign directly and bypasses these
checks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-14 14:33:18 -05:00
Rusty Russell d4c441f1d7 offers: don't crash in decode if there's no signature on the offer.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-14 14:33:18 -05:00
Rusty Russell 424ac84263 patch remove-payer-backcompat.patch 2021-07-14 14:33:18 -05:00
niftynei e4e1396447 tests: update coin movements for dual-funded mutual closes
This bug originated in 8f33f46960,
which updates the closing fee calculations.
2021-07-11 10:41:08 +09:30
niftynei bc7bbaa50d tests: update deprecated 'funding_msat' for new output format 2021-07-11 10:41:08 +09:30
niftynei 1d5a00e547 schema: fixup for dual-funding things 2021-07-11 10:41:08 +09:30
niftynei e733e3210e schema: add 'funding_outnum' to openchannel_update schema 2021-07-11 10:41:08 +09:30