core-lightning/common
Rusty Russell 58327a594f codex32: rework.
Firstly, I wanted the results easier to use:
1. Make them always lower case, even if the string was UPPER.
2. Decode the payload for them.
3. Don't give the user any fields they don't need, and make
   the field sizes explicit.

Secondly, I wanted to avoid the pattern of "check in one place, assume
in another", in favour of "check on use".

So, I changed the code to lower the string if it needs to at the start,
and then changed the pull functions so we always use them to get data:
this way we should fail clearly and gracefully if we don't have enough data.

I made all the checks explicit, where we assign the fields.

I also addressed the FIXME: I think the array is *often* one shorter,
but not always, so I trim the last byte at the end if needed.

[ Aditya modified the tests to work ]

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-07-31 11:29:59 +09:30
..
test codex32: rework. 2023-07-31 11:29:59 +09:30
addr.c encode_scriptpubkey_to_addr: support p2tr 2023-07-11 11:41:15 +09:30
addr.h encode_scriptpubkey_to_addr: support p2tr 2023-07-11 11:41:15 +09:30
amount.c common: Add multiplication primitives for amount_msat and amount_sat 2022-09-21 11:25:47 +02:00
amount.h common: Add multiplication primitives for amount_msat and amount_sat 2022-09-21 11:25:47 +02:00
autodata.c common: clean up autodata in common_shutdown(). 2021-11-17 10:51:48 +10:30
autodata.h common: clean up autodata in common_shutdown(). 2021-11-17 10:51:48 +10:30
base32.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
base32.h
base64.c common: use ccan/base64 instead of libsodium. 2021-11-14 18:49:46 +01:00
base64.h wireaddr: clean up tor parsing. 2021-11-14 18:49:46 +01:00
bech32_util.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
bech32_util.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
bech32.c common: rename bech32_encode parameter 2023-05-27 15:06:31 +09:30
bech32.h common: rename bech32_encode parameter 2023-05-27 15:06:31 +09:30
bigsize.c check-includes: allow redundant "config.h" 2021-02-04 12:02:36 +10:30
bigsize.h
billboard.c build: allow DEVELOPER builds with -Og and gcc 9.4.0 2022-09-19 10:18:55 +09:30
billboard.h channeld/dualopend/lightningd: use channel_ready everywhere. 2022-09-12 09:34:52 +09:30
bip32.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
bip32.h
blindedpath.c Makefile: update to latest BOLT text. 2023-04-07 21:22:56 +09:30
blindedpath.h common/blindedpath: expose API at a lower level. 2022-11-09 15:08:03 +01:00
blindedpay.c Makefile: update to latest BOLT text. 2023-04-07 21:22:56 +09:30
blindedpay.h common: update to latest route-blinding spec. 2023-01-30 13:24:29 +10:30
blinding.c Changed external/libwally-core to test_build_fix 2022-04-12 15:17:52 +09:30
blinding.h
blockheight_states.c global: use tal_dup_or_null(). 2021-12-30 14:36:55 +10:30
blockheight_states.h liquidity-ads: persist channel blockheight states to disk 2021-07-20 13:28:38 -04:00
bolt11_json.c global: remove deprecated non-msat-named msat fields. 2023-03-18 15:55:49 +10:30
bolt11_json.h common/bolt11_json: extract bolt11->json code. 2021-01-09 14:34:35 +10:30
bolt11.c bolt11: Don't push the size of the witness program for v1+ scripts 2023-07-26 05:26:21 +09:30
bolt11.h fix(jsonrpc): trim the lightning: prefix from invoice 2023-07-14 15:04:26 +09:30
bolt12_merkle.c bolt12: update comments to match latest spec. 2022-11-09 15:08:03 +01:00
bolt12_merkle.h hsmd: don't use point32 for bolt12, but use pubkeys (though still always 02) 2022-10-26 11:29:06 +10:30
bolt12.c common: fix arm32 compile breakage. 2022-12-06 10:44:39 +01:00
bolt12.h build: don't generate experimental variants of wire files. 2023-05-23 09:34:08 +09:30
channel_config.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
channel_config.h lightningd: new option for htlc dust limit 2021-10-23 12:59:13 +02:00
channel_id.c common: generalize extract_channel_id(). 2021-12-30 09:50:40 +10:30
channel_id.h common: generalize extract_channel_id(). 2021-12-30 09:50:40 +10:30
channel_type.c common/channel_type: add zero-fee-anchor type. 2023-06-29 11:28:47 -04:00
channel_type.h common/channel_type: add zero-fee-anchor type. 2023-06-29 11:28:47 -04:00
close_tx.c Support p2tr deposit addresses 2023-07-11 11:41:15 +09:30
close_tx.h hsmd: Add wallet index metadata to existing messages 2022-03-10 10:22:29 +10:30
closing_fee.h
codex32.c codex32: rework. 2023-07-31 11:29:59 +09:30
codex32.h codex32: rework. 2023-07-31 11:29:59 +09:30
coin_mvt.c common/utils: add tal_strdup_or_null helper. 2023-07-26 06:55:48 +09:30
coin_mvt.h bkpr: for zerconfs, we still wanna know you're opening a channel 2022-07-28 12:08:18 +09:30
configdir.c lightningd: remove deprecated_apis global, put into lightningd. 2023-07-09 16:49:48 +09:30
configdir.h lightningd: remove deprecated_apis global, put into lightningd. 2023-07-09 16:49:48 +09:30
configvar.c common/utils: add tal_strdup_or_null helper. 2023-07-26 06:55:48 +09:30
configvar.h common: allow configvars to be marked dynamic. 2023-06-20 20:08:25 +09:30
crypto_state.h per_peer_state: remove struct crypto_state 2022-01-20 15:24:06 +10:30
cryptomsg.c common: make hdr parameter const 2023-06-23 13:12:42 +09:30
cryptomsg.h common: make hdr parameter const 2023-06-23 13:12:42 +09:30
daemon_conn.c common/daemon_conn: add function to read an fd. 2022-07-18 20:50:04 -05:00
daemon_conn.h common/daemon_conn: add function to read an fd. 2022-07-18 20:50:04 -05:00
daemon.c common: lookup function for symnames. 2023-04-10 09:41:56 +09:30
daemon.h common: lookup function for symnames. 2023-04-10 09:41:56 +09:30
decode_array.c Makefile: update to BOLTs without zlib. 2022-05-19 09:47:32 +09:30
decode_array.h Makefile: update to BOLTs without zlib. 2022-05-19 09:47:32 +09:30
derive_basepoints.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
derive_basepoints.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
descriptor_checksum.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
descriptor_checksum.h
dev_disconnect.c connectd: implement @ correctly. 2022-01-20 15:24:06 +10:30
dev_disconnect.h connectd: implement @ correctly. 2022-01-20 15:24:06 +10:30
dijkstra.c common: remove unused functions or make static. 2021-12-06 10:05:39 +10:30
dijkstra.h common: remove unused functions or make static. 2021-12-06 10:05:39 +10:30
ecdh_hsmd.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
ecdh_hsmd.h
ecdh.h
errcode.h jsonrpc: make error codes an enum. 2022-09-19 10:18:55 +09:30
features.c Makefile: update to latest BOLT text. 2023-04-07 21:22:56 +09:30
features.h Makefile: update to latest BOLT text. 2023-04-07 21:22:56 +09:30
fee_states.c global: use tal_dup_or_null(). 2021-12-30 14:36:55 +10:30
fee_states.h channeld: tweak function to allow testing for pending *uncommitted* changes. 2021-06-04 16:13:08 +09:30
fp16.c common: extract fp16 routines into their own file. 2021-02-04 12:02:36 +10:30
fp16.h common: extract fp16 routines into their own file. 2021-02-04 12:02:36 +10:30
gossip_constants.h Makefile: update bolts to 60cfb5972ad4bec4c49ee0f9e729fb3352fcdc6a. 2023-04-07 21:22:56 +09:30
gossip_store.c common/gossip_store: move subdaemon-only routines to connectd. 2023-01-30 15:15:41 -06:00
gossip_store.h gossip_store: add "dying" flag to indicate not to gossip dying channels. 2023-07-20 11:47:32 +09:30
gossmap.c common/gossmap: don't memcpy NULL, 0, and don't add 0 to NULL pointer. 2023-04-05 06:12:24 +09:30
gossmap.h listincoming: add htlc_min_msat, public and peer_features fields. 2022-11-09 15:08:03 +01:00
hash_u5.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
hash_u5.h
hmac.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
hmac.h
hsm_encryption.c lightningd: expand exit codes for various failures. 2022-07-20 19:28:33 +09:30
hsm_encryption.h cli: make the command line more user friendly. 2022-03-24 09:53:38 +10:30
hsm_version.h hsmd: routine to sign HTLC tx merged with our own tx. 2023-06-29 11:28:47 -04:00
htlc_state.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
htlc_state.h
htlc_trim.c global: thread zero fee option everywhere. 2023-06-29 11:28:47 -04:00
htlc_trim.h global: thread zero fee option everywhere. 2023-06-29 11:28:47 -04:00
htlc_tx.c global: thread zero fee option everywhere. 2023-06-29 11:28:47 -04:00
htlc_tx.h global: thread zero fee option everywhere. 2023-06-29 11:28:47 -04:00
htlc_wire.c channeld: don't calculate blinding shared secret, let lightningd do it. 2022-10-26 11:29:06 +10:30
htlc_wire.h channeld: don't calculate blinding shared secret, let lightningd do it. 2022-10-26 11:29:06 +10:30
htlc.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
initial_channel.c Support p2tr deposit addresses 2023-07-11 11:41:15 +09:30
initial_channel.h common: simple helpers to test for either anchor feature. 2023-06-29 11:28:47 -04:00
initial_commit_tx.c global: thread zero fee option everywhere. 2023-06-29 11:28:47 -04:00
initial_commit_tx.h global: thread zero fee option everywhere. 2023-06-29 11:28:47 -04:00
interactivetx.c is_segwit_output: properly detect all known segwit script types 2023-07-11 11:41:15 +09:30
interactivetx.h Collaborative transaction building 2022-11-02 12:00:11 +01:00
invoice_path_id.c createinvoice: make a minimal blinded "path" in bolt12 invoice if none presented. 2022-11-09 15:08:03 +01:00
invoice_path_id.h createinvoice: make a minimal blinded "path" in bolt12 invoice if none presented. 2022-11-09 15:08:03 +01:00
iso4217.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
iso4217.h bolt12: update comments to match latest spec. 2022-11-09 15:08:03 +01:00
json_command.h lightningd: remove deprecated_apis global, put into lightningd. 2023-07-09 16:49:48 +09:30
json_filter.c common/json_filter: routine to turn "filter" JSON into a filter. 2022-11-09 20:25:58 +10:30
json_filter.h common/json_filter: routine to turn "filter" JSON into a filter. 2022-11-09 20:25:58 +10:30
json_param.c common/json_param: use assert() for param correctness checks. 2023-07-25 14:47:12 +09:30
json_param.h fix(jsonrpc): trim the lightning: prefix from invoice 2023-07-14 15:04:26 +09:30
json_parse_simple.c signed types: add handlers for signed types 2023-07-13 19:34:47 +09:30
json_parse_simple.h signed types: add handlers for signed types 2023-07-13 19:34:47 +09:30
json_parse.c signed types: add handlers for signed types 2023-07-13 19:34:47 +09:30
json_parse.h common: fix wrong comment on json_scan() return. 2023-07-25 14:47:12 +09:30
json_stream.c lightningd/log: clean up nomenclature. 2023-07-19 19:13:57 +09:30
json_stream.h lightningd/log: clean up nomenclature. 2023-07-19 19:13:57 +09:30
jsonrpc_errors.h lightningd: implement checkrune command. 2023-07-21 16:44:22 +09:30
key_derive.c lightningd: move bip32_pubkey here from common/, add hsm check. 2023-03-22 13:50:32 +10:30
key_derive.h lightningd: move bip32_pubkey here from common/, add hsm check. 2023-03-22 13:50:32 +10:30
keyset.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
keyset.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
lease_rates.c lease_rates: prepare for msats fields as raw numbers. 2022-06-21 06:52:35 +09:30
lease_rates.h lease_rates: prepare for msats fields as raw numbers. 2022-06-21 06:52:35 +09:30
Makefile common/codex32: Added codex32_decode() without checksum verification. 2023-07-31 11:29:59 +09:30
memleak.c all: no longer need to call htable_clear to free htable contents. 2023-01-12 11:44:10 +10:30
memleak.h memleak: remove exclusions from memleak_start() 2022-09-19 11:34:42 +09:30
msg_queue.c msg_queue: don't allow magic MSG_PASS_FD message for peers. 2022-01-20 15:24:06 +10:30
msg_queue.h msg_queue: don't allow magic MSG_PASS_FD message for peers. 2022-01-20 15:24:06 +10:30
node_id.c Remove point32. 2022-10-26 11:29:06 +10:30
node_id.h common: expose node_id_hash functions. 2023-01-21 08:05:31 -06:00
onion_decode.c Makefile: update to latest BOLT text. 2023-04-07 21:22:56 +09:30
onion_decode.h common/onion: split into decode and encode routines. 2022-11-09 15:08:03 +01:00
onion_encode.c Makefile: update to latest BOLT text. 2023-04-07 21:22:56 +09:30
onion_encode.h Makefile: update bolts to 60cfb5972ad4bec4c49ee0f9e729fb3352fcdc6a. 2023-04-07 21:22:56 +09:30
onion_message_parse.c common: update to latest onion-message spec. 2023-01-30 13:24:29 +10:30
onion_message_parse.h common/onion_message_parse: generic routine for parsing onion messages. 2022-10-26 11:29:06 +10:30
onionreply.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
onionreply.h
overflows.h overflows: helpers for integer assignment overflows. 2021-07-20 13:28:38 -04:00
peer_billboard.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
peer_billboard.h
peer_failed.c dual-fund: keep track of aborted requests, seamlessly restart daemon 2023-07-30 15:20:04 +09:30
peer_failed.h dual-fund: keep track of aborted requests, seamlessly restart daemon 2023-07-30 15:20:04 +09:30
peer_io.c peer subds: ignore failed writes. 2022-01-20 15:24:06 +10:30
peer_io.h connectd: do nagle by packet type. 2022-01-20 15:24:06 +10:30
peer_status_wire.csv dual-fund: keep track of aborted requests, seamlessly restart daemon 2023-07-30 15:20:04 +09:30
penalty_base.c check-includes: allow redundant "config.h" 2021-02-04 12:02:36 +10:30
penalty_base.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
per_peer_state.c subdaemons: remove gossipd fd from per-peer daemons. 2022-02-08 11:15:52 +10:30
per_peer_state.h subdaemons: remove gossipd fd from per-peer daemons. 2022-02-08 11:15:52 +10:30
permute_tx.c Update libwally to 0.8.8, support PSBTv2 2023-03-23 16:10:55 +10:30
permute_tx.h common: remove unused functions or make static. 2021-12-06 10:05:39 +10:30
ping.c doc: big BOLT update to incorporate warnings language. 2022-04-02 09:40:18 +10:30
ping.h channeld: restore ping command, but only for channeld. 2021-10-10 15:32:57 +02:00
private_channel_announcement.c cleanup: remove unneeded includes in C files. 2021-09-17 09:43:22 +09:30
private_channel_announcement.h
psbt_internal.c spec: update to latest dual-funding wire changes 2023-07-13 19:34:47 +09:30
psbt_internal.h spec: update to latest dual-funding wire changes 2023-07-13 19:34:47 +09:30
psbt_keypath.c Support p2tr deposit addresses 2023-07-11 11:41:15 +09:30
psbt_keypath.h Support p2tr deposit addresses 2023-07-11 11:41:15 +09:30
psbt_open.c Support p2tr deposit addresses 2023-07-11 11:41:15 +09:30
psbt_open.h Update libwally to 0.8.8, support PSBTv2 2023-03-23 16:10:55 +10:30
pseudorand.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
pseudorand.h
random_select.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
random_select.h
read_peer_msg.c dual-fund: keep track of aborted requests, seamlessly restart daemon 2023-07-30 15:20:04 +09:30
read_peer_msg.h subdaemons: remove gossipd fd from per-peer daemons. 2022-02-08 11:15:52 +10:30
route.c common/blindedpay: routines to construct a blinded payment. 2022-10-26 11:29:06 +10:30
route.h common/blindedpay: routines to construct a blinded payment. 2022-10-26 11:29:06 +10:30
scb_wire.csv staticbackup: don't use wireaddr_internal. 2023-06-01 09:28:39 +09:30
setup.c setup: make all htables use tal. 2023-01-12 11:44:10 +10:30
setup.h
shutdown_scriptpubkey.c lightningd: only allow closing to native segwit 2022-12-13 08:28:12 +10:30
shutdown_scriptpubkey.h lightningd: only allow closing to native segwit 2022-12-13 08:28:12 +10:30
sphinx.c Makefile: update bolts a0bbe47b0278b4f152dbaa4f5fab2562413a217c 2023-04-07 21:22:56 +09:30
sphinx.h lightningd: --dev-onion-reply-length option. 2022-11-08 17:40:57 +01:00
status_levels.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
status_levels.h
status_wire.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
status_wire.csv cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
status_wire.h
status.c common: make sure we hand through peer for io logging. 2022-02-08 11:15:52 +10:30
status.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
subdaemon.c connectd: do dev_disconnect logic. 2022-01-20 15:24:06 +10:30
subdaemon.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
timeout.c common: add routine for absolute timeouts (vs. relative). 2022-01-20 15:24:06 +10:30
timeout.h common: add routine for absolute timeouts (vs. relative). 2022-01-20 15:24:06 +10:30
trace.c trace: Use User Statically-Defined Tracepoints to emit tracing spans 2023-07-28 09:21:42 +09:30
trace.h trace: First draft of API 2023-07-28 09:21:42 +09:30
tx_roles.c tx_roles: allow to be serialized btw processes 2023-02-07 21:03:36 -06:00
tx_roles.h tx_roles: allow to be serialized btw processes 2023-02-07 21:03:36 -06:00
type_to_string.c type_to_string: detect type failure in DEVELOPER mode. 2021-09-21 18:04:43 +02:00
type_to_string.h Remove point32. 2022-10-26 11:29:06 +10:30
utils.c common/utils: add tal_strdup_or_null helper. 2023-07-26 06:55:48 +09:30
utils.h common/utils: add tal_strdup_or_null helper. 2023-07-26 06:55:48 +09:30
utxo.c global: thread zero fee option everywhere. 2023-06-29 11:28:47 -04:00
utxo.h global: thread zero fee option everywhere. 2023-06-29 11:28:47 -04:00
version.c lightningd: use OPT_EXITS for options which exit. 2023-06-03 10:50:29 +09:30
version.h lightningd: use OPT_EXITS for options which exit. 2023-06-03 10:50:29 +09:30
wallet.c check: make sure all files outside contrib/ include "config.h" first. 2021-12-06 10:05:39 +10:30
wallet.h wallet: remove unused TX_ANNOTATION type in transaction_annotations table. 2023-01-30 15:15:41 -06:00
wire_error.c dual-fund: keep track of aborted requests, seamlessly restart daemon 2023-07-30 15:20:04 +09:30
wire_error.h cleanup: remove unneeded includes in header files. 2021-09-17 09:43:22 +09:30
wireaddr.c lightningd: allow --bind=ws: 2023-06-01 09:28:39 +09:30
wireaddr.h common: add new internal type for websockets. 2023-06-01 09:28:39 +09:30