Commit Graph

5434 Commits

Author SHA1 Message Date
lisa neigut d51ad50032 tlv: add tlv field's type enums to header file
Version 1.1 of the lightning-rfc spec introduces TLVs for optional
data fields. This starts the process of updating our auto-gen'd
wireformat parsers to be able to understand TLV fields.

The general way to declare a new TLV field is to add a '+' to the
end of the fieldname. All field type declarations for that TLV set
should be added to a file in the same directory by the name
`gen_<field_name>_csv`.

Note that the FIXME included in this commit is difficult to fix, as
we currently pass in the csv files via stdin (so there's no easy
way to ascertain the originating directory of file)
2019-04-03 03:15:42 +00:00
Jeff Vandrew Jr 1130100f67 Remove Sensitive RPC Data from Logs (#2520)
Fixes: #2424
2019-04-03 03:06:06 +00:00
Christian Decker f3c234529e gossip: Cache txout query failures
If we asked `bitcoind` for a txout and it failed we were not storing that
information anywhere, meaning that when we see the channel announcement the
next time we'd be reaching out to `lightningd` and `bitcoind` again, just to
see it fail again. This adds an in-memory cache for these failures so we can
just ignore these the next time around.

Fixes #2503

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-04-01 23:54:19 +00:00
Rusty Russell 6765423393 Documentation: Update to BOLT v1.0.
Mainly typo fixes, but we removed the INCORRECT_PAYMENT_AMOUNT error
altogether.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-04-01 13:22:05 +02:00
lisa neigut f48fe03815 plugins: patch in empty string when no default given
If a plugin fails to pass in a default value for an option,
c-lightning crashes. this fixes the crash.

Patches #2515
2019-03-31 20:07:27 +02:00
Jeff Vandrew Jr 02ddeed2a7 Clean Up Case #5 in Tor Documentation
Case 5 in the Tor documentation currently states that if you use `--bind-addr=autotor:127.0.0.1:9051`, you can get your onion address by running `lightning-cli getinfo`. I have not found that to be the case; with that flag no onion address will be generated.

On the other hand, if `--addr=autotor:127.0.0.1:9051` is used instead, an onion address is generated and `lightning-cli getinfo` behaves as the docs say.
2019-03-29 20:05:04 -07:00
Richard Bondi 901bd7c1c3 allow plugin opts in config 2019-03-28 13:47:27 +01:00
Christian Decker 426b22fdcb gossip: Bump `gossip_getnodes_reply` result count to be u32 as well
Otherwise we'll just have the same issue once we reach 65k nodes.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-03-27 12:48:52 +01:00
Christian Decker 25e829c7d1 gossip: Make the `listchannels` reply result count a u32
Fixes #2504

Signed-off-by: Christian Decker <decker.christian@gmail.com>
Reported-by: Antoine Le Calvez <@alecalve>
2019-03-27 12:48:52 +01:00
Christian Decker 3ce98ab7de wire: Allow non-u16 length variables in non-bolt wire formats
Otherwise we can't really return a variable sized message with more than 65k
results. This was causing an integer overflow in `listchannels` (see #2504 for
details).

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-03-27 12:48:52 +01:00
arowser b17b05b8ae correct tx_fee in 32bit system 2019-03-26 12:29:22 +01:00
andrewtoth 938addfba8 Cleanup tor doc 2019-03-25 18:52:31 +01:00
Douglas Schilling Landgraf 3852704c5c contrib: Dockerfile.builder.fedora bump fedora release
Updated Dockerfile to Fedora 29
2019-03-22 17:13:16 +01:00
nicolas.dorier 3e215287cd Use tini as docker entrypoint 2019-03-19 14:26:03 +01:00
Billy Garrison 99adea5988 pylightning: update getroute() docstring 2019-03-19 14:24:11 +01:00
Billy Garrison 132028bd7f pylightning: update getroute() parameters
Removes `seed` and adds `maxhops`
2019-03-19 14:24:11 +01:00
Rusty Russell a498b1fdbf pytest: fix flaky test_setchannel_fee_restart test.
gossipd in l1 might not have registered l2 reconnecting, thus considering
the channel local-disabled.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-19 14:22:27 +01:00
Michael Schmoock 1cd0ae1960 chore: command help for setchannelfee 2019-03-19 00:14:09 +00:00
Michael Schmoock f1add556d6 doc: setchannelfee 'all' feature 2019-03-19 00:14:09 +00:00
Michael Schmoock 162a97894d test: adds test_setchannelfee_all
- will also update old setchannelfee tests to new command output
2019-03-19 00:14:09 +00:00
Michael Schmoock 7b8ca7e877 feat: add option to setchannelfee for all channels
- This will make a channel loop when 'id' argument was "all".
- The response will now contain an array of objects (peer_id, scid, ...)
- It will skip channels in invalid states.
- Moves iffy channel/peer param stuff to param_channel_or_all
2019-03-19 00:14:09 +00:00
arowser 8e8f5bbaba correct messge format 2019-03-19 00:07:39 +00:00
trueptolemy 92c08cd861 Fix the version of bip32 private_key generation
We set the version BIP32_VER_TEST_PRIVATE for testnet/regtest
BIP32 privkey generation with libwally-core, and set
BIP32_VER_MAIN_PRIVATE for mainnet.
For litecoin, we also set it like bitcoin else.
2019-03-18 02:47:04 +00:00
arowser 04c60175ca compatible posfix sh 2019-03-17 03:47:38 +00:00
Rusty Russell 2af3996bea doc: document explicitly that you can use prefixes for setchannelfee 'base'
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-16 03:02:34 +00:00
Rusty Russell 0ed03648f4 lightningd: minor cleanups in setchannelfee parsing.
1. amount operations should force you to check validity, rather than
   needing a separate call, so make amount_msat_to_u32 return bool,
   and WARN_UNUSED_RESULT it.
2. Create a special parsing function for this; not only does this mean
   we now only need that one amount call, but also 'check' will correctly
   fail with invalid amounts (it only does the parsing step).
3. If we create a primitive which we immediately take(), we allocate it
   off NULL to make it clear we expect its lifetime to end here.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-16 03:02:34 +00:00
Michael Schmoock c7ab5102ba doc: adds manpage and changelog 2019-03-15 02:48:18 +00:00
Michael Schmoock 7e1cc2897c test: add tests for setchannelfee command
Goissp related tests are disabled for non-developers.
New setchannelfee testscases

* py.test -v tests/test_pay.py -k test_setchannelfee_usage
* py.test -v tests/test_pay.py -k test_setchannelfee_routing
* py.test -v tests/test_pay.py -k test_setchannelfee_state
* py.test -v tests/test_pay.py -k test_setchannelfee_zero
* py.test -v tests/test_pay.py -k test_setchannelfee_restart
2019-03-15 02:48:18 +00:00
Michael Schmoock 5d0390f637 json: add cmd setchannelfee and wire to channeld
* adds the channeld_specific_feerates wire message 1029
* adds a json command handler
* adds u32 access methods for amount_msat
2019-03-15 02:48:18 +00:00
Michael Schmoock ac0f925dee chore: add optional peer output pointer to command_find_channel function 2019-03-15 02:48:18 +00:00
Michael Schmoock 8594f6e369 htlc: forward channel specific fee settings 2019-03-15 02:48:18 +00:00
Michael Schmoock 1043df28be adds: new db fields and struct variables
- Intrduce DB update `channel` values: `feerate_base` and `feerate_ppm`
- Make fist use of now context realted DB migration
- Add `struct channel` members of the same name
- Use struct values instead of config when commiting new channels
2019-03-15 02:48:18 +00:00
Michael Schmoock 1853b399b0 fix: a pr2444 introduced valgrind complaint
This will add the testnet config copyNpaste to test_utils.c,
so that the test stups can set these.

Alternatively, to reduce code duplication, we can move the
testnet_config and mainnet_config from options.c to options.h.
2019-03-14 16:51:18 +01:00
Rusty Russell 9a25b5dd87 wireaddr: keep valgrind happy with wireaddr which are pathnames.
==12787== Uninitialised byte(s) found during client check request
==12787==    at 0x450AAC: memcheck_ (mem.h:247)
==12787==    by 0x450B17: towire (towire.c:19)
==12787==    by 0x45103D: towire_u8_array (towire.c:159)
==12787==    by 0x443235: towire_wireaddr_internal (wireaddr.c:79)
==12787==    by 0x46E6F2: towire_connectctl_init (gen_connect_wire.c:229)
==12787==    by 0x40D6C8: connectd_init (connect_control.c:369)
==12787==    by 0x4186D3: main (lightningd.c:701)
==12787==  Address 0x682d8a9 is 361 bytes inside a block of size 568 alloc'd
==12787==    at 0x4C2FD5F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==12787==    by 0x4867A5: tal_resize_ (tal.c:694)
==12787==    by 0x41F3EE: opt_add_addr_withtype (options.c:143)
==12787==    by 0x41F4D7: opt_add_bind_addr (options.c:155)
==12787==    by 0x47E364: parse_one (parse.c:121)
==12787==    by 0x47F9C8: opt_parse (opt.c:210)
==12787==    by 0x4212F9: handle_opts (options.c:892)
==12787==    by 0x41864C: main (lightningd.c:667)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-14 15:05:56 +01:00
Rusty Russell 435843acfa doc: document UNIX domain sockets in lightning-connect.
We document how to bind to them, just not how to connect to them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

1diff --git a/doc/lightning-connect.7 b/doc/lightning-connect.7
index f143563ca..53619c44f 100644
2019-03-14 15:05:56 +01:00
Rusty Russell 1069f48082 connectd: fix binding to a UNIX domain socket.
lightning_connectd(19780): STATUS_FAIL_INTERNAL_ERROR: Failed to bind on 2 socket: Address family not supported by protocol

"Untested code is buggy code"

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-14 15:05:56 +01:00
Rusty Russell 740f4314ea pytest: test binding lightningd to a UNIX domain socket.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-14 15:05:56 +01:00
wailo e843e138fe Fix installing plugins in dockerfile (#2451)
* Improved plugin install in docker

- All files generated by 'make install' are copied
- Fixes issues with incomplete installation.
- Example: New executables created by build but are missing in docker.
2019-03-11 09:51:47 +01:00
Michael Schmoock 6f71564bdd fix: missing closedir in plugin.c 2019-03-06 23:27:07 +00:00
dlogemann afcbadf374 Remove missing config option "port" 2019-03-06 23:18:53 +00:00
Rusty Russell 1facf626d5 pylightning: allow version querying from within modules.
With the preceeding UTF-8 fix, I'd like to detect UTF-8 support.  But
AFAICT Python doesn't have a standard way of doing version exposure.

So I added __version__, but now we need to make sure it matches.  I
used the hackiest possible method.

[ Christian Decker fixed version to be sane, so previous comment no longer
  applies! --RR ]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-05 11:43:22 +01:00
Rusty Russell cc342fda83 pylightning: make sure UTF-8 gets passed intact.
1. We need to read in as a byte string, then decode into utf8 once we
   have a marker.  Otherwise we seem to mangle it horribly, and we
   might have a bad utf8 string anyway.

2. We need to suppress the JSON \u escapes on output.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-05 11:43:22 +01:00
Rusty Russell 5f437de771 pytest: test passing utf8 into and out of plugin JSON.
We should be able to pass UTF-8 strings to and from plugins without
python turning them into JSON-\u escapes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-05 11:43:22 +01:00
Rusty Russell 00f3a84af2 test: fix thinko in gossipd/test/run-bench-find_route.c
Reported-by: @cdecker
Fixes: #2440
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-05 11:42:43 +01:00
Michael Schmoock 624ec6da27 tests: always call db_migrate() with non-NULL ld.
This will be useful when we add hooks.  For the moment, ld's contents is
undefined, but this can easily be changed.
2019-03-05 10:14:17 +00:00
Conor Scott 0d35a7111a [rpc] don't get uncommitted channels towards num_pending 2019-03-04 15:28:01 +01:00
Rusty Russell 049f2351d4 newaddr: deprecate 'address' output.
It doesn't make sense with 'all', and it's ok to be explicit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-04 15:11:20 +01:00
Rusty Russell 3e67c09d5e newaddr: support getting both bech32 and p2sh addresses.
Higher layers consume less addresses this way.

Fixes: #2390
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-04 15:11:20 +01:00
Christian Decker 5518c7cba8 configure: Check for lower-case IETF acronym in sodium constants
The v1.0.9 release of libsodium added
crypto_aead_chacha20poly1305_ietf_NPUBBYTES which we use; before that it was
...IETF_NPUBBYTES.

Since that release was in April 2016, it seems fair to simply check for
ancient versions and use the internal one if found. The alternative would be
to use the older names (which are still in the header), but given we've never
tested with such old versions, this seems safer.

Reported-by: Zoltán Gálli <@gallizoltan>
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-03-04 02:38:53 +00:00
Christian Decker 61f95be0e9 pylightning: Bump version so pypi includes plugin infra 2019-03-04 00:41:40 +00:00