1891 Commits
Author SHA1 Message Date
Keagan McClelland 3a02f2ba65 lnwallet: use ResetState instead of tweaking private rows 2024-02-02 11:46:32 -08:00
Keagan McClelland 606f8e79d1 lnwallet: rewrite channelState to bool for clarity
Over the last few commits we have systematically eliminated all but
two states. This allows us to replace it with a boolean to encode
the two remaining states. We would like to be able to eliminate this
field entirely, but doing so requires being able to prove that the
concurrent request block is necessary. This is more difficult and
will be left to future commits.
2024-02-02 11:46:32 -08:00
Keagan McClelland 17e67348a8 lnwallet: remove unused channelPending channelState
lnwallet: remove unused channelPendingPayment channelState

Since this state is never set nor read, we remove it completely.

lnwallet: remove redundant channelDispute channelState

In this case, even though we do set this value, it is never read.
Further, the times we read the field at all from LightningChannel
we want the situation of force-closure to block any other
concurrent closure attempts, so we change the sites where we set
channelDispute to channelClosed.

lnwallet: remove redundant channelClosing channelStatus

This value is never used to impact control flow so we need not set
it. We also need not have it.
2024-02-02 11:46:20 -08:00
Keagan McClelland 4e6b1cda49 lnwallet: change channelDispute to channelClosed so errors are handled 2024-02-02 11:40:22 -08:00
Olaoluwa Osuntokun d44c72b979 Merge pull request #8345 from yyforyongyu/use-testmempoolaccept
lnwallet: perform mempool acceptance check before publishing
2024-01-26 18:54:43 -08:00
yyforyongyu a614888797 lnwallet/test: fix testPublishTransaction for neutrino 2024-01-26 03:01:20 +08:00
yyforyongyu d2ab35629a lnwallet/test: fix ZMQ format 2024-01-26 03:01:20 +08:00
Keagan McClelland 9c2270a5ea lnwallet: remove redundant unused fields 2024-01-24 17:22:35 -08:00
yyforyongyu 783e914027 lnwallet/test: stop creating burning tx in tests
bitcoind v25.0 updated the `sendrawtransaction` RPC to have an optional
argument `maxburnamount` with a default value of 0. This means our
existing test that uses burning output cannot be published, hence, we
remove the usage of it in our tests and replace it with a normal tx.
2024-01-25 08:45:22 +08:00
Olaoluwa Osuntokun 11bafe84ff lnwallet/test: add new tx publish sub-test for policy weight limits 2024-01-25 08:45:22 +08:00
Olaoluwa Osuntokun a616fa3fb7 lnwallet/test: convert the tx publish tests to sub-tests 2024-01-25 08:21:11 +08:00
yyforyongyu fb1c6ea6a7 btcwallet: proceed to call PublishTransaction on mempool errors
Previously, `PublishTransaction` in `btcwallet` will first mark the tx
label in db first before broadcasting it to the network. Even though the
broadcast may fail with the error already in mempool or already
confirmed, this tx label updating is still performed. To maintain the
old behavior, we now catch the errors from `TestMempoolAccept`, and make
sure to call the `PublishTransaction` to mark the tx label even there
are errors from mempool acceptance check.
2024-01-25 07:54:39 +08:00
yyforyongyu 2686ca324a lnwallet: check mempool acceptance before publishing
This commit adds a mempool acceptance check before broadcasting a given
transaction. To maintain the current behavior from
`BtcWallet.PublishTransaction`, the two errors, `ErrInMempool` and
`ErrAlreadyConfirmed` returned from `TestMempoolAccept` are ignored.
2024-01-25 07:54:39 +08:00
Keagan McClelland 64fda6ca65 htlcswitch: implement flush and commit lifecycle hooks for channelLink 2024-01-22 16:08:55 -08:00
Keagan McClelland 6955dc9f12 chancloser: remove ProcessCloseMsg 2024-01-22 12:19:58 -08:00
Keagan McClelland 704eb84bcb chancloser: rewrite tests in terms of new ChanCloser methods 2024-01-22 12:19:58 -08:00
Keagan McClelland 7b08899cdb chancloser: cache remote ClosingSigned to deal with race 2024-01-22 12:19:58 -08:00
Keagan McClelland 3aceeea4f3 chancloser: move nil MarkCoopBroadcasted to BeginNegotiation 2024-01-22 12:19:58 -08:00
Keagan McClelland 1b0f97a483 chancloser: move initFeeBaseline to BeginNegotiation 2024-01-22 12:19:58 -08:00
Keagan McClelland 45d30af273 chancloser: add BeginNegotiation method to bridge phases 2024-01-22 12:19:58 -08:00
Keagan McClelland e77d3adef2 chancloser: extract ProcessCloseMsg ClosingSigned handling logic into dedicated method 2024-01-22 12:19:58 -08:00
Keagan McClelland 6fef9ea2d7 chancloser: extract ProcessCloseMsg Shutdown handling logic into dedicated method 2024-01-22 12:19:58 -08:00
Keagan McClelland 30ad49a29d chancloser: add new closeAwaitingFlushState 2024-01-22 12:19:58 -08:00
Yong 26c466aa80 Merge pull request #8372 from mohamedawnallah/deep-copy-transactions-GetBlock
routing: deep copy any transaction we obtain from `GetBlock` call.
2024-01-15 20:13:00 +08:00
Mohamed Awnallah 99908ed2dc routing: deep copy any transaciton we obtain from GetBlock call. 2024-01-15 11:35:55 +02:00
ziggie 51c56d2825 lnwallet: add underflow check when computing balance. 2024-01-06 20:52:46 +01:00
ziggie 0b63989f3a lnwallet+htlcswitch: Introduce a fee buffer.
We take into account a fee buffer of twice the current fee rate
of the commitment transaction plus an additional htlc output
when we are the opener of the channel hence pay when publishing the
commitment transaction. This buffer is not consensus critical
because we only consider it when we are in control of adding a
new htlc to the state. The goal is to prevent situations
where we push our local balance below our channel reserve due to
parallel adding of htlcs to the state. Its not a panacea for these
situations but until we have __option_simplified_update__ deployed
widely on the network its a good precaution to protect against
fee spikes and parallel adding of htlcs to the update log.

