Commit Graph

145 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
bf3cf9ef3c
input: add ResolutionBlob method to inputKit
We also update breachedOutput w/ the new API.
2024-10-02 18:09:54 -07:00
Olaoluwa Osuntokun
3f50339898
input: refactor all inputs to use MakeBaseInput, add opts
In this commit, we refactor all the other constructors for the input to
use MakeBaseInput. We also add a new set of functional options as well.
This'll be useful later on to ensure that new options are properly
applied to all the input types.
2024-10-02 18:09:53 -07:00
Oliver Gugger
9dfbde7013
lnwallet: thread thru input.AuxTapleaf to all relevant areas
In this commit, we start to thread thru the new aux tap leaf structures to all relevant areas. This includes: commitment outputs, resolution creation, breach handling, and also HTLC scripts.
2024-08-28 13:28:48 +02:00
Olaoluwa Osuntokun
c36cd9298f
input: add some utility type definitions for aux leaves
In this commit, we add some useful type definitions for the aux leaf.
2024-08-28 11:52:32 +02:00
Olaoluwa Osuntokun
1aae47fd71
input+lnwallet: update taproot scripts to accept optional aux leaf
In this commit, we update all the taproot scripts to also accept an
optional aux leaf. This aux leaf can be used to add more redemption
paths for advanced channels, or just as an extra commitment space.
2024-08-28 11:52:31 +02:00
Olaoluwa Osuntokun
2c56b3120a
multi: add new tapscript root option to GenTaprootFundingScript
This'll allow us to create a funding output that uses musig2, but uses a tapscript tweak rather than a normal BIP 86 tweak.
2024-08-28 11:52:31 +02:00
Oliver Gugger
efbaf90caf
lnwallet: add Tree() method, fix formatting 2024-08-23 10:58:13 +02:00
Keagan McClelland
3a15085014
input+lnwallet: refactor select methods in input to use ChannelParty 2024-07-31 14:50:26 -07:00
yyforyongyu
17a089c899
input+lnwallet: apply the new type lntypes.VByte 2024-05-25 13:37:16 +08:00
yyforyongyu
8da68bb7db
multi: apply the new type lntypes.WeightUnit 2024-05-25 13:37:13 +08:00
Oliver Gugger
5cf700d611
Merge pull request #8658 from hidewrong/master
chore: fix struct names
2024-04-24 10:56:20 -06:00
yyforyongyu
e771993785
multi: make input.OutPoint return wire.OutPoint 2024-04-19 21:33:32 +08:00
yyforyongyu
11f7e455d1
lnwallet+sweep: introduce TxPublisher to handle fee bump
This commit adds `TxPublisher` which implements `Bumper` interface. This
is part one of the implementation that focuses on implementing the
`Broadcast` method which guarantees a tx can be published with
RBF-compliant. It does so by leveraging the `testmempoolaccept` API,
keep increasing the fee rate until an RBF-compliant tx is made and
broadcasts it.

This tx will then be monitored by the `TxPublisher` and in the following
commit, the monitoring process will be added.
2024-04-19 21:33:29 +08:00
yyforyongyu
a088501e47
sweep: introduce BudgetAggregator to cluster inputs by deadlines
This commit adds `BudgetAggregator` as a new implementation of
`UtxoAggregator`. This aggregator will group inputs by their deadline
heights and create input sets that can be used directly by the fee
bumper for fee calculations.
2024-04-19 21:33:27 +08:00
hidewrong
8afb978c81 chore: fix struct names
Signed-off-by: hidewrong <hidewrong@outlook.com>
2024-04-17 11:19:31 +08:00
Oliver Gugger
648fb22f63
multi: wrap all errors 2024-04-11 15:04:03 +02:00
Oliver Gugger
1422df27b2
Merge pull request #8521 from zhiqiangxu/typo
chore: fix typo
2024-03-22 01:34:57 -06:00
zhiqiangxu
74a290b46d lnwallet+input: fix a few typoes 2024-03-21 15:44:45 +08:00
Oliver Gugger
90c2926fdf
input: add AddOutput method to TxWeightEstimator
This commit adds a helper method to estimate the weight of an output by
the given pkScript.
2024-02-23 08:58:10 +01:00
Elle Mouton
fde982ad78
input: extract to_local script builders
Factor out the building of the delay and revoke scripts from
NewLocalCommitScriptTree so that they can be re-used later on.
2024-01-18 17:56:48 +02:00
bitcoin-lightning
b72fc9529e docs: fix typos 2023-12-21 15:21:35 +00:00
yyforyongyu
ae09ab2a21
input: use lnutils.SyncMap to store musig2 sessions 2023-11-25 07:25:18 +08:00
Oliver Gugger
b0bb853f77
Merge pull request #8092 from yyforyongyu/fix-peer-unit-test
multi: fix peer unit test and disable `paralleltest`
2023-10-17 10:18:27 +00:00
yyforyongyu
34e0c7b5e0
input+sweep: make sure input with no fee rate is not added to cluster
This commit makes sure an input is only added to the cluster when it has
successfully estimated its fee rate. Previously, when an error is
returned from `feeRateForPreference`, we'd still add this input to the
cluster, resulting a **lower** fee rates being used because when
averaging the fee rates, we'd think this input has zero fee rate
specified.

