Commit Graph

11736 Commits

Author SHA1 Message Date
yyforyongyu
26858da59d itest: change feeServiceTarget to be 1 2021-06-29 20:25:47 +08:00
yyforyongyu
a77225ba9e itest: allow set fee rate with conf target
In this commit, we add a method in fee service to allow specifying a fee
rate with a conf target.
2021-06-29 20:25:47 +08:00
yyforyongyu
614884dcb8 contractcourt: test commitment deadline logic
This commit adds two tests to check that a) the correct deadline is used
given different HTLC sets and b) when sweeping anchors the correct
deadlines are used.
2021-06-29 20:25:47 +08:00
yyforyongyu
0dc3190fec contractcourt: update TestChannelArbitratorAnchors
This commit adds a deadline field to mockSweeper that can be used to
track the customized conf target (deadline) used for sweeping anchors.
The relevant test, TestChannelArbitratorAnchors is updated to reflect
that the deadlines are indeed taking effect.
2021-06-29 20:25:47 +08:00
yyforyongyu
391f240ccb contractcourt: make anchor sweep deadline aware
In this commit, we made the change so that when sweeping anchors for the
commitment transactions, we will be aware of the deadline which is
derived from its HTLC set. It's very likely we will use a much larger
conf target from now on, and save us some sats.
2021-06-29 20:25:47 +08:00
yyforyongyu
adddc1442e multi: refactor NewAnchorResolutions to return fixed values
This commit adds a new struct AnchorResolutions which wraps the anchor
resolutions for local/remote/pending remote commitment transactions. It
is then returned from NewAnchorResolutions. Thus the caller knows how to
retrieve a certain anchor resolution.
2021-06-29 20:25:47 +08:00
yyforyongyu
21626fed7c lnwallet: remove unused variable zeroHash 2021-06-29 20:25:46 +08:00
yyforyongyu
1abc5f8b00 chainfee: change min conf target to be 1
This commit changes the minBlockTarget used by the WebAPIEstimator to be
1, inline with the bitcoind's accepted min conf target.
2021-06-29 20:25:46 +08:00
yyforyongyu
5f0561fdbc chainfee: replace conf target when it exceeds the maxBlockTarget
In this commit, we add a check inside EstimateFeePerKW for bitcoind so
that when the conf target exceeds the maxBlockTarget, we will use
maxBlockTarget instead.
2021-06-29 20:25:46 +08:00
yyforyongyu
6242158d51 chainfee: fix maxBlockTarget value 2021-06-29 20:25:45 +08:00
Olaoluwa Osuntokun
cafa6246a9 Merge pull request #5431 from yyforyongyu/5259-follow-up
routing: rename method and add err check when launch shard
2021-06-28 16:16:13 -07:00
Olaoluwa Osuntokun
44e461b233 Merge pull request #5428 from wpaulino/enforce-anchor-reserve
lnwallet: prevent anchor reserve enforcement on legacy inbound channel
2021-06-28 16:08:43 -07:00
Olaoluwa Osuntokun
dac0797857 Merge pull request #5420 from yyforyongyu/itest-use-require-net
itest: use require inside net.EnsureConnected/net.ConnectNodes
2021-06-28 16:07:33 -07:00
Olaoluwa Osuntokun
1910e263a8 lncli: check for existence of tls file (#5416) 2021-06-28 16:06:55 -07:00
Linus Curiel Xanoni
dc7d79abc2 doc/sample-lnd.conf: remove deprecated protocol.anchors flag
Remove deprecated "protocol.anchors" setting from sample-lnd.conf
2021-06-28 12:25:04 -07:00
yyforyongyu
310e923170 itest: use require inside net.EnsureConnected/net.ConnectNodes 2021-06-29 01:41:48 +08:00
Joost Jager
9b1b92bf98 lncli: fix psbt fund parameter parsing
The sat_per_vbyte parameter was ignored because of a default value for
conf_target.
2021-06-28 11:23:13 +02:00
yyforyongyu
4a23c08b60 routing: rename method and add err check when launch shard
A followup commit for PR#5332. In this commit we add more docs, rename
function updatePaymentState to fetchePaymentState, and add back the
check for channeldb.ErrPaymentTerminal after we launch shard.
2021-06-27 17:48:32 +08:00
Olaoluwa Osuntokun
e62f0e1f3a Merge pull request #5429 from Roasbeef/itest-recovery-shutdown
lntest: retry node shutdown attempts to recovery tests
2021-06-24 18:43:39 -07:00
Olaoluwa Osuntokun
198ac3482c Merge pull request #5332 from yyforyongyu/5259-routing-fix-state
routing: fix payment state and refactor payment lifecycle tests
2021-06-24 18:42:17 -07:00
Olaoluwa Osuntokun
6a97e6432d Merge pull request #5419 from LN-Zap/upstream/fix-no-payment-address
lnd: only set payment address if not empty in PaymentRequest
2021-06-24 15:46:41 -07:00
Olaoluwa Osuntokun
5bd84e2a60 lntest: retry node shutdown attempts to recovery tests
In #5364 we added a new error path in the `StopDaemon` method to return
an error if shutdown was attempted while a rescan/recover instance was
in progress. Since the wallet actually won't fully stop (atm)
mid-recovery, the call effectively didn't do anything in that scenario,
so we started to return an error to properly reflect that. However this
causes certain itests to fail, as during recovery, the stop attempt will
fail leading to the test itself failing.

In this commit, we wrap the calls to stop a running daemon within a
`wait.NoError` call so we'll continually try to shut down the daemon
rather than quit on the first try.

Fixes #5423.
2021-06-24 15:37:32 -07:00
Olaoluwa Osuntokun
6dd7321a3f Merge pull request #5355 from carlaKC/4656-maxhtlcnumber
multi: set zero bandwidth hint for channels that do not have any available slots
2021-06-24 15:18:20 -07:00
Wilmer Paulino
6bbe790535 lnwallet: prevent anchor reserve enforcement on legacy inbound channel
This commit aims to address a flaw in our anchor reserve enforcement
logic in which an inbound "legacy" channel (i.e. a channel with a
commitment type that precedes anchors) would be rejected by the
recipient if they have at least one opened channel using the anchors
commitment type and do not have enough on-chain funds to meet the
anchors reserve.
2021-06-23 18:24:31 -07:00
Wilmer Paulino
d7299802d4 itest: extend testAnchorReservedValue to open additional channels
We do this to trigger a bug that will be resolved in a follow-up commit.
This bug prevents inbound legacy channels from being rejected by the
recipient if they have at least one anchor channel already opened
without an on-chain balance.
2021-06-23 18:24:30 -07:00
Olaoluwa Osuntokun
1287328678 Merge pull request #5335 from guggero/abandonchannel-no-dev
RPC/CLI: Allow abandonchannel to be used in regular build
2021-06-23 16:05:34 -07:00
yyforyongyu
cd35981569 routing: refactor update payment state tests
This commit refactors the resumePayment to extract some logics back to
paymentState so that the code is more testable. It also adds unit tests
for paymentState, and breaks the original MPPayment tests into independent tests
so that it's easier to maintain and debug. All the new tests are built
using mock so that the control flow is eaiser to setup and change.
2021-06-23 20:35:29 +08:00
yyforyongyu
e79e46ed21 routing: add mock structs for testing
This commit uses the package mock to create new mock structs, replacing
the old ones for better control when writing tests.
2021-06-23 20:35:29 +08:00
yyforyongyu
f5de56a40d mod: add package stretchr/testify mock 2021-06-23 20:35:29 +08:00
yyforyongyu
289d97fbfb routing: rename mock structs to make them obsolete
This commit renames the mock structs by appending Old in their names. In
doing so the old tests stay unchanged and new mock structs can be added
in the following commit.
2021-06-23 20:35:28 +08:00
yyforyongyu
54ed6c271b itest: silence depreciation warnings 2021-06-23 20:35:28 +08:00
yyforyongyu
193d149d48 itest: test channel policy update in private channels 2021-06-23 20:35:28 +08:00
yyforyongyu
319cc533a6 itest: fix make lint 2021-06-23 20:35:28 +08:00
yyforyongyu
e10bd84a4f itest: moving routing related tests into one file 2021-06-23 20:35:23 +08:00
yyforyongyu
735e89ca37 routing: add TestSendPaymentPrivateEdgeUpdateFeeExceedsLimit 2021-06-23 18:13:04 +08:00
yyforyongyu
e05b78fb9c routing: refactor TestSendPaymentErrorFeeInsufficientPrivateEdge 2021-06-23 18:13:04 +08:00
yyforyongyu
f31001e103 routing: make shardHandler aware of payment session
This commit adds payment session to shardHandler to enable private edge
policies being updated in shardHandler. The relevant interface and mock
are updated. From now on, upon seeing a ChannelUpdate message,
shardHandler will first try to find the target policy in additionalEdges
and update it. If nothing found, it will then check the database for
edge policy to update.
2021-06-23 18:13:04 +08:00
yyforyongyu
5df776e80b routing: add method UpdateAdditionalEdge and GetAdditionalEdgePolicy
This commit adds the method UpdateAdditionalEdge in PaymentSession,
which allows the addtional channel edge policy to be updated from a
ChannelUpdate message. Another method, GetAdditionalEdgePolicy is added
to allow querying additional edge policies.
2021-06-23 18:13:04 +08:00
yyforyongyu
cf2b5744a1 routing: move sendErr handling in shardHandler
This commit moves the handleSendError method from ChannelRouter to
shardHandler. In doing so, shardHandler can now apply updates to the
in-memory paymentSession if they are found in the error message.
2021-06-23 18:13:04 +08:00
yyforyongyu
1656611358 routing: use shardHandler to process err in SendToRoute 2021-06-23 18:13:03 +08:00
yyforyongyu
54aacacc11 routing: use require in router test
This commit refactors some of the tests in router_test.go to use the
require package.
2021-06-23 18:13:03 +08:00
yyforyongyu
8172811e74 routing: rm hardcoded channel id in router test 2021-06-23 18:13:03 +08:00
yyforyongyu
ae6d8a9a8f routing: parse Channel ID from json file 2021-06-23 18:13:03 +08:00
bluetegu
37d0e21f05 routing: test private edge on fee error 2021-06-23 18:13:03 +08:00
bluetegu
242a844012 routing: fix TestSendPaymentErrorRepeatedFeeInsufficient
The simulated error returned was rejected due to signature failure,
and didn't simulate correctly the insufficient fees error as
intended. Fix error by including correct signature.
2021-06-23 18:13:03 +08:00
bluetegu
fc113c7508 routing: add private key attribute in router test 2021-06-23 18:13:02 +08:00
yyforyongyu
9062ab1671 routing: make payment lifecycle test more verbose 2021-06-23 18:13:02 +08:00
Olaoluwa Osuntokun
29d0b6491e Merge pull request #5404 from Roasbeef/revert-no-router-fetch
Revert "routing: no backend call to fetch best block"
2021-06-22 17:31:28 -07:00
Olaoluwa Osuntokun
ff8153c332 docs/release-notes: add router height bug fix to 0.13.1 2021-06-22 17:24:17 -07:00
Olaoluwa Osuntokun
df6dd30af7 Revert "routing: no backend call to fetch best block"
This reverts commit cdddaaca75.
2021-06-22 17:22:38 -07:00