Commit Graph

1266 Commits

Author SHA1 Message Date
Oliver Gugger
73aa40f00e
lnwallet+kvdb: remove duplicate bdb backend imports
We only want to register the bbolt DB backend ("bdb") when we're not
compiling for a JS/WASM build targets. That's why we want to have that
import in only one file that we can add a build tag to. We remove it in
two other places since only one import is enough anyway.
2021-07-22 09:47:36 +02:00
Olaoluwa Osuntokun
af43a863cb
lnwallet: ensure MayAddOutgoingHtlc doesn't add zero-value HTLCs
In this commit, in order to allow the test added in the prior commit to
pass, we'll increment the mockHTLCAmt value by 1 to ensure we never
attempt to add a zero value HTLC.

Fixes #5468
2021-07-06 16:50:19 -07:00
Olaoluwa Osuntokun
49b18b4d35
lnwallet: add test case to exercise MayAddOutgoingHtlc bug
As is, if the remote party proposes a min HTLC of 0 `mSat` to us, then
we won't ever be able to _send outgoing_ in the channel as the
`MayAddOutgoingHtlc` will attempt to add a zero-value HTLC, which isn't
allowed within the protocol.

The default channels created actually already use a min HTLC value of
zero within the tests, so this test case fails as is.
2021-07-06 16:50:14 -07: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
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
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
carla
5d717cb039
multi: surface may add outgoing hltc 2021-06-22 13:56:08 +02:00
carla
e3a4d6e989
lnwallet: refactor add htlc sanity checks to separate methods 2021-06-22 13:56:07 +02:00
eugene
6d04f11f94
lnwallet+funding: sanitize upfront_shutdown_script
Otherwise, we would get non-standard txn's and fail to broadcast
them when cooperatively closing a channel. This wouldn't affect
funds security as no HTLCs would be active to steal. This is just
a safety measure as we should only generate standard txn's.
2021-06-11 10:46:21 -04:00
Olaoluwa Osuntokun
ad0ecc4d58
Merge pull request #5333 from wpaulino/incompatible-account-addr-type
lnwallet: check if requested address type is compatible with account
2021-05-27 19:06:13 -07:00
Wilmer Paulino
8745cf03c1
lnwallet: check if requested address type is compatible with account 2021-05-26 11:20:30 -07:00
Wilmer Paulino
798113a024
lnwallet: refactor common logic between NewAddress and LastUnusedAddress 2021-05-26 11:20:28 -07:00
Joost Jager
42f4afef75
multi: add random coin selection 2021-05-24 20:09:56 +02:00
Olaoluwa Osuntokun
7ab5906093
Merge pull request #5245 from bhandras/kvdb_module
kvdb: make kvdb a top level submodule to allow dependency in other projects
2021-05-13 15:59:20 -07:00
Oliver Gugger
2d70b46269
chanfunding: extend PSBT witness input check
Fixes #5287.

The PSBT spec is a bit vague when it comes to the WitnessUtxo field of
an input as it's not strictly required for witness inputs. Therefore
Electrum for example does not include the field.
We need to make the SegWit input check a bit more elaborate by looking
at the output script of the UTXO and also the redeem script in case it's
a nested SegWit spend.
2021-05-13 20:42:57 +02:00
Johan T. Halseth
8e1087d1cd
lwallet: only count public channels towards our reserved value
Since private channels (most likely) won't be used for routing other
than as last hop, they bear a smaller risk that we must quickly force
close them in order to resolve a HTLC up/downstream.

In the case where it actually has to be force to resolve a payment (if
it is the first/last hop on a routed payment), we can assume that the
router will have UTXOs available from the reserved value from the
incoming public channel.
2021-05-11 10:27:54 +02:00
Johan T. Halseth
a0b6a0b00b
lnwallet: cap value reserved for anchor fee bumping
We cap the maximum value we'll reserve for anchor channel fee bumping at
10 times the per-channel amount such that nodes with a high number of
channels don't have to keep around a very large amount for the unlikely
scanario that they all close at the same time.
2021-05-11 10:27:54 +02:00
Olaoluwa Osuntokun
ba5aaec632
Merge pull request #5266 from wpaulino/import-dry-run
walletrpc: expose dry run support for ImportAccount
2021-05-10 17:19:09 -07:00
Olaoluwa Osuntokun
1868c7dec1
Merge pull request #5231 from Crypt-iQ/unsigned_ack_patch_04212021
lnwallet: use tail not tip in getUnsignedAckedUpdates
2021-05-07 12:46:48 -07:00
Andras Banki-Horvath
14c851c8fc
kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
Wilmer Paulino
994405709a
lnwallet: expose dry run support for ImportAccount 2021-05-06 19:04:21 -07:00
Andras Banki-Horvath
b6a620e6b2
misc: add ability to store the wallet in the remote DB 2021-05-04 17:33:11 +02:00
Elle Mouton
432b1f0588 btcwallet: lock blockcache for Neutrino GetBlock
This commit ensures that for the neutrino implementation of
lnwallet.BlockChainIO, the neutrino GetBlock method is called directly
(since it already uses the blockcache). It also ensures that the block
cache mutex for the given hash is locked before the call to GetBlock.
2021-04-28 09:46:11 +02:00
Elle Mouton
a0f7bf8b2d chainntnfs: add block cache to BtcdNotifier
This commit adds gives BtcdNotifier access to the block cache and wraps
its GetBlock method so that it uses the block cache.
2021-04-28 09:46:11 +02:00
Elle Mouton
106f93a1b4 btcwallet: make blockcache available to BtcWallet
This commit makes the blockcache available to BtcWallet so that any
GetBlock call made to BtcWallet is wrapped by the blockcache GetBlock
call.
2021-04-28 09:46:11 +02:00
Olaoluwa Osuntokun
bfcaf02f04
Merge pull request #4905 from LN-Zap/feat/spend-unconfirmed-estimate
Support spend_unconfirmed in EstimateFee and FundPsbt
2021-04-26 15:48:11 -07:00
Tom Kirkpatrick
2f80283ec2
rpc: minConfs and spendUnconfirmed for EstimateFee 2021-04-22 20:35:51 +02:00
Tom Kirkpatrick
03b55446b5
refactor: use camel case for minConfs 2021-04-22 20:35:00 +02:00
eugene
fa5627b779
lnwallet/chanfunding: non-segwit spend Verify test
Also fixes error-handling in the Verify test when expectedErr == ""
2021-04-22 13:04:25 -04:00
eugene
b3f14d66f0
lnwallet/chanfunding: assert PSBT Inputs have WitnessUtxo 2021-04-22 13:04:24 -04:00
eugene
0547364091
lnwallet: add test for state machine regression 2021-04-21 17:42:56 -04:00
eugene
7da2080a3d
lnwallet: use tail() instead of tip() in getUnsignedAckedUpdates
The previous behavior would allow updates to be overwritten in some
scenarios. Upon restart, this would lead to a missing settle/fail in
the update logs.
2021-04-21 17:42:56 -04:00
eugene
97007fc4fa
lnwallet: fix logUpdate scope in restorePendingLocalUpdates 2021-04-21 17:42:56 -04:00
Bjarne Magnussen
6ab625d69b
chanfunding: factor out sanity check for change that is dust 2021-04-13 11:37:20 +02:00
Bjarne Magnussen
59c40ec8b4
chanfunding: fee estimation based on change output in CoinSelect
Add a dust-limit to `CoinSelect` and let the fee estimation consider if a change output is needed or not, assuring that if the change is below the dust-limit it will go towards the fee instead.
2021-04-13 11:37:12 +02:00
Bjarne Magnussen
235e73205d
chanfunding: refactor fee estimate calculation 2021-04-12 14:39:38 +02:00
Wilmer Paulino
82fe5d9bba
build: update btcwallet dependency introducing pruned bitcoind support
This is achieved by some recent work within the BitcoindClient enabling
it to retrieve pruned blocks from its server's peers.
2021-04-06 14:55:14 -07:00
Wilmer Paulino
2d163b788b
lnwallet: expose wallet import related methods to WalletController 2021-04-05 15:41:09 -07:00
Wilmer Paulino
f91e7cde59
lnwallet: expose optional account filter for several WalletController methods 2021-04-05 15:41:06 -07:00
Wilmer Paulino
f38bf4d7fa
lnwallet: expose required account parameter for WalletController methods 2021-04-05 15:41:05 -07:00
Wilmer Paulino
a620ce3682
build: update btcd and btcwallet dependencies 2021-04-05 15:41:04 -07:00
Joost Jager
9398220568 walletrpc: add ListLeases 2021-03-13 08:45:52 +01:00
Joost Jager
5ba0f8e355 lnwallet: bump btcwallet 2021-03-13 08:45:52 +01:00
Conner Fromknecht
7e33548e8b
Merge pull request #4775 from halseth/input-tx-size-constants
[input/size] Check tx size constants
2021-03-10 09:23:40 -08:00
eugene
99a7271289
lntest/itest+lnwallet: add legacy chanrestore test
The test makes use of a nextRevocationProducer that is only used during
integration tests.
2021-03-05 12:49:18 -05:00
eugene
bb84f0ebc8
multi: store KeyLocator in OpenChannel, use ECDH
This commit adds a RevocationKeyLocator field to the OpenChannel
struct so that the SCB derivation doesn't have to brute-force the
sha chain root key and match the public key. ECDH derivation is now
used to derive the key instead of regular private key derivation a
la DerivePrivKey. The legacy can still be used to recover old
channels.
2021-03-05 12:49:18 -05:00