An unit test is patched to make the method `clusterByLockTime` more
robust.
2023-10-13 17:00:53 +08:00
yyforyongyu
22600b47f1
multi: disable linter paralleltest 2023-10-13 13:50:09 +08:00
Olaoluwa Osuntokun
ce93b236aa
input+lnwallet: modify musig2 interfaces use explicit optional local nonces
In this commit, we modify the musig2 interfaces to instead use an
explicit value for the local nonces. Before this commit, we used the
functional option, but we want to also support specifying this value
over RPC for the remote signer. The functional option pattern is opaque,
so we can't get the nonce value we need. To get around this, we'll just
make this an explicit pointer, then map this to the functional option at
the very last moment.
2023-09-18 11:42:13 -07:00
Olaoluwa Osuntokun
92da6b1d44
multi: fix linter warnings with updated linter 2023-08-22 16:34:47 -07:00
Olaoluwa Osuntokun
a2b277cf1d
multi: fix linter errors 2023-08-22 16:34:15 -07:00
Olaoluwa Osuntokun
4b0139c9ba
lnwallet: update channel state machine to use new ScriptDescriptor interface
In this commit, we update the channel state machine to use the new
ScriptDescriptor interface. This fixes some subtle issues with the
existing commits, as for p2wsh we always sign the same witness script,
but for p2tr, the witness script differs depending on which branch is
taken.

With the new abstractions, we can treat p2wsh and p2tr as the same
mostly, right up until we need to obtain a control block or a tap tweak.

All tests have been updated accordingly.
2023-08-22 16:33:46 -07:00
Olaoluwa Osuntokun
a244a30f32
input: create new ScriptDesciptor interface
In this commit, we add a new interface, the `ScriptDesciptor` to
abstract over details of a given output script. The purpose of this
interface, and the taproot superset, is to be able to paper over the
differences of a p2wsh vs a p2tr output. With this new interface, we can
treat them as the same, but then use a type assertion to get at any
control block related methods if needed.
2023-08-22 16:33:44 -07:00
Olaoluwa Osuntokun
7e2d04a310
contractcourt: update UTXO nursery to support taproot chans 2023-08-22 16:33:42 -07:00
Olaoluwa Osuntokun
fa07a2d248
input: HtlcSucceedInput to support sweeping for taproot chans 2023-08-22 16:33:25 -07:00
Olaoluwa Osuntokun
b00cf25590
input: add new HtlcSecondLevelAnchorInput types for taproot chans 2023-08-22 16:33:22 -07:00
Olaoluwa Osuntokun
b39f5884ad
input: update IsHtlcSpendRevoke for taproot chans
For taproot channels, the revocation witness is a single sig as the
keyspend path is used.
2023-08-22 16:33:17 -07:00
Olaoluwa Osuntokun
8d0435397d
input: add new SecondLevelScriptTree to support second level HTLC spends 2023-08-22 16:32:48 -07:00
Olaoluwa Osuntokun
4c7da7df49
input: update all taproot script spends to optionally make the ctrl block
In this commit, we update all the taproot scripts spends to optionally
make the control block. This is useful in cases where we've already
created the control block, or may not have the items needed to construct
it in the first place.

We also add the control block to the sign descriptor itself.
2023-08-22 16:32:46 -07:00
Olaoluwa Osuntokun
405a435a84
input: add weight estimation + tests for all taproot witness gen types 2023-08-22 16:32:44 -07:00
Olaoluwa Osuntokun
d3c7c51f7e
input: add new witness gen types for all taproot spends 2023-08-22 16:32:42 -07:00
Olaoluwa Osuntokun
a5f67b451e
input: add new ParseSignature helper func 2023-08-22 16:32:37 -07:00
Olaoluwa Osuntokun
349eee3263
input: ensure sessionOpts is properly threaded through 2023-08-22 16:31:47 -07:00
Olaoluwa Osuntokun
001c5b0e0b
input: use multmutex to increase concurrency for musig session manager
By using the multimutex here, we'll no longer rely on a single mutex for
the entire musig session set like we used to. Instead, we can use the
session ID to key into a map of mutexes and use those directly.
2023-08-22 16:30:47 -07:00
Olaoluwa Osuntokun
9a65806c09
input+wallet: extract musig2 session management into new module
In this commit, we extract the musig2 session management into a new
module. This allows us to re-use the session logic elsewhere in unit
tests so we don't need to instantiate the entire wallet.
2023-08-22 16:30:39 -07:00
Olaoluwa Osuntokun
4733da5ccb
input: eliminate CSV trick for HTLC outputs 2023-08-22 16:30:36 -07:00
Olaoluwa Osuntokun
6ce7f5d29e
input: use explicit CSV 1 script for to remote output
We undo the prior hack here to make the final script more readable. The
difference is just 1 byte between the two.
2023-08-22 16:30:34 -07:00
Olaoluwa Osuntokun
0c74f894c4
input: fix linter errors 2023-08-22 16:30:31 -07:00
Olaoluwa Osuntokun
8fc8640432
input: use script path for revocation clause for to_local output
In this commit, we modify the to_local script to use a script path for
the revocation scenario. With this change, we ensure that the internal
key is always revealed which means the anchor outputs can still always
be swept.
2023-08-22 16:30:28 -07:00
Olaoluwa Osuntokun
7f05c765c3
input: restore usage of NUMS key for to_remote output
In this commit, we restore usage of the NUMS key for the to remote
output, as this allows a remote party to scan the chain in order to find
their remote output that in emergency recovery scenarios.
2023-08-22 16:30:26 -07:00
Olaoluwa Osuntokun
5e921376c4
input: add exhaustive unit tests for new taproot scripts 2023-08-22 16:30:23 -07:00
Olaoluwa Osuntokun
b8d1596428
input: add new maybeAppendSighashType helper func 2023-08-22 16:30:20 -07:00
Olaoluwa Osuntokun
3393cc182d
input: add spending funcs for second level HTLC tapscript ctrl blocks 2023-08-22 16:30:18 -07:00