Rusty Russell
7e8dbc1c37
sphinx: use struct pubkey.
It was using raw secp256k1_pubkey; we have better helpers for struct
pubkey.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
59febcb968
sphinx: explain why parse_onionpacket fails.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
6 years ago
Rusty Russell
8553edb7e2
common: fix up BOLT 4 references.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
8c22bd9ee1
headers: fix up header idempotent lines.
For future reference, done via:
for f in `find wire/ bitcoin/ common/ lightningd -name '*.h' ! -name 'gen*'`; do ID=`echo -n LIGHTNING/$f | tr 'a-z' 'A-Z' | tr -cs 'A-Z0-9' _`; sed 's/^#\(ifndef\|define\) .*_H$/#\1 '$ID/ < $f | sed 's,#endif /..*_H ./$,#endif /* '$ID' */,' | bagto $f; done
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
a37c165cb9
common: move some files out of lightningd/
Basically all files shared by different daemons.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
fea412dd94
BOLT: Update text to latest commit.
This brings us up to 955e874acc535ab2c74c1cf0eab61896ea4224ff in
https://github.com/lightningnetwork/lightning-rfc
This doesn't actually change anything; the only actual change is held back
for the next commit.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Christian Decker
7dc693963d
script: Consolidate scripts to use pubkey_to_hash160
8 years ago
sstone
f371b6df20
sphinx: fix payload amount encoding
it was changed to 64 bits
8 years ago
Rusty Russell
6f181e0dc1
BOLT update for 8-byte satoshi values, and other updates.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
7389aae26a
Massive BOLT text underscore and formatting updates.
This brings us up to 61b5b3f7b4145c9d6d66973b6bfbf28e6c0a0791.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
b99c5620ef
struct secret: use everywhere.
We alternated between using a sha256 and using a privkey, but there are
numerous places where we have a random 32 bytes which are neither.
This fixes many of them (plus, struct privkey is now defined in terms of
struct secret).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Christian Decker
9820abda7c
sphinx: Store shared secrets on the origin node
We could recompute them once we receive a reply and need to decrypt
it, but why go through the trouble when we can just store them?
8 years ago
Christian Decker
4a468af378
sphinx: Parameterizing the HMAC size
Should have done this a long time ago...
8 years ago
Christian Decker
157c2da778
sphinx: Removing old nexthop based on public keys
Signed-off-by: Christian Decker <decker.christian@gmail.com>
8 years ago
Christian Decker
83e89f0fe5
sphinx: Using hop_data to serialize per-hop information into onion
Signed-off-by: Christian Decker <decker.christian@gmail.com>
8 years ago
Christian Decker
752f884c23
sphinx: Removed per-hop payloads, will be replaced by hop_data
This is in preparation for the migration to `hop_data` which contains
all fields, and uses the `short_channel_id` instead of the pubkey.
8 years ago
Christian Decker
bc0039e8c0
sphinx: Onion reply wrapping and unwrapping
Signed-off-by: Christian Decker <decker.christian@gmail.com>
8 years ago
Christian Decker
09b31624f0
sphinx: Creating copy of sphinx for new daemon
Keeping both the legacy daemon and the new daemon happy with the
restructure is a lot of work, so we just don't do it :-)
8 years ago
Rusty Russell
8a84e961ed
daemon/sphinx: support modern v0 hop payload.
This just means we put the outgoing_cltv_value where we used to put zeroes.
The old daemon simply ignores this, but the new one should check it as per
BOLT 4.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Rusty Russell
8146b838e8
daemon/sphinx: split handling.
We want to use HSM to do the ECDH part, so split that out.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Christian Decker
cae283087d
sphinx: Committing the onion packet to the payment-hash
The sphinx onion packet now commits to the HTLC payment-hash it is
associated with. This prevents replay attacks with the same onion.
8 years ago
Christian Decker
91b17d45d8
sphinx: Removing last vestiges of the end-to-end payload
So far this was simply set to a zero-length end-to-end payload. We
don't have any plans of re-adding it for the moment, so let's get rid
of the unused code.
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
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
8599d63256
sphinx: add brackets around constant definition
Always do this, otherwise "MACRO * foo" can have unexpected results.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
8 years ago
Christian Decker
7bb5c279a8
sphinx: Implemented sphinx onion routing
Implements a spec-compliant sphinx onion routing format. The format has
been cross-checked with the go implementation
cdecker/lightning-onion@b9e117e.
9 years ago