Commit Graph
98 Commits
Author SHA1 Message Date
yyforyongyu d28e67ddb0 itest: fix make lint 2021-07-13 15:01:43 +08:00
yyforyongyu c912d1aae0 itest: move tests into one file
This commit creates the file lnd_misc_test.go to hold all miscellaneous
tests in the file lnd_test.go. From now on, the lnd_test.go will only be
responsible for handling the "top" level functionalities such as
splitting test cases and run them. Newly created test cases should find
their places in the related test files, or create new one when needed.
2021-07-13 15:01:39 +08:00
yyforyongyu 73a2211205 itest: move helper functions into one file
This commit creates the file utils.go to hold the commonly used
functions for tests.
2021-07-13 14:59:00 +08:00
yyforyongyu 27b9273e2f itest: move channel graph related tests into one file 2021-07-13 14:58:59 +08:00
yyforyongyu a20f857987 itest: move balance related tests into one file 2021-07-13 14:58:59 +08:00
yyforyongyu 9337f94f0d itest: move recovery related tests into one file 2021-07-13 14:58:59 +08:00
yyforyongyu 0759771134 itest: move channel openning related tests into one file
This commit creates the file lnd_open_channel_test.go to hold channel
opeopenning related tests.
2021-07-13 14:58:59 +08:00
yyforyongyu 12ca07c089 itest: move testFundingPersistence to lnd_funding_test.go 2021-07-13 14:58:59 +08:00
yyforyongyu 47c40373de itest: move channel policy update test into one file 2021-07-13 14:58:58 +08:00
yyforyongyu 3f78a5da10 itest: move channel force close test into one file 2021-07-13 14:58:58 +08:00
yyforyongyu e3f2cf1711 itest: move switch related tests into one file
This commit creates the lnd_switch_test.go file to hold switch related
tests, further breaking down the lnd_test.go file.
2021-07-13 14:58:58 +08:00
yyforyongyu 6ca068660c itest: move revocation related tests into one file
This commit creates a new file lnd_revocation_test.go to hold
revocation-related tests, further breaking down the lnd_test.go file.
2021-07-13 14:58:56 +08:00
yyforyongyu f62cdf7bfc itest: move payment related tests into one file
This commit creates a new file lnd_payment_test.go to hold all payment
related tests, further breaking down the old large lnd_test.go.
2021-07-13 14:52:08 +08:00
yyforyongyu b657a977e3 itest: refactor assertNumConnections to use wait.NoError
This commit refactors the function assertNumConnections to use
wait.NoError. Prior to this commit, `make lint` will fail on this
function. While fixing it, it's noticed that wait.NoError suits the
case so it's refactored to use it.
2021-07-13 14:52:08 +08:00
yyforyongyu 0612ced087 itest: use require in assertions 2021-07-13 14:52:08 +08:00
yyforyongyu 6f0da73ee1 itest: move assertions into one file
This commit breaks down the lnd_test.go file by moving assertion-related
functions into the file assertions.go.
2021-07-13 14:52:08 +08:00
yyforyongyu c081707a5b docs/release-notes: add deadline aware to 0.13.1 2021-06-29 20:30:58 +08:00
yyforyongyu 7c64e0445a itest: test anchor sweep with commitment deadline 2021-06-29 20:30:53 +08:00
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
yyforyongyu 310e923170 itest: use require inside net.EnsureConnected/net.ConnectNodes 2021-06-29 01:41:48 +08: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
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
yyforyongyu 9062ab1671 routing: make payment lifecycle test more verbose 2021-06-23 18:13:02 +08:00
yyforyongyu 6515c575bd itest: use require inside net.SendCoins
This commit refactored the function SendCoins to take a new *testing.T
so the unexpected error is handled inside it.
2021-06-10 01:29:22 +08:00
yyforyongyu b42bb87c81 itest: use require inside net.NewNode
This commit refactored the function NewNode to take a *testing.T so that
the unexpected error is checked inside it. The caller is now free from
checking the errors.
2021-06-09 02:14:37 +08:00
yyforyongyu a60db53a5a itest: fix wrong node queried for balance 2021-06-03 19:55:25 +08:00
yyforyongyu 270984b7d5 trivial: update log_error_whitelist 2021-05-07 13:20:54 +08:00
yyforyongyu 72097059cc invoices: remove unused param in notifyClients 2021-04-20 23:47:19 +08:00
yyforyongyu 96c3a64316 lntest: refactor WaitForBlockchainSync 2021-04-14 12:30:22 +08:00
yyforyongyu a215c55186 itest: add logging for subtests 2021-04-14 12:30:19 +08:00
yyforyongyu 37aa49c7aa routing: fix pathfind edge features being nil 2021-04-13 15:53:18 +08:00
yyforyongyu 1be7331c4f itest: move funding tests into one file 2021-04-07 02:40:06 +08:00
yyforyongyu 9d0d88ac21 lnrpc+lncli: deprecate sat_per_byte and add sat_per_vbyte
This commit deprecates/replaces the old field `sat_per_byte` with
`sat_per_vbyte`. While the old field suggests sat per byte, it’s
actually using sat per virtual byte. We use the Hidden param to hide all
the deprecated flags. These flags won't show up in help menu onwards,
while stay valid that can be passed from cli. Thus bash scripts
referencing these fields won't be broken.
2021-03-26 17:16:40 +08:00
yyforyongyu 2466758acd lncli+lnrpc: update docs for sat_per_byte
Update the documentation for the field `sat_per_byte`. While the name
suggests it’s sat per byte, the value is actually in sat per virtual
byte.
2021-03-26 17:09:14 +08:00
yyforyongyu 2dac77200b lncli+lnrpc: add payment address to sendpayment 2021-03-17 21:16:17 +08:00
yyforyongyu 541fbbb054 routing: check payment.DestFeatures against nil 2021-03-17 00:14:20 +08:00
yyforyongyu c171548944 trivial: fix make rpc-format 2020-12-24 21:41:42 +08:00
Yong 582b164c46 kvdb: add timeout options for bbolt (#4787)
* mod: bump btcwallet version to accept db timeout

* btcwallet: add DBTimeOut in config

* kvdb: add database timeout option for bbolt

This commit adds a DBTimeout option in bbolt config. The relevant
functions walletdb.Open/Create are updated to use this config. In
addition, the bolt compacter also applies the new timeout option.

* channeldb: add DBTimeout in db options

This commit adds the DBTimeout option for channeldb. A new unit
test file is created to test the default options. In addition,
the params used in kvdb.Create inside channeldb_test is updated
with a DefaultDBTimeout value.

* contractcourt+routing: use DBTimeout in kvdb

This commit touches multiple test files in contractcourt and routing.
The call of function kvdb.Create and kvdb.Open are now updated with
the new param DBTimeout, using the default value kvdb.DefaultDBTimeout.

* lncfg: add DBTimeout option in db config

The DBTimeout option is added to db config. A new unit test is
added to check the default DB config is created as expected.

* migration: add DBTimeout param in kvdb.Create/kvdb.Open

* keychain: update tests to use DBTimeout param

* htlcswitch+chainreg: add DBTimeout option

* macaroons: support DBTimeout config in creation

This commit adds the DBTimeout during the creation of macaroons.db.
The usage of kvdb.Create and kvdb.Open in its tests are updated with
a timeout value using kvdb.DefaultDBTimeout.

* walletunlocker: add dbTimeout option in UnlockerService

This commit adds a new param, dbTimeout, during the creation of
UnlockerService. This param is then passed to wallet.NewLoader
inside various service calls, specifying a timeout value to be
used when opening the bbolt. In addition, the macaroonService
is also called with this dbTimeout param.

* watchtower/wtdb: add dbTimeout param during creation

This commit adds the dbTimeout param for the creation of both
watchtower.db and wtclient.db.

* multi: add db timeout param for walletdb.Create

This commit adds the db timeout param for the function call
walletdb.Create. It touches only the test files found in chainntnfs,
lnwallet, and routing.

* lnd: pass DBTimeout config to relevant services

This commit enables lnd to pass the DBTimeout config to the following
services/config/functions,
  - chainControlConfig
  - walletunlocker
  - wallet.NewLoader
  - macaroons
  - watchtower
In addition, the usage of wallet.Create is updated too.

* sample-config: add dbtimeout option
2020-12-07 15:31:49 -08:00
yyforyongyu bf036f2665 htlcswitch: close the updateFeeTimer properly 2020-12-04 23:08:50 +08:00
yyforyongyu be626df689 peer: use MaxMessagePayload instead of hard coding 2020-12-04 23:08:49 +08:00
yyforyongyu f46d16ff89 peer: fix typo 2020-12-04 23:07:54 +08:00
yyforyongyu e06768e4eb brontide: fix typo 2020-12-04 23:07:53 +08:00
yyforyongyu eb1affd5da pool: fix typo 2020-12-04 23:07:53 +08:00
yyforyongyu 550341c036 lnwire: fix typo 2020-12-04 23:07:53 +08:00
yyforyongyu 5c5fc732e5 aezeed: fix typo 2020-12-04 23:07:53 +08:00
yyforyongyu e3a6cd8412 autopilot: fix typo 2020-12-04 23:07:52 +08:00
yyforyongyu 9336b9b3d4 autopilot: typo fix 2020-11-19 14:34:29 +08:00
yyforyongyu 0ace42649e autopilot: fix returned map size in mergeNodeMaps 2020-11-19 14:30:11 +08:00
yyforyongyu 2cb42594a9 trivial: fix make rpc-format 2020-10-25 18:51:42 +08:00
yyforyongyu 310f87e271 itest: save temp miner's logs 2020-10-02 00:04:47 +08:00
yyforyongyu 089e7557be itest: update log error whitelist 2020-09-29 05:55:36 +08:00
yyforyongyu 86779fb6a5 itest: fix code lint 2020-09-24 20:51:58 +08:00
yyforyongyu 48f6c47b17 itest: test all ChannelBalance fields 2020-09-24 20:33:23 +08:00
yyforyongyu 1b200c9930 itest: explicit checking ChannelBalance response 2020-09-24 20:30:51 +08:00
yyforyongyu f8c1bee637 lnrpc+rpcserver: verbose result in ChannelBalance 2020-09-24 20:26:08 +08:00
yyforyongyu d2d71476bd lntest: init SignerClient and test DeriveSharedKey 2020-09-17 14:52:36 +08:00
yyforyongyu 1c80f9818f signrpc: SharedKeyRequest accept raw pubkey 2020-09-17 10:14:54 +08:00
yyforyongyu 245db6a7fe rpcserver: fix make lint 2020-09-16 12:08:46 +08:00
yyforyongyu e8d9643f3a itest: test for connection timeout 2020-09-16 11:50:59 +08:00
yyforyongyu 469aba9282 lnd+rpcserver: allow customized timeout in ConnectPeer 2020-09-16 11:50:04 +08:00
yyforyongyu ef38b12fda multi: use timeout field in dialer 2020-09-16 11:50:04 +08:00
yyforyongyu fb67b58d3f brontide+tor:add timeout value for network connections 2020-09-16 11:50:03 +08:00
yyforyongyu 65383a1494 build: update to btcd version with notfound msg fix 2020-09-13 11:25:46 +08:00
yyforyongyu 567fa9ed10 itest: disable node retrying to connect to miner
Previously the chainbackend connected to the miner using a permanent
connection, which would retry the connection when it’s disconnected.
It would leave multiple connections between the chainbackend and the
miner, causing difficulties in debugging. Currently, there are two
occasions when disconnection happens. One happens when running the open
channel reorg test, the miner is connected/disconnected multiple times
on purpose. The other happens when the chainbackend receives a
MSG_WITNESS_TX type from the miner, which would be considered as an
invalid type and disconnects the miner. With the latter one being fixed
in btcd, the chainbackend will still be disconnected from the miner if
it reaches the ban score by requesting too many notfound messages in a
short time which is why the `--nobanning` flag is added.
2020-09-12 20:09:54 +08:00
yyforyongyu 724f6e0969 itest: require no error when cleaning up chainbackends 2020-09-12 20:09:53 +08:00
yyforyongyu 933d84273a itest: require no error when tearing down miners 2020-09-12 20:09:52 +08:00
yyforyongyu acc0ec13e1 trivial: remove unused print 2020-08-28 17:09:39 +08:00
yyforyongyu 89c3eb7765 itest: test macaroon creation/deletion 2020-08-14 12:36:21 +08:00
yyforyongyu c8a2916d91 lncli: support list/delete on marcaroon IDs 2020-08-14 12:36:21 +08:00
yyforyongyu c0e2513350 lnrpc+rpcserver: support list/delete on marcaroon IDs 2020-08-14 12:33:13 +08:00
yyforyongyu 57f7115437 trivial: typo fix 2020-08-13 07:33:52 +08:00
yyforyongyu f362f7670b macaroons: specify root key ID in bakery 2020-08-11 19:17:48 +08:00
yyforyongyu 86d5facaa2 docs: update no-macaroons option in macaroon 2020-07-22 22:53:46 +08:00