Commit Graph

5022 Commits

Author SHA1 Message Date
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
bc5bfeb479 lnwire: fix logging for FeeInsufficient, show amt not fee
Fixes #1548.
2018-07-12 16:10:16 -07:00
d8fb6017cc Merge pull request #1547 from Roasbeef/outgoing-payment-migration-invoice-series
channeldb: add new migration to finalize invoice migration for outgoi…
2018-07-12 13:20:25 -07:00
19d84dd1cc channeldb: add new migration to finalize invoice migration for outgoing payments
In this commit, we migrate the database away from a partially migrated
state. In a prior commit, we migrated the database in order to update
the Invoice struct with three new fields: add index, settle index, paid
amt.  However, it was overlooked that the OutgoingPayment struct also
embedded an Invoice within it. As a result, nodes that upgraded to the
first migration found themselves unable to start up, or call
listpayments, as the internal invoice within the OutgoignPayment hadn't
yet been updated.  This would result in an OOM typically as we went to
allocate a slice with a integer that should have been small, but may
have ended up actually being a set of random bytes, so a very large
number.

In this commit, we finish the DB migration by also migrating the
internal invoice within each OutgoingPayment.

Fixes #1538.
Fixes #1546.
2018-07-12 00:22:28 -07:00
7bc9eb96ac test: wait until closed channel notification is received
In this commit, we modify the graph topology notifications test to wait
until a graph update notification has been received for a closed
channel, rather than assume the next graph update will be for the closed
channel itself.
2018-07-11 17:07:05 -07:00
a6136c16b0 test: add test to ensure channel updates are sent with disabled active 2018-07-11 17:07:04 -07:00
873cccc7a6 multi: send channel update with disabled active on force and coop chan closes 2018-07-11 17:07:03 -07:00
191e111661 routing: include disabled field in topology updates 2018-07-11 17:07:02 -07:00
ee10b0a76c rpcserver: set recently added disabled field to routing policies 2018-07-11 17:07:01 -07:00
a4dc49adc4 lnrpc: add disabled field to routing policy proto message 2018-07-11 17:06:58 -07:00
515ba7a4d0 channeldb: fix formatting for invoice migration log 2018-07-11 17:05:56 -07:00
93207608b5 Merge pull request #1125 from Roasbeef/streaming-invoice-improvements
channeldb+lnrpc: re-work invoicing API to implement robust streaming notification delivery
2018-07-10 20:42:00 -07:00
1189e703da invoiceregistry: enforce stricter check on duplicate ntfn avoidance 2018-07-10 19:37:24 -07:00
90d4a723d3 Merge pull request #1536 from cfromknecht/install-doc-formatting
docs/INSTALL: fix mismatched code blocks
2018-07-10 19:06:25 -07:00
a3acd9c23f docs/INSTALL: fix mismatched code blocks 2018-07-10 19:03:06 -07:00
ae84b99cb5 cmd/lncli: add missing space to the payinvoice cmd help 2018-07-10 17:21:46 -07:00
16df90fc23 Merge pull request #1504 from cfromknecht/chainview-filter-locking
[routing/chainview] improve filter locking granularity in btcd/bitcoind
2018-07-10 17:19:36 -07:00
3915c6a569 routing: do not reacquire the lock for topology notifications 2018-07-10 17:09:52 -07:00
273f030390 test: fix type in comment 2018-07-10 17:06:55 -07:00
ee65605495 chainregistry: fix ActiveChains comment 2018-07-10 16:57:09 -07:00
d0d77f9718 README: add known good FreeBSD (9.11) instructions 2018-07-10 16:53:34 -07:00
a43d02f8f0 cmd/lncli: clarify help for push_amt in openchannel
Fixes #1522.

Fixes #1259.
2018-07-09 12:40:47 -07:00
e13f96e64b routing: ensure we create a pruneViewSnapshot for route sessions
In this commit, we fix an existing bug that could at times lead to a
panic if a user manually crafts a route via SendToRoute, and that route
results in a payment error. The fix is simple: create the map even
though it won't be used in the sessions since the user is feeding the
router manual routes.
2018-07-08 16:34:25 -07:00
03650bbb18 Merge pull request #1470 from cfromknecht/multi-hop-itest-flake
lnd_test: remove itest race caused by mining extra block
2018-07-06 21:39:04 -05:00
daa28e0d0f routing/chainview/bitcoind: improve filterMtx locking
In this commit, we modify the granularity of the locking
around the filterMtx in the bitcoind chainview, such that
we only lock once per block connected or filter update.
Currently, we acquire and release the lock for every
update to the map.

We also fix a bug that would cause us to not fully remove
all previous outpoints spent by a txn when doing manual
filter, as we previously would only remove the first output
detected.
2018-07-06 19:08:17 -07:00
0f6bc3538d routing/chainview/btcd: improve filterMtx locking
In this commit, we modify the granularity of the locking
around the filterMtx in the btcd chainview, such that we
only lock once per block connected or filter update.
Currently, we acquire and release the lock for every
update to the map.

We also fix a bug that would cause us to not fully remove
all previous outpoints spent by a txn when doing manual
filter, as we previously would only remove the first output
detected.
2018-07-06 19:08:17 -07:00
6aaf692049 cmd: fix small typo in mnemonicCheck 2018-07-06 20:34:19 -05:00
11e7f47f01 Merge pull request #1508 from wpaulino/dust-limit-active-chain
fundingmanager: determine our dust limit based on active chain
2018-07-06 19:01:41 -05:00
cef29e74d7 Merge pull request #1509 from wpaulino/lnddir-lnd-conf
config: use config file within lnddir unless overwritten
2018-07-06 18:59:56 -05:00
db4a09d3b5 channeldb: skip sub-buckets during invoice time series migration
In this commit, we fix an existing bu gin the invoice time series
migration code. Before this commit, the migration would fail as we would
try to migrate an empty invoice. We now detect this case and skip all
empty invoices.

We also add a bit more logging on both the info and trace logging level.
2018-07-06 16:45:02 -07:00
4813da9a64 cmd/lncli: update ad-hoc addinvoice response json to display add_index 2018-07-06 16:45:01 -07:00
43d1d1f4f2 test: extend testInvoiceSubscriptions to test historical notification dispatch 2018-07-06 16:45:01 -07:00
6891729b5c invoiceregistry: ensure we re-bind the loop variable within deliverBacklogEvents 2018-07-06 16:44:59 -07:00
833d037f66 config: use config file within lnddir unless overwritten 2018-07-06 12:44:36 -07:00
a7e0d3f57b fundingmanager: determine our dust limit based on active chain
In this commit, we fix an issue where we would always assume the dust
limit was Bitcoin's dust limit, rather than the active chain. This would
lead to issues when attempting to open channels on the Litecon chain.
2018-07-06 12:28:09 -07:00
9c1ed7fc7d invoiceregistry: update AddInvoice to return addIndex of new invoice 2018-07-06 12:22:03 -07:00
904342b9e8 rpc: populate response of AddInvoice w/ add index of new invoice 2018-07-06 12:22:02 -07:00
00de6f11b1 lnrpc: the response to AddInvoice now contains the addIndex of new invoice 2018-07-06 12:22:02 -07:00
7aeed0b58f channeldb: AddInvoice now returns the addIndex of the new invoice 2018-07-06 12:22:01 -07:00
2dcc2d63a6 invoiceregistry: ensure we never send duplicate add/settle notifications
In this commit, we add additional logic to the primary notification
dispatch loop to ensure that we'll never send the same add/settle event
to the same client twice.

Consider the case where as we're sending a client its notification
backlog, a new invoice is settled (index=9). In this case, the database
will be reflected immediately, and the event will also be queued for
notifying later. We'll send out this latest event during the backlog
clear, but then will send it again once we return back to the main loop.

To ensure that this never happens, we'll now record the last index that
we’ve sent to a client to ensure that we no longer are able to send
duplicate notification events.
2018-07-06 12:22:01 -07:00
3bedffcc1a invoiceregistry: serialize all invoice modifications, eliminate extra db call for settle
In this commit, we now ensure that all modifications to the invoice DB
are properly serialized. This ensures that our time series within the
database will be properly coherent. Additionally, within SettleInvoice,
we remove an extra DB call by taking advantage of the new SettleInvoice
method which will return the invoice being settled as well.
2018-07-06 12:22:01 -07:00
e5c579120e channeldb: modify SettleInvoice to also return the invoice being settled 2018-07-06 12:22:00 -07:00
2c08a22ed3 server: launch new invoiceRegistry goroutines on start up 2018-07-06 12:22:00 -07:00
892a413be3 rpc: update SubscribeInvoices to send backlog ntfns, also send add ntfns 2018-07-06 12:21:59 -07:00
7917fd2ab0 invoiceregistry: re-work logic to support delivering notification backlog
In this commit, we re-work the existing invoiceRegistry struct to
support delivering backlog notifications to subscription clients if
needed. Rather than using 1 goroutine per-client per-event, each client
now gains a concurrent notification queue. This queue will then be used
to ensure in-order delivery of all notifications from the
invoiceEventNotifier.

The SubscribeNotifications method now takes two params: addIndex, and
settleIndex. These should be the values of the last add index and settle
index the caller knows of. If specified (not zero), then we'll look up
all the notifications that the caller has missed, and then deliver those
before sending out any new notifications. In order to do this without
losing ordering of events, we've added a new central goroutine which
will ensure that all events are properly serialized.
2018-07-06 12:21:59 -07:00
e4c5840472 rpc: ensure new invoice fields are populated in RPC responses 2018-07-06 12:21:58 -07:00
2097564307 channeldb: add new migration to upgrade old databases to new invoice time series index 2018-07-06 12:21:58 -07:00
24d97b5ee5 channeldb: add new test to exercise invoice time series index 2018-07-06 12:21:58 -07:00
532975588d channeldb: update existing invoice tests to due to recent field additions 2018-07-06 12:21:57 -07:00
24ae13d3a5 channeldb: add two methods to allow seeking into the invoice time series
In this commit, we add two new methods: InvoicesAddedSince and
InvoicesSettledSince. These methods will be used by higher level
sub-systems that implement notifications to deliver any notifications
backlog based on the last add index, and last settle index that the
client knows of.

It's important to note that care has been taken to ensure that this new
API can be used in a backwards compatible manner. If a client specifies
and index of 0 for either of the methods, then no backlog will be sent.
This is due to the fact that current users of the API don't expect any
backlog notifications to be sent. Additionally, the index actually
starts at 1, instead of 0.
2018-07-06 12:21:57 -07:00