Christian Decker
c635396766
common: Moving some bech32 related utilities to bech32_util
These were so far only used for bolt11 construction, but we'll need them for the
DNS seed as well, so here we just pull them out into their own unit and prefix
them.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
Rusty Russell
09c4203767
bolt11: allow multiple fallback addresses.
We can have more than one; eg we might offer both bech32 and a p2sh
address, and in future we might offer v1 segwit, etc.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
practicalswift
6269a4c55d
Remove unused functions not covered by unit tests
7 years ago
practicalswift
7e9750ffee
Reduce variable scopes
7 years ago
practicalswift
98f49c0837
Remove include in file foo.c that is already included in foo.h
7 years ago
practicalswift
8f76581005
Use pointer to const where possible
7 years ago
Rusty Russell
0a6e3d1e13
utils: remove tal_tmpctx altogether, use global.
In particular, we now only free tmpctx at the end of main().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
John Barboza
7a77271922
lightningd: encode fallback address in 5 bits
The bolt11 specification requires that the version number of the
Fallback on-chain address should be 5 bits wide instead of 8
bits.
7 years ago
practicalswift
a87c8a74b5
Avoid segfault on CLI command "decodepay 1111111" (invalid short bech32 string)
Before this patch:
```
$ cli/lightning-cli decodepay 1111111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 111111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 11111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 1111111
lightning-cli: Non-object response ''
$ cli/lightning-cli decodepay 1111111
lightning-cli: Connecting to 'lightning-rpc': Connection refused
```
After this patch:
```
$ cli/lightning-cli decodepay 1111111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 111111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 11111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 1111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 1111111
"Invalid bolt11: Bad bech32 string"
```
7 years ago
Rusty Russell
887e9dcc44
travis: reenable check-source (without BOLT text).
We've been slipping, so fix up minor issues too so it compiles.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
0610f66c34
bolt11: handle r value fee spec change.
We don't use it yet, but now we'll decode correctly.
See: https://github.com/lightningnetwork/lightning-rfc/pull/317
lightning-rfc commit: ef053c09431442697ab46e83f9d3f86e3510a18e
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Christian Decker
9ba99d2b2d
hsm: Cleanup after merging control and client libraries
Change all calls to use the correct serialization and deserialization
functions, include the correct headers and remove the control
messages.
Signed-off-by: Christian Decker <decker.christian@gmail.com>
7 years ago
Rusty Russell
60c30214c1
bolt11: fix encoding of x and c fields.
Fixes : #374
Reported-by: Nadav Ivgi
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
45f5bb7fac
bolt11: move to common/ and sign via callback.
JSON stuff is moved to lightningd/invoice.c.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
78d0a5e840
bech32: move to common/
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
b7774fcb0a
bolt11: comment on weird assignment-then-check test.
Suggested-by: Christian Decker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
a9002eac52
Update to latest BOLT.
And nail "make check-source" to that specific version (which is a commit id,
not a branch name, so needs a different syntax for git).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
6c21da69e6
bolt11: 'c' support for min_final_cltv_expiry.
Based on latest draft spec, using variable length encoding.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
8d09734536
bolt11: add decodepay RPC helper.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago
Rusty Russell
15e1e4b099
bolt11: support for encoding/decoding and checking.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7 years ago