Commit Graph

1369 Commits

Author SHA1 Message Date
Rusty Russell f8eb454139 type_to_string: move pretty printing of types from log
It's not just useful for logging.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 14:05:15 +10:30
Rusty Russell 756b2a0530 options: --help and --version are early args.
If they use these, we definitely don't want to create the config dir...

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 14:04:15 +10:30
Rusty Russell 93471e06c1 options: return true if we created new directory.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 14:03:15 +10:30
Rusty Russell 038ef0250a options: move option and config code into its own file.
For the moment, the new lightningd will share all this anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 13:22:29 +10:30
Rusty Russell ca4d03aa2a lightningd_state: move invoices into separate structure.
It's all maintained by invoice.c, so make it private to that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 13:18:47 +10:30
Rusty Russell 59ecb3dfea Makefile: don't include tests in TAGS.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 13:17:47 +10:30
Rusty Russell f8344baf64 ccan: update, new modules.
ccan/autodata, ccan/breakpoint, ccan/crypto/hmac_sha256, ccan/crypto/hkdf_sha256,
ccan/fdpass and ccan/io/fdpass.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 13:16:47 +10:30
Christian Decker 570003235e gossip: Fixing minor issues
Thanks @rustyrussell for the review ^^
2017-01-03 15:08:05 +10:30
Christian Decker 95bc8f6987 gossip: Removing origin from staggered broadcast
Keeping a pointer to the peer that initially sent us a message
could (actually will!) result in dangling pointers. Removing this
results in some additional messages, which will be discarded by the
recipient, so that should not be a problem.
2017-01-03 15:08:05 +10:30
Christian Decker 0ed23c46a9 gossip: Implemented routing table sync with newly connected peers 2017-01-03 15:08:05 +10:30
Christian Decker 5ce1f7c2f3 gossip: Set announce timeout to 5 hours 2017-01-03 15:08:05 +10:30
Christian Decker 71a18fdd2e gossip: Trigger announce on channel establishment
Since we ultimately want to have a very long re-announcement timeout
we better trigger an announcement upon channel state change to normal.
2017-01-03 15:08:05 +10:30
Christian Decker e54c0adced gossip: Do not consider half-open connections for routes
Connections are in a half-open state after receiving the
`channel_announcement` and before the `channel_update` makes them
usable, so we need to ignore channels that are not yet fully open.
2017-01-03 15:08:05 +10:30
Christian Decker 611f4833c5 gossip: Implemented the staggered broadcast 2017-01-03 15:08:05 +10:30
Christian Decker fca9bf1a16 gossip: Partially sign channel_announcements
We can already add our own signatures, will have to defer remote
signatures until we implement the channel setup messages from the spec.
2017-01-03 15:08:05 +10:30
Christian Decker d93ce12afa gossip: Broadcasting and handling gossip messages 2017-01-03 15:08:05 +10:30
Christian Decker 6363dd5ff6 gossip: Update to new spec version
The message type numbering changed, so reflect that in the generated
type listing.
2017-01-03 15:08:05 +10:30
Christian Decker e8d68757f6 gossip: Tracking tx index in topology
The txlocator was reporting the index in the purged array of
transactions instead of the index in the original block.
2017-01-03 15:08:05 +10:30
Christian Decker 57d5ae96a4 routing: Added channel_id and directions to connections
The gossip protocol spec refers to channels by their `channel_id` and
a direction. Furthermore, inbetween the `channel_announcement` and the
`channel_update` for either direction, the channel direction is in an
undefined state and cannot be used, so added the `half_add_connection`
function and an `active` flag to differentiate usable connections from
unusable ones.
2017-01-03 15:08:05 +10:30
Christian Decker 9f846925b3 bitcoin: Add comparison between pubkeys
Some of the routing messages rely on a canonical ordering of pubkeys.
2017-01-03 15:08:05 +10:30
Christian Decker db481d881a proto: Added handling for nested packets 2017-01-03 15:08:05 +10:30
Christian Decker 1c4d4f8c91 proto: Added nested_pkt
This is mainly used to transport the new, standardized protocol, over
the old legacy transport. Allows us to replace the serialization and
transport gradually instead of all at once.
2017-01-03 15:08:05 +10:30
Christian Decker 811fab4850 trivial: Add `addresses` field to generate-wire.py
It was failing the compile if we had a recent enough spec.
2017-01-03 14:48:54 +10:30
Rusty Russell a44e4fb631 daemon/json, test/test_protocol: avoid gcc -O warnings.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-15 11:49:51 +10:30
Rusty Russell e109977df7 peer: don't print uninitialized commit_num.
Reported-by: Lucas Betschart <lucasbetschart@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-15 11:44:48 +10:30
Rusty Russell 2a68a984c3 peer: fix unassigned error packet on receiving non-ASCII error.
Reported-by: Lucas Betschart <lucasbetschart@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-15 11:42:24 +10:30
Rusty Russell 1b170c85bb Revert "Fix -Wsometimes-uninitialized and -Wuninitialized"
This reverts commit ff9cdda4fa.

