core-lightning/bitcoin
Rusty Russell cce3e717d9 bitcoin/signature: wrap libwally call.
If a tx is larger than 2k, libwally will do an alloc:

```
lightning_hsmd: common/setup.c:11: wally_tal: Assertion `wally_tal_ctx' failed.
0x11c283 wally_tal
	common/setup.c:11
0x15ebd1 wally_malloc
	../../../libwally-core/src/internal.c:233
0x171e9e tx_to_bip143_bytes
	../../../libwally-core/src/transaction.c:1918
0x172cda tx_to_bytes
	../../../libwally-core/src/transaction.c:2086
0x1759df tx_get_signature_hash
	../../../libwally-core/src/transaction.c:2776
0x175afd wally_tx_get_signature_hash
	../../../libwally-core/src/transaction.c:2800
0x175b62 wally_tx_get_btc_signature_hash
	../../../libwally-core/src/transaction.c:2810
0x1297d9 bitcoin_tx_hash_for_sig
	bitcoin/signature.c:139
0x1298ca sign_tx_input
	bitcoin/signature.c:161
0x10e701 handle_sign_remote_commitment_tx
	hsmd/hsmd.c:1011
0x110f7f handle_client
	hsmd/hsmd.c:1968
0x147a71 next_plan
	ccan/ccan/io/io.c:59
0x1485ee do_plan
	ccan/ccan/io/io.c:407
0x14862c io_ready
	ccan/ccan/io/io.c:417
0x14a7f2 io_loop
	ccan/ccan/io/poll.c:445
0x111125 main
	hsmd/hsmd.c:2040
```

I reduced that constant in libwally to 200, and ran the entire
test suite, and found no other places.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-11-04 14:28:06 -06:00
..
test psbt: clean up interface for setting metadata on PSBT inputs 2020-09-09 19:54:20 +09:30
address.h Makefile: generalize whitespace check. 2017-01-04 14:09:20 +10:30
base58.c utils: use a cleaner pattern to capture wally allocations. 2020-09-23 14:45:53 +02:00
base58.h wallet: Pass chainparams to address serialization 2019-05-10 23:07:49 +00:00
block.c block: Compute the txids only once 2020-09-02 13:21:32 +02:00
block.h block: Compute the txids only once 2020-09-02 13:21:32 +02:00
chainparams.c Updating signet chainparams for the latest PoW fix 2020-09-24 09:24:14 +09:30
chainparams.h elements,pset: populate elements specific data for PSBTs 2020-07-13 11:37:24 +09:30
feerate.c feerate: remove duplicate method 2020-10-20 14:27:19 +10:30
feerate.h feerate: remove duplicate method 2020-10-20 14:27:19 +10:30
locktime.c Remove unused functions not covered by unit tests 2018-03-26 23:35:56 +00:00
locktime.h Remove unused functions not covered by unit tests 2018-03-26 23:35:56 +00:00
Makefile Makefile: make check-includes check all the non-generated files. 2020-10-22 12:14:34 +10:30
preimage.c wire: move towire/fromwire_preimage out to bitcoin/preimage.c. 2020-05-18 14:51:12 +02:00
preimage.h wire: move towire/fromwire_preimage out to bitcoin/preimage.c. 2020-05-18 14:51:12 +02:00
privkey.c wire: move remaining bitcoin functions out to bitcoin/ files. 2020-05-18 14:51:12 +02:00
privkey.h wire: move remaining bitcoin functions out to bitcoin/ files. 2020-05-18 14:51:12 +02:00
psbt.c psbt: have the unknown map 'add' be a 'set' instead 2020-10-20 14:27:19 +10:30
psbt.h psbt: have the unknown map 'add' be a 'set' instead 2020-10-20 14:27:19 +10:30
pubkey.c wire: move remaining bitcoin functions out to bitcoin/ files. 2020-05-18 14:51:12 +02:00
pubkey.h pubkey: update comment to reflect location 2020-08-18 11:08:44 +09:30
README Fix typo. 2015-06-25 13:48:05 +09:30
script.c script: break out redeemscript->scriptsig function 2020-10-26 13:04:42 +10:30
script.h script: break out redeemscript->scriptsig function 2020-10-26 13:04:42 +10:30
shadouble.c wire: move remaining bitcoin functions out to bitcoin/ files. 2020-05-18 14:51:12 +02:00
shadouble.h wire: move remaining bitcoin functions out to bitcoin/ files. 2020-05-18 14:51:12 +02:00
short_channel_id.c wire: move towire/fromwire_short_channel_id out to bitcoin/short_channel_id.c 2020-05-18 14:51:12 +02:00
short_channel_id.h wire: move towire/fromwire_short_channel_id out to bitcoin/short_channel_id.c 2020-05-18 14:51:12 +02:00
signature.c bitcoin/signature: wrap libwally call. 2020-11-04 14:28:06 -06:00
signature.h common/wire: move bitcoin-specific marshalling functions into bitcoin files. 2020-05-18 14:51:12 +02:00
tx_parts.c utils: use a cleaner pattern to capture wally allocations. 2020-09-23 14:45:53 +02:00
tx_parts.h bitcoin/tx_parts: infrastructure for partial bitcoin txs. 2020-05-27 10:12:03 +09:30
tx.c tx,bugfix: correct signature length estimate 2020-10-21 11:24:16 +10:30
tx.h wires: towire/fromwire for wally_tx 2020-10-20 12:50:31 +10:30
varint.c varint: Add helper function for getting varlen size 2019-10-10 05:57:45 +00:00
varint.h varint: Add helper function for getting varlen size 2019-10-10 05:57:45 +00:00

These are standard bitcoin manipulation routines which should be
provided by any normal bitcoin library in whatever language you choose.

The ones here are standalone ones taken from bitcoin core and some I
wrote, many taken from bitcoin-iterate and pasted in here.