Commit Graph

5639 Commits

Author SHA1 Message Date
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
Christian Decker 3d4c0ab626 changelog: Setup new unreleased section post-0.7.0
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-03-04 00:34:47 +00:00
neil saitug 7f89ce43cc Update wallet/db.h
Co-Authored-By: rustyrussell <rusty@rustcorp.com.au>
2019-03-04 00:04:38 +00:00
Rusty Russell 60285187fd db: support more powerful migrations.
Allow a function as well as (or instead of!) an sql statement.  That
will let us do things like set per-channel values to the global
defaults, for example.

Since we remove the NULL termination, the final entry is ARRAY_SIZE()-1
not ARRAY_SIZE()-2.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-04 00:04:38 +00:00
Rusty Russell bef7d45f1c db: remove manual db_migration_count function.
More efficient to measure the ARRAY_SIZE(), which is a runtime
constant.  We move it into the unit test.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-04 00:04:38 +00:00
Rusty Russell b65c279557 db: don't enter into db_upgrades table on every startup.
Below this code appears:

	if (current != orig)
		db_exec(__func__, db,
			"INSERT INTO db_upgrades VALUES (%i, '%s');",
			orig, version());

But since the loop pre-increments current, this is always true.  I wondered
why there were so many duplicates in my db_upgrades table!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-04 00:04:38 +00:00
William Casarin 9aaf2fe8d4 build: fix uninitialized variable error on gcc 7.4.0
*best is checked for null before the comparison against the uninitialized
variable ever happens, so this isn't a real issue.

Initialize it to zero so that we don't fail to compile on certain gcc versions.

plugins/pay.c: In function ‘add_shadow_route’:
plugins/pay.c:644:18: error: ‘sample’ may be used uninitialized in this function
   if (!best || v > sample) {
                ~~^~~~~~~~

Signed-off-by: William Casarin <jb55@jb55.com>
2019-03-03 14:47:33 +01:00
thestick613 e613ae2d8e Increase TCP socket backlog. 2019-03-03 01:27:00 +01:00
nicolas.dorier 063149079e Installing the Pay plugin in Dockerfile for arm32v7 2019-03-02 15:21:57 +01:00
Rusty Russell 4a11bc07f9 CHANGELOG.md: v0.7.0
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-01 21:38:08 +00:00
Rusty Russell 73c02691a3 tools/built-release.sh: fix archives we produce.
We were tarring up the build dir, not the destination dir!  We did this
for 0.6.3 and nobody noticed :(

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-01 21:38:08 +00:00
Rusty Russell 1da8e498c0 doc: fill in parameters in getroute manpage.
Fixes: #2419
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-01 06:20:58 +00:00
Rusty Russell a988ed70b9 doc/REPRODUCIBLE.md: describe to do reproducible builds.
This is a separate commit, as it describes the results (as sha256sum)
of doing a test on the previous commit.  Obviously these values will
have to updated after a rebase!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-03-01 03:48:04 +00:00
wailo 2e129dd932 Installing the Pay plugin in Dockerfile 2019-03-01 00:07:56 +00:00
Rusty Russell 30445165d0 CHANGELOG.md: update for rc3.
Side note: it's also a birthday, this is not the 0.7 release name :)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-28 09:50:35 +00:00
Rusty Russell 66efcfa855 tools/repro-build.sh: do not turn on address-sanitizer by default.
@cdecker reports that this gives warnings on exit; and we can't suppress
them by setting ASAN_OPTIONS within the binary itself, unfortunately.

So for 0.7, disable it by default.  I'll work through the errors for 0.7.1.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-28 05:17:21 +00:00
Rusty Russell d98fb0fd5b configure: remove bashism.
== is bash-only; for other shells this gives an error (meaning that you won't
get the sanity check):

	./configure
	Compiling ccan/tools/configurator/configurator...done
	./configure: 148: [: gcc: unexpected operator

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-28 05:17:21 +00:00
Rusty Russell 02faadfb93 amount: make it work with gcc-4.8.
```
In file included from bitcoin/chainparams.h:7:0,from bitcoin/chainparams.c:1:
./common/amount.h:36:11: error: initializer element is not constant
((struct amount_sat){(constant) + AMOUNT_MUST_BE_CONST(constant)})
^
bitcoin/chainparams.c:20:21: note: in expansion of macro ‘AMOUNT_SAT’
.max_funding = AMOUNT_SAT((1 << 24) - 1),
^
./common/amount.h:36:11: error: (near initialization for ‘networks[0].max_funding’)
((struct amount_sat){(constant) + AMOUNT_MUST_BE_CONST(constant)})
^
bitcoin/chainparams.c:20:21: note: in expansion of macro ‘AMOUNT_SAT’
.max_funding = AMOUNT_SAT((1 << 24) - 1),
```

Fixes: #2404
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-27 23:12:50 +00:00
Rusty Russell a3bac88e08 travis: add a test that we compile under gcc-4.8 (CentOS!)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-27 23:12:50 +00:00
Rusty Russell 6bfeea334b README.md: update link from listpayments to listpays.
Fixes: #2401
Reported-by: @stevenroose
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-27 23:12:04 +00:00
Rusty Russell 1dcc482350 Update CHANGELOG.md for -rc2.
And fix trivial typo in MAKING-RELEASES.md, and date retreival in
build-release.sh and repro-build.sh (real git tags start with v!)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-26 04:16:34 +00:00
Rusty Russell dce58393cb build-release.sh: fix zipfile determinism.
I tried building zipfile on a fresh clone inside KVM, and got

1. Different times inside the zipfile, since zip seems to save *local* times.
2. A different zipfile order, since zip seems to use filesystem order.

Fix both of these.  I don't know if LANG=C is necessary for git
ls-files, but it can't hurt.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-25 23:36:47 +00:00
Rusty Russell 6e63d79159 pylightning: translate msat input to class Millisatoshi
Rather than using LightningJSONDecoder's implicit "field name and
value ends in msat, try converting to Millisatoshi", we do it to
parameters using type annotations.

If you had a parameter which was an array or dict itself, we don't
delve into that, but that's probably OK.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-25 21:45:21 +00:00
Rusty Russell 690064f7e0 pylightning: don't compare v with inspect._empty.
I originally converted input JSON naively into Millisatoshi, and the
result was a strange failure in Millisatoshi.__eq__.

It seems this is because inspect._empty.__eq__(Millisatoshi) raises
NotImplemented, and so it tries Millisatoshi.__eq__(inspect._empty)
which doesn't like it.

'is' is the correct test here, AFAICT, and doesn't suffer from these
problems.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-25 21:45:21 +00:00
Rusty Russell 6ace13ba22 pylightning: make plugins use Millisatoshi-converting encoder.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-25 21:45:21 +00:00
Rusty Russell 5a7d038e6e pylightning: provide a class for Lightning JSONDecoder.
Some JSON functions want a *class*, not just a hook, so provide one.
To make it clear that we want an encoding *class* and a decoding *object*,
rename the UnixDomainSocketRpc encode parameter to encode_cls.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-25 21:45:21 +00:00
Rusty Russell 464858883b pylightning: reduce scope for deadlock in plugins.
If we can't marshall an object into JSON, the exception causes a deadlock
and we don't get any results.

Instead of deadlocking, our failure now is:

	lightning.lightning.RpcError: RPC call failed: method: echo, payload: {'msat': 17msat}, error: Error while processing echo: TypeError("Object of type 'Millisatoshi' is not JSON serializable",)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-25 21:45:21 +00:00
Rusty Russell c7316d7ba2 pytest: test that we translate to and from Millisatoshi on plugin RPC.
We don't, but we should, like we do for normal RPC.  However, I chose
to use function annotations, rather than names-ending-in-'msat'
because it's more Pythony.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-25 21:45:21 +00:00
Rusty Russell 1982c73ebc pylightning: support functions with type annotations.
I tried annotating the plugin-millisatoshis.py plugin, and it failed like so:

	plugin-millisatoshis.py Killing plugin: "getmanifest" result is not an object: {"jsonrpc": "2.0", "id": 1, "error": "Error while processing getmanifest: ValueError(\'Function has keyword-only parameters or annotations, use getfullargspec() API which can support them\',)"}'

So, let's do that!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-25 21:45:21 +00:00
Rusty Russell e3bdc32ee8 plugin: give *some* clue in the logs of getmanifest raises an exception!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-25 21:45:21 +00:00
Rusty Russell 7ca0000869 CHANGELOG.md: update for 0.7.0-rc1
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 10:19:33 +00:00
Rusty Russell b2ae4f0fd7 tools/repro-build.sh: script to build an identical binary tarball.
For the moment it's only Ubuntu 18.04.1.

Complete documentation is in the final commit; you can test this using
the prior commit and comparing with my intermediate files and results
at:

	https://ozlabs.org/~rusty/clightning-repro

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 10:19:33 +00:00
Rusty Russell ce5d61be32 CHANGELOG.md: order into user impact and coolness, while maintaining sections.
Add the one 'Changelog-fixed' entry from a405c22fc9,
and reorder a bit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 10:19:33 +00:00
Rusty Russell b99617312f plugins/pay: use json_ prefix for json command handlers.
That makes them intuitive to find with TAGS or grep.

Suggested-by: @cdecker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 05:45:25 +00:00
Rusty Russell 203ef2ed0b listsendpays: updated version of listpayments.
New name is less confusing, and most people should be transitioning to
listpays rather than this anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 05:45:25 +00:00
Rusty Russell 56dfbec6bd listpays: new command to summarize pay commands.
This is to future-proof against multi-part-payments: the low-level commands
will start returning multiple results once we have that, so prepare
transition plan now.

Closes: #2372
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 05:45:25 +00:00
Rusty Russell e0605466bf doc: update listpayments man page to match current semantics.
It didn't show the optional parameters, and the output fields were
obsolete.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 05:45:25 +00:00
Rusty Russell 1ec959752b plugin/pay: rename 'description' to 'label', deprecate 'description'.
This is the same deprecation, but one level up.  For the moment, we
still support invoices with a `h` field (where description will be
necessary) but that will be removed once this option is removed.

Note that I just changed pylightning without backwards compatibility,
since the field was unlikely to be used, but we could do something
more complex here?

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 05:45:25 +00:00
Rusty Russell 919f390a93 sendpay: rename 'description' to 'label'.
This field was used by `pay` to hold the bolt11 description if the bolt11
string used `h` to hash the description (which nobody ever did).  If the
`h` field wasn't present, it could contain anything, as it wasn't checked.

It's really useful to have a label for payments (eg. '1 Cuban'), but adding
yet-another option would be painful, so we simply rename 'description'
to 'label' except inside the db.

This means we need to do some tricky parameter parsing to handle array
and keyword JSON arguments, but only until we remove the old name.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 05:45:25 +00:00
Rusty Russell 26f60f83d5 libplugin: add deprecated_apis flag for plugins to access.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 05:45:25 +00:00
Rusty Russell 30e4b812d0 plugin/pay: feed bolt11 string through to sendpay.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 05:45:25 +00:00
Rusty Russell 5e14274f41 sendpay: provide 'bolt11' parameter.
Without this, there's no proof of payment, since it is the signed invoice
that make the receipt valid.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 05:45:25 +00:00
Rusty Russell f83e57d68d doc: update getroute manpage in line with last commit.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 04:32:36 +00:00
Rusty Russell f5dc8b9d52 JSON: allow any number of decimal points when parsing 'btc' suffix.
I tried to fundchannel 0.01btc, and of course it wanted 8 decimals exactly.
If I can't get this right, it's probably a bad idea.

I still don't allow whole number of btc though, since that's probably a mistake
and you're not supposed to put that much in c-lightning yet :)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-23 03:09:37 +00:00
lisa neigut 9f3627f09d opening_control: use chainparams for dust_limit in channel config
tiny fixup to use chainparams instead of inline constant.
2019-02-22 13:56:21 -08:00
Rusty Russell 17c8090a87 configure: relax --enable-address-sanitizer check a little.
If you use use CC='gcc <options>' this blocks ASAN.  Of course, no
check is perfect, but this catches the obvious misuse still.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-02-22 11:20:51 -08:00