These are real bugs, so I prefer to fix them explicitly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-15 11:41:31 +10:30
Lucas Betschart 900ab78d46 Fix -Wtautological-constant-out-of-range-compare 2016-12-14 08:47:21 +01:00
Lucas Betschart ff9cdda4fa Fix -Wsometimes-uninitialized and -Wuninitialized 2016-12-14 08:45:40 +01:00
Lucas Betschart c163fe04ac Fix -Wenum-conversion 2016-12-14 08:43:48 +01:00
Lucas Betschart 33d6cbe6bc Fix -Wgnu-variable-sized-type-not-at-end 2016-12-14 08:41:30 +01:00
Christian Decker 37fcd15e95 Merge pull request #101 from cdecker/gitlab-ci
ci: Replacing Travis-CI with Gitlab-CI
2016-12-13 22:28:36 +01:00
Christian Decker 001708b115
travis-ci: Removing travis-ci config
We are replacing this with an internally run gitlab-ci instance, so no
need to keep this file.
2016-12-11 13:24:31 +01:00
Christian Decker 12b9d6db22
Add .gitlab-ci.yml 2016-12-11 13:24:27 +01:00
Rusty Russell 45ec071e58 lightningd: remove whitespace failing make check-source.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-05 14:03:06 +10:30
Rusty Russell 36c8fc7ef8 lightningd: remove secpctx
Use the global in the few remaining places.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-02 18:13:27 +10:30
Rusty Russell a4fdaab5b3 Use global secp256k1_ctx instead of passing it around.
If I'd known how large this patch would be (though trivial), I'd
have done it in parts.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-02 18:12:58 +10:30
Rusty Russell c938ebb5c0 utils: add a global secp, fix wire to use it.
This repairs make check.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-02 18:11:06 +10:30
Rusty Russell 1f447688bc test: make generic driver for unit tests.
Not just in daemon.  This fixes 'make check' when it tries to
run 'make wire-tests'

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-02 18:10:13 +10:30
Christian Decker ca9fb0376a wire: Removing global secpctx
Changed the generation of messages so that we pass in a reference to the
secp256k1_context if it is required by the underlying primitive
function. This gets rid of the global `secp256k1_ctx` variable and
adheres closer to how we've been handing in the context so far.
2016-12-01 13:50:02 +10:30
Christian Decker e40509c6c3 wire: Linking against wire objs 2016-12-01 13:50:02 +10:30
Rusty Russell 36e018161f wire: generate marshal/unmarshal from spec.
Including tests!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-01 13:50:02 +10:30
Rusty Russell f85f2c6c2d 0.5.2: Fixes and change IRC server.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-21 10:39:13 +10:30
Rusty Russell 6905cf5e7f README.md: add "upgrade" instructions and add port config for public nodes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-21 10:21:41 +10:30
Rusty Russell 0ba93cb948 lightningd: don't listen at all if no port number set.
When we support the Milan protocol, we'll use a default port.  But
for now, don't listen at all unless a port is specified.

Fixes: #54
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-18 17:13:29 +10:30
Rusty Russell fe14b3f4d9 Merge remote-tracking branch 'origin/pr/92'
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-18 17:05:42 +10:30
Rusty Russell 97a155bad5 Merge remote-tracking branch 'origin/pr/97'
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-18 14:28:22 +10:30
Christian Decker 42a33df42e irc: Checking for param count before accessing 2016-11-16 22:55:29 +01:00
Christian Decker 188b3c3e19
sphinx: Fixed a buffer overflow in hmac generation
Our HMACs are truncated to 20 byte, but sodium still generates 32 byte
HMACs and we were handing in a buffer that was too small, so we
overflowing the buffer by 12 bytes. This manifested itself only in the
32 bit variant because of different alignment in the 64bit version.

Fixes #94.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2016-11-16 14:41:19 +01:00
Christian Decker b2a3e8010f Merge pull request #96 from ElementsProject/minor-sphinx-cleanups
Minor sphinx cleanups
2016-11-16 14:35:19 +01:00