Moreover the way the available balance for a channel changed.
We now need to account for a fee buffer when we are the channel
opener. Therefore all the tests had to be adopted.
2024-01-06 20:52:46 +01:00
Afanti 452b2d5a80 fix: remove duplicate words [skip ci]
There are some unnecessary duplicate words in the source file. Use this change to remove them. The CI can be skipped.
2024-01-04 04:47:03 +08:00
ziggie 45a3bf333b lnwallet: fix logging. 2023-12-22 17:36:41 +01:00
erik 16f05105c1 itest: add gettransactiondetails 2023-12-10 22:14:18 +01:00
ErikEk f0bc6d804c rpc: add gettransaction endpoint to walletrpc sub-server 2023-12-10 22:14:12 +01:00
yyforyongyu 1ee665d14c lnwallet: make sure loop var is properly referenced 2023-11-28 14:06:53 +08:00
yyforyongyu 81841b7dab lnwallet: add unit test for extractPayDescs 2023-11-28 14:06:53 +08:00
Olaoluwa Osuntokun dacb86fdbc Merge pull request #8106 from orbitalturtle/sign-tagged-hash-rpc
lnrpc: add tagged hash option to signer.SignMessage/VerifyMessage rpcs
2023-11-06 17:05:35 -08:00
Eugene Siegel dc42b160a0 multi: skip InitRemoteMusigNonces if we've already called it
Prior to this commit, taproot channels had a bug:

- If a disconnect happened before peer.AddNewChannel was called,
  then the subsequent reconnect would call peer.AddNewChannel and
  attempt the ChannelReestablish dance.

- peer.AddNewChannel would call NewLightningChannel with
  populated nonce ChannelOpts. This in turn would call
  InitRemoteMusigNonces which would create a new musig pair session
  and set the channel's pendingVerificationNonce to nil.

- During the reestablish dance, ProcessChanSyncMsg would be called.
  This would also call InitRemoteMusigNonces, except it would fail
  since pendingVerificationNonce was set to nil in the previous
  invocation.

To fix this, we add a new functional option to signal to the init logic
that it doesn't need to call InitRemoteMusigNonces in   in
ProcessChanSyncMsg.
2023-10-31 10:10:35 -07:00
Orbital ed373baed0 multi: add tag option to SignMessageSchnorr 2023-10-30 21:39:39 -05:00
Olaoluwa Osuntokun 19880ffe2c Merge pull request #8101 from yyforyongyu/fix-web-fee-unit-test
chainfee: Fix test flake in `TestWebAPIFeeEstimator`
2023-10-30 10:50:16 -07:00
yyforyongyu 3c62ba57d3 chainfee: make timeout values constant 2023-10-29 13:24:28 +08:00
yyforyongyu 090892c613 chainfee: use proper mock for WebAPIFeeSource in tests 2023-10-29 13:24:27 +08:00
yyforyongyu efcba4a836 chainfee: simplify WebAPIFeeSource interface
This commit removes the interface methods `GenQueryURL` and
`ParseResponse` so the `WebAPIEstimator` can care less about the
implementation details of this interface.
2023-10-29 13:24:27 +08:00
yyforyongyu 8ca48311ee chainfee: add a new interface method GetFeeMap
This commit adds a new method `GetFeeMap` to handle querying the web API
and parse the response into a map that's used by the fee estimator. In
doing so we can provide a deeper abstraction over the `WebAPIFeeSource`
interface.
2023-10-29 13:24:27 +08:00
Jonathan Harvey-Buschel 6edd1e1220 multi: add GetBlockHeader to BlockChainIO 2023-10-27 11:05:27 -04: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
Oliver Gugger e8d865aba5 Merge pull request #7824 from yyforyongyu/sweeper-unit-test
input+sweep: make sure input with no fee rate is not added to cluster
2023-10-17 06:36:21 +00:00
guangwu fad7d3fe81 chore: pkg import only once (#8093)
Signed-off-by: guoguangwu <guoguangwu@magic-shield.com>
2023-10-16 09:02:05 +02:00
yyforyongyu 0532b82dd5 multi: add new method FeePerVByte to avoid manual conversion 2023-10-13 17:00:53 +08:00
yyforyongyu 22600b47f1 multi: disable linter paralleltest 2023-10-13 13:50:09 +08:00
Olaoluwa Osuntokun 4f346060df Merge pull request #8067 from lightningnetwork/0-18-staging-rebased
branch: merge 0.18 staging branch into master
2023-10-09 11:20:11 -07:00
Yong ec2377db79 funding: remove dead code and sanity check pending chan ID (#7887)
* funding: remove unused field `newChanBarriers`

This commit removes the occurance of `newChanBarriers` as it's not used
anywhere.

* funding: rename method names to clear the funding flow

Slightly refactored the names so it's easier to see which side is
processing what messages.

* lnwallet: sanity check empty pending channel ID

This commit adds a sanity check to make sure an empty pending channel ID
will not be accepted.
2023-10-09 10:58:18 +02:00
yyforyongyu bea0ffdf81 chainfee: add new unit SatPerVByte 2023-10-06 16:34:47 -07:00