Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
310 commits
Select commit Hold shift + click to select a range
06819a5
Fix annex creation
instagibbs Jul 18, 2022
45b4b90
updating libwally
instagibbs Jul 19, 2022
311b4bc
Thread annex through to sign_tx_taproot_input
instagibbs Jul 19, 2022
84b343a
Don't crudely embed annex witness data in PSBT
instagibbs Jul 19, 2022
f771f07
Complete MuSig signing example in update tx test
instagibbs Jul 20, 2022
fc79496
Maybe signed update tx in test
instagibbs Jul 20, 2022
6ca584f
Funding output only has one script
instagibbs Jul 21, 2022
73b39ca
actually populate the tap merkle root for update funding spend
instagibbs Jul 21, 2022
2886a77
Fix control block for funding update
instagibbs Jul 21, 2022
71b22c9
Fixup signatures a bit for update tx
instagibbs Jul 21, 2022
1dae50d
Incorrect miniscript...
instagibbs Jul 21, 2022
77dc921
Fix test signing of update tx
instagibbs Jul 21, 2022
c6d3134
Refactor update transaction flow to follow actual rebinding flow
instagibbs Jul 25, 2022
26f95dc
Implement annex hint stuff for update to update tx
instagibbs Jul 25, 2022
77da58f
Rename initial_update_tx to update_tx since it's not just initial
instagibbs Jul 26, 2022
b528e91
Delete the copious amount of printing for debugging
instagibbs Jul 26, 2022
5e2c450
Outpoint doesnt make sense to set for non-initial settlement tx
instagibbs Jul 26, 2022
7e84a5e
Checkin
instagibbs Jul 26, 2022
24e91bd
Compiling through
instagibbs Jul 26, 2022
dd71220
Print out 2nd settlement tx
instagibbs Jul 27, 2022
9ecda5a
Spec wrong, and me being wrong...
instagibbs Jul 27, 2022
89a1746
F
instagibbs Jul 27, 2022
8550b36
Check in work
instagibbs Aug 2, 2022
379fbac
openingd_eltoo messages compiling
instagibbs Aug 3, 2022
ab6bb61
Delete reserve requirements from eltoo
instagibbs Aug 3, 2022
75bfa48
Add new files
instagibbs Aug 3, 2022
9da154b
Remove rest of reserve requirement stuff for eltoo
instagibbs Aug 3, 2022
0ba49d3
more reserve removing
instagibbs Aug 3, 2022
f6dc27f
add check_eltoo_config_bounds
instagibbs Aug 3, 2022
ff6b81e
Create funding script helper, use in funder_channel_start
instagibbs Aug 3, 2022
4feee00
More openingd compiling
instagibbs Aug 4, 2022
1e86bcb
Fixup fromwire_openingd_eltoo_funder_start
instagibbs Aug 4, 2022
eb9b870
finish up handle_master_in
instagibbs Aug 4, 2022
5e7c939
All FIXMEs except p2p messages done
instagibbs Aug 4, 2022
cb84fbd
Add eltoo peer wire changes
instagibbs Aug 4, 2022
699fa78
fixup
instagibbs Aug 4, 2022
4475d21
working through compilation....
instagibbs Aug 4, 2022
1047043
Partial sig stuff compiling
instagibbs Aug 4, 2022
0680a7d
All wire messages implemented for openingd eltoo
instagibbs Aug 4, 2022
0e4acfa
Validation wire
instagibbs Aug 4, 2022
01769ea
Make eltoo BOLT processing more narrow
instagibbs Aug 4, 2022
448703d
Synchonize sighash usage
instagibbs Aug 5, 2022
1120670
compiling
instagibbs Aug 5, 2022
a21c4e7
both funding paths done?
instagibbs Aug 5, 2022
15943e3
Add nonce to shutdown_eltoo message
instagibbs Aug 9, 2022
ca72b45
Update HSM signing protocol
instagibbs Aug 9, 2022
6927e14
Checking
instagibbs Aug 9, 2022
b4a0b38
fixup
instagibbs Aug 9, 2022
293f4cb
Implement hsm eltoo channel ready msg
instagibbs Aug 9, 2022
4cf766f
Set hsmd eltoo capabilitiy to HSM_CAP_MASTER
instagibbs Aug 9, 2022
4f95e08
Start implementing partial signature for update tx in hsmd
instagibbs Aug 9, 2022
c49c891
Merge the two peer BOLTs into one CSV
instagibbs Aug 9, 2022
5821a6f
Look for ELTOO opener
instagibbs Aug 9, 2022
452d22d
Refactor everything to use compressed pubkeys except JIT blockchain u…
instagibbs Aug 10, 2022
0b51708
replyreply
instagibbs Aug 10, 2022
0e071fa
fixup null ptrs for keyagg_cache
instagibbs Aug 10, 2022
15f9ead
Psigs have stringified
instagibbs Aug 10, 2022
94c26d5
Don't use eltoo_keyset in openenind, yet
instagibbs Aug 10, 2022
6e73830
Fixups, why didn't channel reserve stop working long ago....
instagibbs Aug 10, 2022
48cd053
Generate nonce for channel
instagibbs Aug 10, 2022
fd37e54
Get peer_ir and dbid from hsm_client...?
instagibbs Aug 10, 2022
c4c9f2b
Start adding eltoo channeld stuff
instagibbs Aug 11, 2022
f6608aa
put nonces into keyset
instagibbs Aug 12, 2022
08424bb
put nonces into keyset
instagibbs Aug 12, 2022
3c1b5f7
Stuff compiling, reworked musig session flow
instagibbs Aug 15, 2022
94e4664
Many changes
instagibbs Aug 16, 2022
7e87053
start compiling
instagibbs Aug 18, 2022
0f7fcdc
more compiling
instagibbs Aug 18, 2022
188874a
eltoo_channeld starting to compile
instagibbs Aug 18, 2022
f40ee4b
Adding more files
instagibbs Aug 18, 2022
604550d
get rid of eltoo_channel_config
instagibbs Aug 19, 2022
b2cf216
Working on compiling/deduping...
instagibbs Aug 19, 2022
871e11d
eltoo_channeld compiling
instagibbs Aug 29, 2022
0836276
Thread through some more reestablishment state
instagibbs Aug 29, 2022
8be6ae5
fixup extra shared_delay serialization
instagibbs Aug 31, 2022
f635454
set eltoo channel to false for now
instagibbs Sep 1, 2022
294b6ff
More motion towards eltoo fundchannel
instagibbs Sep 1, 2022
4cdb5ca
Try threading through settle pubkey from hsmd
instagibbs Sep 2, 2022
5c1c1c7
bunch of stuff
instagibbs Sep 2, 2022
36c7111
keyset shenanigans for opening
instagibbs Sep 2, 2022
f50c6d1
keyset shenanigans for opening
instagibbs Sep 2, 2022
bb50347
stop sending hsmd messages to peers...
instagibbs Sep 2, 2022
3004a74
more bullish errors
instagibbs Sep 2, 2022
3263593
workshop delays in config
instagibbs Sep 2, 2022
6e4fa01
enable printing of partial sigs
instagibbs Sep 2, 2022
3b047d7
nice bug
instagibbs Sep 6, 2022
d945738
save progress
instagibbs Sep 6, 2022
ba89425
Nonces working
instagibbs Sep 6, 2022
17694b7
Maybe will fire off normal channel operation
instagibbs Sep 7, 2022
1279257
failing at channeld creation :)
instagibbs Sep 7, 2022
3c153a0
maybe eltoo_channeld starts
instagibbs Sep 7, 2022
17a7892
more settle key stuff
instagibbs Sep 7, 2022
9306c64
Thinking of removing settle_pubkey in favor or remote basepoint
instagibbs Sep 7, 2022
3598da3
Attempt to reuse payment basepoint as settle pubkey
instagibbs Sep 7, 2022
077b4f2
lock-in sanity checks for 2-of-2 CMS failing
instagibbs Sep 7, 2022
7d3db0d
disable sanity checks and signature announcements for now
instagibbs Sep 7, 2022
d453338
reloading working a bit
instagibbs Sep 7, 2022
6dd8eca
shared_delay seems to be loading properly
instagibbs Sep 7, 2022
5c86729
refactor bind_update_tx_to_* to take bip340sig
instagibbs Sep 8, 2022
b5e7417
onchaind explodes when it sees update tx, yay
instagibbs Sep 8, 2022
c22cd24
put obvioulsy bogus prevout in settlement tx instead of funding outpu…
instagibbs Sep 8, 2022
75288dc
eltoo CHANNELD_NORMAL achieved
instagibbs Sep 8, 2022
07dc64b
dev-debgger causing msg issues, working on htlc
instagibbs Sep 12, 2022
5bc348d
Rework what data is passed from opening to channel... explosions surely
instagibbs Sep 13, 2022
83b46d8
Back to where I was before with paying invoice broken
instagibbs Sep 13, 2022
f905cd6
Try to move htlc resolution forward
instagibbs Sep 14, 2022
e9f5659
Getting all the way to ACK construction
instagibbs Sep 14, 2022
aeca365
Push forward on responding to updatesig
instagibbs Sep 15, 2022
6464966
ACK being received, stalling after
instagibbs Sep 15, 2022
259aba3
Some more ACK handling
instagibbs Sep 15, 2022
ef87b11
Checkin HTLC work, MuSig for htlc removal failing
instagibbs Sep 17, 2022
a0d274b
Trivial single payment is clearing
instagibbs Sep 19, 2022
bddad12
l2-cli now sees the htlc as resolving, working on l1-cli
instagibbs Sep 20, 2022
caad8a9
Comment out unknown things
instagibbs Sep 20, 2022
da88915
Remove pubnonce storage from hsmd
instagibbs Sep 21, 2022
2f08fcd
Multichannel musig working?
instagibbs Sep 21, 2022
276d570
test script with three nodes going
instagibbs Sep 21, 2022
b2f828a
single hop example working
instagibbs Sep 22, 2022
a6bfce8
Bit more logging for debugging
instagibbs Sep 22, 2022
7287351
Create eltoo_onchaind, need to auto-rebind update/settle tx still
instagibbs Sep 22, 2022
891adb5
Enough to trigger and explode the new subd
instagibbs Sep 22, 2022
20c16ed
eltoo_onchaind is alive
instagibbs Sep 26, 2022
0c6318b
Expose update/settle txs in rpc, propagate txs to onchaind
instagibbs Sep 27, 2022
1334e87
RPC endpoint serving up funding-output-bound update/settle txs
instagibbs Sep 27, 2022
7ddd295
rework rebinding a bit
instagibbs Sep 28, 2022
68bc3f9
Implement bind_txs_to_funding_outpoint with sane interface for fundin…
instagibbs Sep 28, 2022
407f8b8
lightning now fires off funding output bound update tx when channel f…
instagibbs Sep 28, 2022
415c6ea
eltoo_onchaind: track funding output
instagibbs Sep 28, 2022
f7ff516
oops, add eltoo onchaind
instagibbs Sep 28, 2022
f97557b
Compiling with some close handling
instagibbs Sep 29, 2022
17f095a
Stick closer to the legacy flow for now
instagibbs Sep 30, 2022
259b2e3
Stuff crashing because I'm not handling eltoo_onchaind responses...
instagibbs Sep 30, 2022
12d7c61
Start handling a bunch more messages
instagibbs Oct 17, 2022
3f6fb84
Send committed but not completed transactions to lightningd
instagibbs Nov 14, 2022
ea2726c
moved around tx signing state to aid support for committed but not co…
instagibbs Nov 14, 2022
49556de
f
instagibbs Nov 15, 2022
7de064b
pass around committed state all the way to onchaind
instagibbs Nov 16, 2022
9405cef
Wrong enum for ELTOO_UPDATE
instagibbs Nov 17, 2022
a008790
Add binding of settlement tx for onchaind
instagibbs Nov 18, 2022
04f6944
Mutual close is locktime of 0
instagibbs Nov 18, 2022
7f9e27e
migrate more over to eltoo
instagibbs Nov 18, 2022
e612322
fixup tx type
instagibbs Nov 18, 2022
4859237
Basic settlement broadcasting works
instagibbs Nov 18, 2022
fa4fa45
Sync up tx format with BOLT, update handling
instagibbs Nov 22, 2022
032552f
Fixup state updates in lightningd, both eltoo_onchainds should match …
instagibbs Nov 23, 2022
8419032
Fixup eltoo_onchaind lifetime of htlc scripts
instagibbs Nov 23, 2022
1410fb1
eltoo_onchaind resolves when no htlcs left
instagibbs Nov 28, 2022
bfaf193
fixup unit test with updated tx format
instagibbs Nov 30, 2022
b765ae4
Add locktime to onchaind_spent message
instagibbs Nov 30, 2022
1e3a162
test success message
instagibbs Nov 30, 2022
78af159
maybe support initial rebinding of invalidated update transactions
instagibbs Nov 30, 2022
88df57f
propose fixed update tx
instagibbs Nov 30, 2022
1a29502
Testing out handling old updates for funding output spend
instagibbs Nov 30, 2022
b43fa45
add/remove comments
instagibbs Nov 30, 2022
36e9ec3
Expose rebound update txns over RPC, fix some bugs
instagibbs Dec 2, 2022
07812b9
Add untested hooks to introspect committed settle tx in RPC
instagibbs Dec 2, 2022
b9c92d2
onchaind state machine up to HTLC resolution
instagibbs Dec 5, 2022
c1d15a2
Add htlc feerate to eltoo_onchaind
instagibbs Dec 5, 2022
9fd4693
HTLC timeout resolution implemented except for final witness construc…
instagibbs Dec 7, 2022
62c1950
Create witness construction for HTLC resolutions
instagibbs Dec 8, 2022
99d1329
Implement HTLC success txns
instagibbs Dec 8, 2022
2e69459
Cache preimages prior to settle phase
instagibbs Dec 8, 2022
ca2ff8e
Add schema changes for eltoo json
instagibbs Dec 12, 2022
ad90a38
Start some proper testing of HTLC resolution
instagibbs Dec 12, 2022
ce44ec7
more test
instagibbs Dec 12, 2022
85f4e18
HTLC resolution crashing now
instagibbs Dec 13, 2022
e09b911
Stuff to revert?
instagibbs Dec 13, 2022
ebfb4ef
some notes
instagibbs Dec 13, 2022
c8898fc
fix ripemd of htlc payment hash, reorder keys for contract
instagibbs Dec 14, 2022
f20ed29
Don't sizeof a pointer...
instagibbs Dec 14, 2022
983080d
fixup add_eltoo_htlc_out side arg, revert key ordering
instagibbs Dec 14, 2022
545446d
Both HTLC txns being handled... and crashing in hsmd
instagibbs Dec 14, 2022
67f54cd
fixup some hsmd signing stuff
instagibbs Dec 14, 2022
0917801
unroll taphashing, more printing
instagibbs Dec 15, 2022
4896fe3
Add more belt and suspender check for tapleafs
instagibbs Dec 15, 2022
6737431
WRONG PUBKEYS OMG
instagibbs Dec 15, 2022
4906dfc
F
instagibbs Dec 15, 2022
6237a78
HTLC txns are being mined/replaced
instagibbs Dec 15, 2022
4bbe333
Fix preimage fetching from success tx
instagibbs Dec 16, 2022
f92dbc5
Test runs until end... plus memory leaks
instagibbs Dec 16, 2022
3b19d0a
Test runs until end... plus memory leaks
instagibbs Dec 16, 2022
3df193d
Test runs until end... plus memory leaks
instagibbs Dec 16, 2022
e96efd8
cleanup htlc eltoo test
instagibbs Dec 19, 2022
9043cff
cleanup htlc eltoo test
instagibbs Dec 19, 2022
44df497
Tests for all working scenarioes
instagibbs Dec 19, 2022
13033ad
Silence memory leaks
instagibbs Dec 19, 2022
9ba272c
f
instagibbs Dec 19, 2022
a7e2766
Implement turn-taking ala Simplified Update
instagibbs Dec 20, 2022
6b507e9
Fixup eltoo_channeld transaction tracking
instagibbs Dec 21, 2022
1264c07
Start implementing reconnection logic
instagibbs Dec 21, 2022
52de5de
Maybe implemented channel reestablishment
instagibbs Jan 4, 2023
a540bde
Start writing test for reestablishment
instagibbs Jan 5, 2023
0b852b5
Move eltoo tests to own thing
instagibbs Jan 5, 2023
3e8cde7
oops s/gen/regen/
instagibbs Jan 5, 2023
5c9efdd
test_eltoo_offerer_ack_reestablishment failing with bad combine_psig …
instagibbs Jan 5, 2023
8cfb216
ostensibly complete basic reestablishment tests
instagibbs Jan 5, 2023
5754e5a
Fixup committed state in lightningd
instagibbs Jan 6, 2023
dd20886
test_eltoo_offerer_ack_reestablishment working
instagibbs Jan 6, 2023
6ee57be
Add some asserts that should break in other cases
instagibbs Jan 6, 2023
8b0173a
More plausible support for reestablishments during htlc removal
instagibbs Jan 6, 2023
c9fb135
Test another uncommited reestablishment scenario
instagibbs Jan 6, 2023
a60d163
fixup one test where it breaks
instagibbs Jan 6, 2023
520c26a
uneven test working, need to cleanup keyagg cache lifecycle
instagibbs Jan 9, 2023
ced8c31
Send failures instead of crashing hsmd on combine failure
instagibbs Jan 9, 2023
acaccaa
rephrase
instagibbs Jan 9, 2023
2e2c2a6
untested: fix the commit-to-no-taptree musig implementation
instagibbs Feb 21, 2023
fc4e108
Revert "untested: fix the commit-to-no-taptree musig implementation"
instagibbs Feb 21, 2023
40efcd3
Adapt eltoo implementation to bitcoin-inquisition annex support
instagibbs Mar 14, 2023
ff47a5d
fixup compute_control_block
instagibbs Mar 16, 2023
38605cb
Have update txns get an ephemeral anchor, remove test's prioritisetra…
instagibbs Mar 16, 2023
258e014
vibe mempool updates
instagibbs Jan 15, 2026
9a04a4b
fixup regression test
instagibbs Jan 15, 2026
ef728d9
compiling, all but one unit test passing
instagibbs Jan 16, 2026
dfa68a8
unit tests pass
instagibbs Jan 16, 2026
ff8f6a7
remove debug stuff
instagibbs Jan 16, 2026
67c6ac7
checkin
instagibbs Jan 16, 2026
411a8b3
grinding
instagibbs Jan 16, 2026
676be29
screaming at claude
instagibbs Jan 16, 2026
d46d975
checkpoint
instagibbs Jan 16, 2026
fd09a4f
checkin
instagibbs Jan 17, 2026
b0682f0
state
instagibbs Jan 17, 2026
aab060a
fixup
instagibbs Jan 17, 2026
b87e425
reestablish test passing?
instagibbs Jan 17, 2026
2a5e3cc
fix test_eltoo_unannounced_hop
instagibbs Jan 18, 2026
cb799cc
fix test_eltoo_offerer_ack_reestablishment and test_eltoo_uneven_rees…
instagibbs Jan 18, 2026
0fa9947
tests passing?
instagibbs Jan 18, 2026
2e6e15f
all but htlc test passing
instagibbs Jan 18, 2026
da98ba0
bind tx before returning via rpc
instagibbs Jan 18, 2026
0260201
all but eltoo_onchaind?
instagibbs Jan 18, 2026
b8ec126
all eltoo tests passing
instagibbs Jan 18, 2026
b3ae278
Add a few node restart tests
instagibbs Jan 19, 2026
1d7be77
fix turn taking
instagibbs Jan 19, 2026
358c284
sync up with BOLT draft, no need for CSV(1)
instagibbs Jan 19, 2026
3e55120
BOLT-compliant (and miniscript compat) HTLC Timeout
instagibbs Jan 19, 2026
a265953
fix linking issues
instagibbs Jan 19, 2026
dd52e5b
removed erroneous checkins
instagibbs Jan 19, 2026
0505b6a
update libwally to fixed version
instagibbs Jan 19, 2026
8b6dd37
Never send updates not on our turn to avoid races on restart
instagibbs Jan 19, 2026
798f3a2
preemptively send yield on reconnection if nothing to do
instagibbs Jan 20, 2026
996ab32
move annex commitment to an op_return
instagibbs Jan 20, 2026
2527cef
Trim value to anchor, test for dust balance
instagibbs Jan 20, 2026
a9914d6
Unit test for trimmed htlc value going to anchor
instagibbs Jan 20, 2026
7e68bc5
coop close for eltoo
instagibbs Jan 20, 2026
8a167af
F
instagibbs Jan 20, 2026
53fc89e
simplify jank eltoo close
instagibbs Jan 21, 2026
55c1ce5
Fix settle tx balance tracking
instagibbs Jan 21, 2026
74f6ceb
Fix HTLC sweep tracking
instagibbs Jan 21, 2026
439242c
We know update output ordering is fixed, help remove errors
instagibbs Jan 21, 2026
03ee725
test: Add coverage for non-funding update tx spend
instagibbs Jan 23, 2026
c771083
OP_TEMPLATEHASH migration compiles, passes unit test
instagibbs Jan 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
url = https://github.com/ianlancetaylor/libbacktrace.git
[submodule "external/libwally-core"]
path = external/libwally-core
url = https://github.com/ElementsProject/libwally-core.git
url = https://github.com/instagibbs/libwally-core.git
ignore = dirty
branch = bip118fix
[submodule "external/gheap"]
path = external/gheap
url = https://github.com/valyala/gheap
32 changes: 31 additions & 1 deletion .msggen.json
Original file line number Diff line number Diff line change
Expand Up @@ -2928,8 +2928,13 @@
"ListPeerChannels.channels[].inflight[]": 16,
"ListPeerChannels.channels[].initial_feerate": 12,
"ListPeerChannels.channels[].last_feerate": 13,
"ListPeerChannels.channels[].last_settle_tx": 65,
"ListPeerChannels.channels[].last_settle_tx_unbound": 67,
"ListPeerChannels.channels[].last_stable_connection": 56,
"ListPeerChannels.channels[].last_tx": 63,
"ListPeerChannels.channels[].last_tx_fee_msat": 59,
"ListPeerChannels.channels[].last_update_tx": 64,
"ListPeerChannels.channels[].last_update_tx_unbound": 66,
"ListPeerChannels.channels[].lost_state": 57,
"ListPeerChannels.channels[].max_accepted_htlcs": 40,
"ListPeerChannels.channels[].max_to_us_msat": 25,
Expand Down Expand Up @@ -3070,7 +3075,10 @@
"ListPeers.peers[].channels[].in_payments_offered": 38,
"ListPeers.peers[].channels[].inflight[]": 13,
"ListPeers.peers[].channels[].initial_feerate": 9,
"ListPeers.peers[].channels[].last_committed_settle_tx": 54,
"ListPeers.peers[].channels[].last_feerate": 10,
"ListPeers.peers[].channels[].last_settle_tx": 51,
"ListPeers.peers[].channels[].last_update_tx": 50,
"ListPeers.peers[].channels[].max_accepted_htlcs": 35,
"ListPeers.peers[].channels[].max_to_us_msat": 22,
"ListPeers.peers[].channels[].max_total_htlc_in_msat": 27,
Expand Down Expand Up @@ -3099,7 +3107,9 @@
"ListPeers.peers[].channels[].their_reserve_msat": 28,
"ListPeers.peers[].channels[].their_to_self_delay": 33,
"ListPeers.peers[].channels[].to_us_msat": 20,
"ListPeers.peers[].channels[].total_msat": 23
"ListPeers.peers[].channels[].total_msat": 23,
"ListPeers.peers[].channels[].unbound_settle_tx": 53,
"ListPeers.peers[].channels[].unbound_update_tx": 52
},
"ListpeersPeersChannelsAlias": {
"ListPeers.peers[].channels[].alias.local": 1,
Expand Down Expand Up @@ -10920,14 +10930,34 @@
"added": "v23.02",
"deprecated": null
},
"ListPeerChannels.channels[].last_settle_tx": {
"added": "pre-v0.10.1",
"deprecated": null
},
"ListPeerChannels.channels[].last_settle_tx_unbound": {
"added": "pre-v0.10.1",
"deprecated": null
},
"ListPeerChannels.channels[].last_stable_connection": {
"added": "v24.02",
"deprecated": null
},
"ListPeerChannels.channels[].last_tx": {
"added": "pre-v0.10.1",
"deprecated": null
},
"ListPeerChannels.channels[].last_tx_fee_msat": {
"added": "pre-v0.10.1",
"deprecated": null
},
"ListPeerChannels.channels[].last_update_tx": {
"added": "pre-v0.10.1",
"deprecated": null
},
"ListPeerChannels.channels[].last_update_tx_unbound": {
"added": "pre-v0.10.1",
"deprecated": null
},
"ListPeerChannels.channels[].lost_state": {
"added": "v24.02",
"deprecated": null
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ PKGLIBEXEC_PROGRAMS = \
lightningd/lightning_hsmd \
lightningd/lightning_onchaind \
lightningd/lightning_openingd \
lightningd/lightning_eltoo_openingd \
lightningd/lightning_websocketd

mkdocs.yml: $(MANPAGES:=.md)
Expand Down
16 changes: 13 additions & 3 deletions bitcoin/psbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,18 @@ size_t psbt_input_get_weight(const struct wally_psbt *psbt,
return weight;
}

const unsigned char *psbt_input_get_scriptpubkey(const struct wally_psbt *psbt,
size_t in)
{
if (psbt->inputs[in].witness_utxo) {
return psbt->inputs[in].witness_utxo->script;
} else if (psbt->inputs[in].utxo) {
/* PSBTv2: index is stored directly in the input, not in psbt->tx */
return psbt->inputs[in].utxo->outputs[psbt->inputs[in].index].script;
} else {
abort();
}
}
struct amount_sat psbt_output_get_amount(const struct wally_psbt *psbt,
size_t out)
{
Expand Down Expand Up @@ -845,11 +857,9 @@ struct wally_psbt *psbt_from_b64(const tal_t *ctx,
char *fmt_wally_psbt(const tal_t *ctx, const struct wally_psbt *psbt)
{
char *serialized_psbt;
int ret;

tal_wally_start();
ret = wally_psbt_to_base64(psbt, 0, &serialized_psbt);
assert(ret == WALLY_OK);
assert(wally_psbt_to_base64(psbt, 0, &serialized_psbt) == WALLY_OK);
tal_wally_end_onto(ctx, serialized_psbt, char);

return serialized_psbt;
Expand Down
8 changes: 8 additions & 0 deletions bitcoin/psbt.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,14 @@ struct amount_sat psbt_input_get_amount(const struct wally_psbt *psbt,
size_t psbt_input_get_weight(const struct wally_psbt *psbt,
size_t in);

/* psbt_input_get_scriptpubkey - Returns pointer to the input's scriptPubKey
*
* @psbt - psbt
* in - index of input whose value script returning
*/
const unsigned char *psbt_input_get_scriptpubkey(const struct wally_psbt *psbt,
size_t in);

/* psbt_output_get_amount - Returns the value of this output
*
* @psbt - psbt
Expand Down
80 changes: 80 additions & 0 deletions bitcoin/pubkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,83 @@ void towire_pubkey(u8 **pptr, const struct pubkey *pubkey)

towire(pptr, output, outputlen);
}

void fromwire_point32(const u8 **cursor, size_t *max, struct point32 *point32)
{
u8 raw[32];

if (!fromwire(cursor, max, raw, sizeof(raw)))
return;

if (secp256k1_xonly_pubkey_parse(secp256k1_ctx,
&point32->pubkey,
raw) != 1) {
SUPERVERBOSE("not a valid point");
fromwire_fail(cursor, max);
}
}

void towire_point32(u8 **pptr, const struct point32 *point32)
{
u8 output[32];

secp256k1_xonly_pubkey_serialize(secp256k1_ctx, output,
&point32->pubkey);
towire(pptr, output, sizeof(output));
}

void fromwire_nonce(const u8 **cursor, size_t *max, struct nonce *nonce)
{
u8 raw[66];

if (!fromwire(cursor, max, raw, sizeof(raw)))
return;

if (!secp256k1_musig_pubnonce_parse(secp256k1_ctx,
&nonce->nonce,
raw)) {
SUPERVERBOSE("not a valid musig nonce");
fromwire_fail(cursor, max);
}
}

void towire_nonce(u8 **pptr, const struct nonce *nonce)
{
u8 nonce_output[66];

secp256k1_musig_pubnonce_serialize(secp256k1_ctx,
nonce_output,
&nonce->nonce);

towire(pptr, nonce_output, sizeof(nonce_output));
}

static char *point32_to_hexstr(const tal_t *ctx, const struct point32 *point32)
{
u8 output[32];

secp256k1_xonly_pubkey_serialize(secp256k1_ctx, output,
&point32->pubkey);
return tal_hexstr(ctx, output, sizeof(output));
}

char *fmt_point32(const tal_t *ctx, const struct point32 *point32)
{
return point32_to_hexstr(ctx, point32);
}

static char *nonce_to_hexstr(const tal_t *ctx, const struct nonce *nonce)
{
u8 nonce_output[66];

secp256k1_musig_pubnonce_serialize(secp256k1_ctx,
nonce_output,
&nonce->nonce);

return tal_hexstr(ctx, nonce_output, sizeof(nonce_output));
}

char *fmt_nonce(const tal_t *ctx, const struct nonce *nonce)
{
return nonce_to_hexstr(ctx, nonce);
}
29 changes: 29 additions & 0 deletions bitcoin/pubkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <ccan/structeq/structeq.h>
#include <ccan/tal/tal.h>
#include <secp256k1_extrakeys.h>
#include <secp256k1_musig.h>

struct privkey;
struct secret;
Expand All @@ -19,6 +20,18 @@ struct pubkey {
/* Define pubkey_eq (no padding) */
STRUCTEQ_DEF(pubkey, 0, pubkey.data);

struct point32 {
/* Unpacked pubkey (as used by libsecp256k1 internally) */
secp256k1_xonly_pubkey pubkey;
};
/* Define pubkey_eq (no padding) */
STRUCTEQ_DEF(point32, 0, pubkey.data);

struct nonce {
/* Un-aggregated public nonce for MuSig2 */
secp256k1_musig_pubnonce nonce;
};

/* Convert from hex string of DER (scriptPubKey from validateaddress) */
bool pubkey_from_hexstr(const char *derstr, size_t derlen, struct pubkey *key);

Expand Down Expand Up @@ -57,4 +70,20 @@ void pubkey_to_hash160(const struct pubkey *pk, struct ripemd160 *hash);
void towire_pubkey(u8 **pptr, const struct pubkey *pubkey);
void fromwire_pubkey(const u8 **cursor, size_t *max, struct pubkey *pubkey);

/* FIXME: Old spec uses pubkey32 */
#define pubkey32 point32
#define towire_pubkey32 towire_point32
#define fromwire_pubkey32 fromwire_point32

/* marshal/unmarshal functions */
void towire_point32(u8 **pptr, const struct point32 *pubkey);
void fromwire_point32(const u8 **cursor, size_t *max, struct point32 *pubkey);

void towire_nonce(u8 **pptr, const struct nonce *nonce);
void fromwire_nonce(const u8 **cursor, size_t *max, struct nonce *nonce);

/* Formatting functions */
char *fmt_point32(const tal_t *ctx, const struct point32 *point32);
char *fmt_nonce(const tal_t *ctx, const struct nonce *nonce);

#endif /* LIGHTNING_BITCOIN_PUBKEY_H */
Loading