Rusty Russell
d3bdb073b5
wire/gen_peer_wire_csv: update to latest spec #1
In particular, add features bitfields.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
bdaa22e247
generate-wire.py: allow NULL len parameter from fromwire_*
It implies tal_count() gives the length. Great for almost all callers which
don't care if there are extra bytes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
e076d56709
generate-wire.py: include type bytes in towire/fromwire routines.
This removes some redundancy in creating messages, but also allows
a lazy form or parsing without explicitly checking the type.
A helper fromwire_peektype() is added to look up the type and handle
the too-short-for-type problem.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
c864b28068
generate-wire.py: don't generate structures, hand in all values.
This is a bit more awkward for large structures, but avoids
indirection for the simpler ones (I copied the structures for the test
code, however). We also remove explicit padding.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
a08a2105ea
generate-wire.py: generalize, move to tools.
We're going to want to use this for inter-daemon comms, so generalize it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
b7789bf065
Makefile: generalize whitespace check.
Spread to individual Makefiles, and include headers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
0861ec33a5
check-source-bolt: generalize.
This way sub-Makefiles can add their own files to check.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
c2cc164d6d
daemon: disable old BOLT checks.
This is useful for the next patch.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
05feefbb8a
test: move mockup script outside daemon/
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
d30b67a3fe
test: generalize update-mocks
So we can use it in other directories.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
dec3b9d030
peer: don't ever set up listener on dynamic port.
Simplifies the logic somewhat.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
12b30ab4fc
jsonrpc: register base on linkage.
Other than being neater (no more global list to edit!), this lets the
new daemon and old daemon have their own separate routines.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
c7b69abdaa
type_to_string: move formatting to appropriate files.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
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>
8 years ago
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>
8 years ago
Rusty Russell
93471e06c1
options: return true if we created new directory.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
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>
8 years ago
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>
8 years ago
Christian Decker
570003235e
gossip: Fixing minor issues
Thanks @rustyrussell for the review ^^
8 years ago
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.
8 years ago
Christian Decker
0ed23c46a9
gossip: Implemented routing table sync with newly connected peers
8 years ago
Christian Decker
5ce1f7c2f3
gossip: Set announce timeout to 5 hours
8 years ago
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.
8 years ago
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.
8 years ago
Christian Decker
611f4833c5
gossip: Implemented the staggered broadcast
8 years ago
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.
8 years ago
Christian Decker
d93ce12afa
gossip: Broadcasting and handling gossip messages
8 years ago
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.
8 years ago
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.
8 years ago
Christian Decker
db481d881a
proto: Added handling for nested packets
8 years ago
Rusty Russell
a44e4fb631
daemon/json, test/test_protocol: avoid gcc -O warnings.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
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>
8 years ago
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>
8 years ago
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>
8 years ago
Lucas Betschart
900ab78d46
Fix -Wtautological-constant-out-of-range-compare
8 years ago
Lucas Betschart
ff9cdda4fa
Fix -Wsometimes-uninitialized and -Wuninitialized
8 years ago
Lucas Betschart
c163fe04ac
Fix -Wenum-conversion
8 years ago
Lucas Betschart
33d6cbe6bc
Fix -Wgnu-variable-sized-type-not-at-end
8 years ago
Rusty Russell
45ec071e58
lightningd: remove whitespace failing make check-source.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
36c8fc7ef8
lightningd: remove secpctx
Use the global in the few remaining places.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
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>
8 years ago
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>
8 years ago
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>
8 years ago
Christian Decker
e40509c6c3
wire: Linking against wire objs
8 years ago
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>
8 years ago
Christian Decker
42a33df42e
irc: Checking for param count before accessing
8 years ago
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>
8 years ago
Rusty Russell
41299b679c
sphinx: process_onionpacket doesn't modify the packet.
Make it const.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
423572190b
sphinx: use assignment instead of memcpy where possible.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
6f9dedbe7f
sphinx: remove redundant initialization
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago