Commit Graph

4691 Commits

Author SHA1 Message Date
Johan T. Halseth
f83f47541d
channel test: add TestDesyncHTLCs
This commit adds a test that trigger a case where the balance
could end up being negative when we used the logIndex when
calculating the channel's available balance. This could
happen when the logs got out of sync, and we would use
the balance from a settled HTLC even though we wouldn't
include it when signing the next state.
2018-02-02 21:16:37 -05:00
Johan T. Halseth
83b368d20e
lnwallet/channel: use remoteACKedIndex instead of logIndex in
availableBalance
2018-02-02 21:16:37 -05:00
Johan T. Halseth
26a80f86b8
peer: set BatchTicker and BatchSize in channellink config 2018-02-02 21:16:37 -05:00
Johan T. Halseth
cc050f183f
htlcswitch tests: add mockTicker struct 2018-02-02 21:16:37 -05:00
Johan T. Halseth
9b7b3fa3b6
channellink: make BatchTicker and BatchSize configurable
This commit introduces a new Ticker interface, that can be used
to control when the batch timer should tick. This is done to be
able to more easily control the ticker during tests. The batch
timer is wrapped in the new BatchTicker struct, and made part
of the config together with BatchSize.
2018-02-02 21:16:36 -05:00
Olaoluwa Osuntokun
bba2ff1871
funding: display error if unable to watch for channel 2018-02-02 17:59:38 -08:00
Olaoluwa Osuntokun
ddf4715e3c
chainntnfs/neutrinonotify: fix regression for historical spend dispatches
In this commit, we fix an issue that was recently introduced to the way
we handle historical dispatches for the neutrino notifier. In a recent
change, we no return an error if we’re unable to actually find the
transaction that spends an outpoint. If this is the case, then the
outpoint is actually unspent, and we should proceed as normal.
2018-02-02 17:59:16 -08:00
Olaoluwa Osuntokun
609525f0e8
Merge pull request #712 from Roasbeef/avoid-dust-change-funding
lnwallet: avoid creating dust change outputs in funding txns
2018-02-01 16:20:52 -08:00
Olaoluwa Osuntokun
7144707734
rpc: store display of alias in getinfo 2018-02-01 11:55:02 -08:00
Conner Fromknecht
db7d902bbb lntest: move default channeldb path 2018-01-31 17:37:08 -08:00
Conner Fromknecht
84c947edeb lnd: move channeldb to graph dir 2018-01-31 17:37:08 -08:00
Conner Fromknecht
d0afac0407 chainregistry: move neutrino database to chain dir 2018-01-31 17:37:08 -08:00
Conner Fromknecht
6286a93cf5 config: separate chain directory 2018-01-31 17:37:08 -08:00
Alex
21c29c33d7 multi: upgrade macaroons to v2, replace per-method auth with interceptors
This commit reworks the macaroon authentication framework to use the
v2 macaroon format and bakery API. It also replaces the code in each
RPC method which calls the macaroon verifier with interceptors which
call the macaroon verifier instead. In addition, the operation
permissions are reworked to fit the new format of "allow" commands
(specifically, entity/operation permissions instead of method
permissions).
2018-01-31 17:14:49 -08:00
Olaoluwa Osuntokun
20098e8cb3
lnwallet: update transactions_test.go due to recent API changes 2018-01-31 14:31:14 -08:00
Jim Posen
916b83a6ee lnwallet: Implement test vectors from BOLT 03, Appendix C.
Appendix C of BOLT 03 contains a series of test vectors asserting that
commitment, HTLC success, and HTLC timeout transactions are created
correctly. Here the test cases are transcribed to Go structs and
verified.

We also break out some logic need to tests that bypass the constructor
and remove some redundant fields.
2018-01-31 14:30:56 -08:00
Olaoluwa Osuntokun
43fa9fe467
lnwallet: avoid creating dust change outputs in funding txns
Before this commit, if the remaining change was small enough, then it
was possible for us to generate a non-std funding transaction. This is
an issue as the txn would fail to propagate, meaning funds could
potentially be stuck in limbo if users didn't manually drop their
transaction history.

To avoid this scenario, we won't create a change output that is dusty.
Instead, we'll add these as miner fees.

Fixes #690.
2018-01-31 14:10:45 -08:00
Olaoluwa Osuntokun
246c05fcd8
lnwallet: add additional debug logging for txns during funding flows 2018-01-31 14:00:05 -08:00
Olaoluwa Osuntokun
c823aeafab
funding: during funding error fail before sending Error to peer
In this commit, we modify the logic executed when we decide that we
need to fail a funding flow. Before this commit, if the remote party
disconnected while we were attempting to fail the funding flow with an
error. Then we'd never actually cancel the reservation. This meant that
any inputs selected for that transaction would be locked until a
restart.

We fix this issue by always cancelling the reservation first, and
ensuring that failure to cancel the reservation doesn't prevent us from
sending the error.

Partially addresses #710.
2018-01-31 13:52:21 -08:00
Olaoluwa Osuntokun
94b10c6c06
Merge pull request #593 from AdamISZ/noise_tests
Add tests for key rotation from BOLT8 test vectors
2018-01-31 12:38:58 -08:00
Olaoluwa Osuntokun
1b15c30f7a
Merge pull request #592 from wilmerpaulino/rest-close-channel
lnrpc: make ChannelPoint.funding_txid a protobuf oneof and change CloseChannel endpoint
2018-01-31 12:38:03 -08:00
Andreas Tasch
b4e280eb15 docs: update install.md to same content as on lighting-dev-site
It seems that at some point the installation docs of the
https://github.com/lightninglabs/lightning-dev-site/ was identical to
this file (without page navigation + next steps).

Seems that this commit did not get ported to this repo:
1ad7d3189d

In this PR the info for macaroons and noencryptwallet is copied over
from the above mentioned commit.
2018-01-28 16:57:05 -08:00
Olaoluwa Osuntokun
1819abf224
lnwallet: increase size of test reservation due to high funding limit 2018-01-28 16:55:11 -08:00
Olaoluwa Osuntokun
3036fc0181 lnwallet: disallow creation of channels < 2x dust limit
Fixes #633.
2018-01-28 15:11:13 -08:00
Olaoluwa Osuntokun
87742ce861
docs: update wording on autopilot.allocation
Fixes #681.
2018-01-28 15:05:41 -08:00
Olaoluwa Osuntokun
e953c6abcf
config: add stricter config parsing to avoid dangerous RPC auth combos
In this commit, we add an additional constraint to the RPC
configuration parsing. Before this commit, it was possible to start lnd
with either RPC server listening on an external interface *without*
authentication disabled. After this commit, if a user tries to start
the RPC server listening on an external interface without any sort of
RPC authentication, then the daemon will fail to start up.
2018-01-28 15:03:29 -08:00
Olaoluwa Osuntokun
0a4de859a2
discovery+routing: reduce number of active validation barrier jobs
In order to reduce high CPU utilization during the initial network view
sync, we slash down the total number of active in-flight jobs that can
be launched.
2018-01-28 14:55:32 -08:00
Olaoluwa Osuntokun
63fe8aec5b
lnwallet: properly use in KB, not KiB to convert to sat/byte for bitcoind estimator
In this commit, we fix an existing bug. The fee estimation within
bitcoind is based on fee/KB (1000), not fee/KiB (1024).

Pointed out by @dabura667.
2018-01-28 14:53:58 -08:00
Olaoluwa Osuntokun
47dc2d3b70
server: grab the read-mutex within the main loop of the peerBootstrapper
A recent commit modified the mutex in the server to the read/write. In
order to further reduce contention, we’ll grab the read lock when we’re
examining get set of peers to ignore.
2018-01-28 14:50:25 -08:00
Olaoluwa Osuntokun
a94648e9dc
channeldb: properly use a read-transaction in FetchChannelEdgesByOutpoint
Before this commit, we’d unnecessarily use a write transaction within
the FetchChannelEdgesByOutpoint. This is wasteful as the function only
actually reads items from the database, and doesn’t attempt any
mutations at all.
2018-01-28 14:48:57 -08:00
Olaoluwa Osuntokun
bde3828208
funding: fix format directive in logging statement 2018-01-28 14:48:56 -08:00
Olaoluwa Osuntokun
bf6001074c
chainntnfs: fix spend notification registration race condition
In this commit, we fix a race condition related to the way we attempt
to query to see if an outpoint has already been spent by the time it’s
registered within the ChainNotifier. If the transaction creating the
outpoint hasn’t made it into the mempool by the time we execute the
GetTxOut call, then we’ll attempt to query for the transaction itself.
In this case, if we query for the transaction, then the block hash
field will be empty as it hasn’t yet made it into a block. Under the
previous logic, we’d then attempt to force a rescan. This is an issue
as the forced rescan will fail since it’ll try to fetch the block hash
of all zeroes.

In this commit, we fix this issue by only entering this “fallback to
rescan” logic iff, the transaction has actually been mined.
2018-01-28 14:48:56 -08:00
Adam Gibson
a6c0ba0c35
Add tests for key rotation from BOLT8 test vectors
This adds a test of encryption/decryption of 1002 copies
of a message "hello" so as to test the test vectors in the
final section of BOLT 8 ("transport-message test").
It also corrects some typos in the preceding section of the
same function (TestBolt0008TestVectors).
2018-01-28 06:38:21 +01:00
Wilmer Paulino
aca0c9324d
cmd/lncli: add 'connect' flag to openchannel command
Adds the option to connect to a node before opening the channel by
passing the node's host:port via the --connect flag.
2018-01-27 23:07:11 -05:00
Wilmer Paulino
1fefae780f
lnrpc: use funding_txid_str as the main endpoint for CloseChannel 2018-01-27 22:00:31 -05:00
Wilmer Paulino
f674e10a2b
lnd+cmd/lncli: handle ChannelPoint funding txid proto update
Since a ChannelPoint's funding txid can now be get/set as raw bytes or
a string, we first need to check what type it's currently set to before
accessing it.
2018-01-27 22:00:01 -05:00
Wilmer Paulino
2cfd705a06
lnrpc: add oneof funding txid to ChannelPoint
This commit allows us to get/set the funding txid of a ChannelPoint
either as raw bytes or a string.
2018-01-27 21:59:54 -05:00
Valentine Wallace
3b4ffbca48 zpay32: add 2 tests for invalid invoice fields
Test for empty fallback address field, and separately test for invalid
routing info length (not a multiple of 51).
2018-01-27 18:45:57 -08:00
Olaoluwa Osuntokun
f9eda8580d
Merge pull request #571 from hectorj/patch-1
docker-compose.yml: fix typo
2018-01-27 18:43:38 -08:00
Olaoluwa Osuntokun
859ecbd300
Merge pull request #569 from wilmerpaulino/protobuf-docs
docs: clarify how to generate protobuf definitions
2018-01-27 18:43:12 -08:00
Andrew Naoum
0f161c5033 channeldb+lnrpc: store the payment pre-image not rhash
Fixes #481.

Prior to this commit, payments stored in the channel DB only kept a
record of the payment hash. This is a problem as the preimage is what
serves as proof of payment and a user should be able to look up this
value in the future (not just immediately after payment).

Instead of storing both the payment hash and the preimage, we store the
preimage only since the hash can be derrived from this using a SHA256.

In the RPC listpayments command, we now give the preimage in addition to
the payment hash.
2018-01-27 18:36:33 -08:00
Oliver Gugger
fc18db0130 rpc: update README according to current rpc.proto file 2018-01-27 18:35:48 -08:00
Simon Horlick
73468cf06e autopilot: Exclude nodes that previously failed 2018-01-27 18:35:31 -08:00
Simon Horlick
a43d7d3532 autopilot: Make autopilot aware of channel open failures 2018-01-27 18:35:31 -08:00
Olaoluwa Osuntokun
42014f5b7b
Merge pull request #650 from wilmerpaulino/invoice-negative-amount
invoice: avoid negative msat amounts
2018-01-27 18:34:56 -08:00
Olaoluwa Osuntokun
7919c4cba0
Merge pull request #654 from wilmerpaulino/invoice-without-amount
Support invoices without amount specified
2018-01-27 17:38:56 -08:00
Olaoluwa Osuntokun
a808f76a60
Merge pull request #648 from halseth/fix-lost-announcement
gossiper/tests: Integration test bug/flake fixes.
2018-01-27 17:25:51 -08:00
Salman Ansari
451aff896f docs: Updated install instructions using bitcoind 2018-01-27 16:44:18 -08:00
Olaoluwa Osuntokun
b6235a536b
Merge pull request #587 from kingvest/master
docs/grpc: added instructions for writing gRPC clients in Ruby
2018-01-27 16:31:23 -08:00
gshub77
0bc85085dd cmd/lncli: fix typo in Description of sendpayment
Fixes #674.
2018-01-27 16:23:42 -08:00