Commit Graph
100 Commits
Author SHA1 Message Date
Conner Fromknecht b907035438 Merge pull request #4412 from aantonop/height_hint_cache_query_disable
New config option - disable height hint cache queries
2020-07-14 18:58:15 -07:00
Conner Fromknecht 2f0ccaead1 Merge pull request #4429 from Roasbeef/i-wumbo-you-wumbo-he-she-wumbo
multi: I wumbo, you wumbo, he she wumbo
2020-07-13 16:06:27 -07:00
Conner Fromknecht 60446494e9 Merge pull request #4157 from carlaKC/2472-newbucketforresolutions
contractcourt: Persist Resolution Outcomes
2020-07-07 12:14:58 -07:00
Conner Fromknecht 01ba4d0b59 Merge pull request #4371 from yyforyongyu/expose-channel-constraints
lnrpc: expose all local and remote channel constraints
2020-07-01 16:45:35 -07:00
Conner Fromknecht eeea441c3c Merge pull request #4405 from joostjager/interceptor-out
htlcswitch: expose additional data for intercepted packets
2020-06-29 11:35:20 -07:00
Conner Fromknecht cff52f7622 Merge pull request #4352 from matheusdtech/discovery-lock-premature
discovery: correctly lock premature messages
2020-06-26 22:50:09 -07:00
Conner Fromknecht 20dea0d6bc invoices/invoiceregistry: explicitly set blank pay addr for keysend 2020-06-26 02:17:18 -07:00
Conner Fromknecht 11e9fd3e92 channeldb/invoices: special-case all zeros pay addr
Avoids indexing the all-zeros pay addr, since it is still in use by
legacy keysend. Without this, the pay addr index will reject all but the
first keysend since they will be detected as duplicates within the set
id index.
2020-06-26 02:00:03 -07:00
Conner Fromknecht c1ef5bb908 Merge pull request #4410 from yyforyongyu/remove-fastsha256
htlcswitch: remove fastsha256 in test
2020-06-24 21:09:37 -07:00
Conner Fromknecht 03b20cabd2 Merge pull request #4275 from cfromknecht/invoices-ntfn-order
invoices: ensure ntfns are sent in the same order
2020-06-22 12:15:07 -07:00
Conner Fromknecht 60a6f2ddd1 Merge pull request #4391 from matheusdtech/lnwire-zero-sid
lnwire: fix decoding for initial zero sid
2020-06-18 17:21:43 -07:00
Conner Fromknecht 47cf144170 invoices: ensure ntfns are sent in the same order
SettleHodlInvoice and CancelInvoice both notifyClients after
notifyHodlSubscribers. This commit changes UpdateInvoice to follow the
same pattern so that we are consistent.
2020-06-18 16:28:13 -07:00
Conner Fromknecht f5581eb04a Merge pull request #4370 from wpaulino/no-graph-restored-channels
channeldb: remove graph insertion of restored channels
2020-06-18 16:17:56 -07:00
Conner Fromknecht 5eb798a23e Merge pull request #4365 from Crypt-iQ/chancloser_pkg_0609
lnwallet/chancloser: cooperative channel closure pkg
2020-06-18 13:38:41 -07:00
Conner Fromknecht 87880c0d56 Merge pull request #4141 from guggero/rest-api-improvements
REST saga 3/3: REST API for subservers, websocket for streaming responses
2020-06-17 10:30:29 -07:00
Conner Fromknecht d688ea2124 Merge pull request #4369 from wpaulino/coin-select-lock-sync
rpc: acquire global coin select lock in related RPCs
2020-06-15 10:06:43 -07:00
Conner Fromknecht d47d17b5d4 Merge pull request #4261 from carlaKC/4164-indexpayments
channeldb: Index payments by sequence number
2020-06-10 08:11:45 -07:00
Conner Fromknecht 87d1c37e3c Merge pull request #4356 from wpaulino/sign-key-desc-quirk
signrpc: parse both KeyDescriptor fields for SignOutputRaw requests
2020-06-08 20:16:52 -07:00
Conner Fromknecht 06028ed141 Merge pull request #4358 from matheusdtech/contest-doc
contractcourt/incoming_resolver: Improve comments
2020-06-08 15:12:56 -07:00
Conner Fromknecht 7f258d0213 Merge pull request #4303 from wpaulino/persistent-output-leases
walletrpc: add basic coin selection RPCs
2020-06-03 21:39:15 -07:00
Conner Fromknecht 5e09a5287a lnd: use Infof to format errors on channeldb open 2020-05-27 22:42:46 -07:00
Conner Fromknecht 66652ec4bc channeldb/db: lower-case ErrDryRunMigrationOk message 2020-05-27 22:42:22 -07:00
Conner Fromknecht eae8e6de17 channeldb/invoices: correct stray kvdb.ReadBucket to RBucket
We recently renamed kvdb.ReadBucket to kvdb.RBucket in #4252, but this
was not detected in #4285 since this new code didn't produce a
conflict.
2020-05-27 20:20:29 -07:00
Conner Fromknecht 3faf8bad3f Merge pull request #4320 from guggero/refactor-log-writer
config+log: remove global RootLogWriter variable
2020-05-27 19:25:32 -07:00
Conner Fromknecht 0f3ab775c7 Merge pull request #4285 from cfromknecht/pay-addr-index
channeldb: index payments by payment addr, use payment hash as fallback
2020-05-27 17:36:30 -07:00
Conner Fromknecht 152d153e7f itest: increase mempool timeout
Neutrino can get slow towards the end of the itests.
2020-05-26 19:49:42 -07:00
Conner Fromknecht 5c4ab4b7cf lntest: update error whitelist 2020-05-26 19:49:42 -07:00
Conner Fromknecht cbf71b5452 channeldb+invoices: use payment addr as primary index 2020-05-26 18:55:27 -07:00
Conner Fromknecht 3522f09a08 channeldb+invoices: track invoices by InvoiceRef 2020-05-26 18:55:27 -07:00
Conner Fromknecht 2799202fd9 invoices/invoiceregistry: rename updateCtx to ctx 2020-05-26 18:55:27 -07:00
Conner Fromknecht e80e21d1a8 channeldb/migration: add generic CreateTLB migration
This commit creates a generic migration for creating top-level buckets.
2020-05-26 18:55:27 -07:00
Conner Fromknecht 24cce7a6ec channeldb: consolidate top-level bucket create/wipe 2020-05-26 18:55:27 -07:00
Conner Fromknecht d343575104 channeldb/migtest: log migration failure instead of failing
This line was incorrectly moved when the migtest package was created for
migration 12. This PR introduces a negative test for CreateTLB which
surfaced this.
2020-05-26 18:55:22 -07:00
Conner Fromknecht 32b04b7ac3 Merge pull request #4228 from carlaKC/txdetails-labeltxrpc
walletrpc: add LabelTransaction endpoint to retrospectively label txns
2020-05-26 18:37:27 -07:00
Conner Fromknecht d0f3f6166d lntest/itest: add link error to whitelist 2020-05-26 18:21:08 -07:00
Conner Fromknecht ef9068319b multi: rename ReadCursor to RCursor 2020-05-26 18:21:08 -07:00
Conner Fromknecht 455ddfebdb multi: rename: ReadBucket to RBucket 2020-05-26 18:21:08 -07:00
Conner Fromknecht d0d2ca403d multi: rename ReadTx to RTx 2020-05-26 18:20:37 -07:00
Conner Fromknecht 6a02fa1107 invoices/invoiceregistry: properly synchronize backlog
This commit moves the db calls for retrieving add and settle backlogs
outide of the main event loop. All other db operations are performed
outside of the event loop and synchronized via the invoice registry's
mutex, which also synchronizes the order in which events submitted to be
processed.

This resolves various concurrency issues where notifications can be
missed of inconsistent reads against the databse. This is especially
important in this case because we are actually making two separate
database calls.
2020-05-26 17:50:46 -07:00
Conner Fromknecht 5b747715fc invoices: return error from SubscribeNotifications on shutdown 2020-05-26 17:50:45 -07:00
Conner Fromknecht 1332575482 channeldb/invoices: ignore error when no settles exist
This fixes a bug that would cause no backlog to be delivered at all.
2020-05-26 17:50:45 -07:00
Conner Fromknecht 64b8aa8f11 Merge pull request #4227 from guggero/signing-abstraction
multi: Remove need for DerivePrivKey from watchtower, brontide, netann and sphinx package
2020-05-20 16:07:44 -07:00
Conner Fromknecht afc60353a1 Merge pull request #4213 from carlaKC/txdetails-addlabel
lnrpc: add optional labels to on chain transactions
2020-05-19 14:44:55 -07:00
Conner Fromknecht 2f84d1a819 Merge pull request #4280 from cfromknecht/read-for-each-node
channeldb: remove Tx arg from ForEachNode
2020-05-13 16:37:10 -07:00
Conner Fromknecht 90d3bf532d channeldb+routing: remove tx arg for ForEachNode 2020-05-12 17:53:20 -07:00
Conner Fromknecht b6915d9fbf Merge pull request #3892 from matheusdtech/fix-lingering-contract
contractcourt: fix lingering contract after local breach
2020-05-12 11:46:26 -07:00
Conner Fromknecht c57d0797aa Merge pull request #4220 from guggero/github-actions
github: add GitHub Actions configuration
2020-05-11 15:53:28 -07:00
Conner Fromknecht 4f6cef83fc config: adds cli configurable --migration-dry-run 2020-05-11 15:38:56 -07:00
Conner Fromknecht c775819372 channeldb/db: adds optional dry-run abort for migrations 2020-05-11 15:38:45 -07:00
Conner Fromknecht fcc18b6815 Merge pull request #4221 from guggero/move-release
build: move release script and README to more appropriate locations
2020-05-05 09:33:53 -07:00
Conner Fromknecht 315c56607c Merge pull request #4161 from joostjager/itest-err-guard
itest: check for new errors in logs
2020-05-04 10:15:49 -07:00
Conner Fromknecht 10112af76b Merge pull request #4239 from theStack/20200502-doc-fix-numleadingzerobytes-comments
tlv: fix comments for numLeadingZeroBytes{32,64} funcs
2020-05-04 10:03:17 -07:00
Conner Fromknecht 20a776d703 Merge pull request #4194 from wpaulino/ignore-tor-inbound-reconnect
server: ignore reconnection for unadvertised inbound peers over Tor
2020-04-30 20:38:16 -07:00
Conner Fromknecht 1bfe52837d Merge pull request #4176 from wpaulino/listchannels-uptime-before-server-active
rpcserver: omit uptime in ListChannels response if server not started
2020-04-30 20:33:37 -07:00
Conner Fromknecht 89bd58786e lnwallet/channel: enforce absolute fee floor of 250 sat/kw
This enforces the _actualized_ fee rate of the  commitment transaction,
rather than the fee floor used for estimation. The new value of 250
sat/kw corresponds to 1 sat/byte, rather than 253 which is only rounded
up during estimation to account for the fact that BOLT 3 rounds down to
the nearest satoshi and that the vbyte fee estimation is lossy.

Previously we would incorrectly fail to sign the next commitment even
though the fee was technically high enough. Restarting with this commit
should solve the issue as long as the channel hasn't already gone to
chain.
2020-04-21 12:37:34 -07:00
Conner Fromknecht 3ab5899853 lnwallet/channel: fix log typo 2020-04-20 22:12:49 -07:00
Conner Fromknecht 6ec2cc5669 htlcswitch/mailbox_test: use mailboxContext everywhere
Modifies some of the older mailbox tests that were left untouched as of
PR #4174 to use the new mailbox test context. This ensures that the
config members of each mailbox's config are properly initialized. In
certain instances where travis is slow, this would cause test panics.
2020-04-20 15:37:33 -07:00
Conner Fromknecht b467f549b7 htlcswitch/link: return error from AddPacket 2020-04-14 22:34:59 -07:00
Conner Fromknecht 0a3fdf0271 htlcswitch/test_utils: extend PendingCommit timeout
Flakes locally on darwin.
2020-04-14 22:34:59 -07:00
Conner Fromknecht 55f90be2a5 htlcswitch/mailbox: rename Settle/Fail queue to indicate replies
This commit renames the variables associated with processing the
Settle/Fail packets to indicate that they are replies.
2020-04-14 10:51:48 -07:00
Conner Fromknecht ec1b8d874d htlcswitch/link: add pending commit ticker for stall detection
This commit adds a PendingCommitTicker to the link config, which allows
us to control how quickly we fail the link if the commitment dance
stalls. Now that the mailbox has the ability to cancel packets, when the
link fails it will reset the mailbox packets on exit, forcing a
reevaluation of the HTLCs against their mailbox expiries.
2020-04-14 10:51:30 -07:00
Conner Fromknecht 4756c00474 Merge pull request #4188 from cfromknecht/verrpc-typo-fix
lnrpc/verrpc: correct mispelling of compilation
2020-04-14 10:51:11 -07:00
Conner Fromknecht a8977651cc htlcswitch/linkfailure: use whitelist for ShouldSendToPeer 2020-04-14 10:51:06 -07:00
Conner Fromknecht 6fca22be2b htlcswitch/link: use return instead of break out
There is no clean up logic after the loop, done purely to improve
clarity.
2020-04-14 10:50:45 -07:00
Conner Fromknecht 16ad0274c9 htlcswitch/mailbox: fail on duplicate adds 2020-04-14 10:50:25 -07:00
Conner Fromknecht e7ece11c29 htlcswitch/mailbox: fail htlcs when delayed for 1 minute
Now that packet failure is handled by the mailbox, we can now enforce
a delivery deadline and fail the packet if it the deadilne is exceeded.
This gives senders quicker feedback about tried routes, and allows them
to try alternative paths to the destination in the meantime.
2020-04-14 10:50:07 -07:00
Conner Fromknecht 1aa2dde4a4 htlcswithc/mailbox: prioritize settles/fails over adds
This commit splits the packet courier internally into two distinct
queues, one for adds and one for settles+fails. This allows us to
prioritize HTLCs that will clear the commitment transaction and make
space for adds. Previously this responsibility was handled by the
overflow queue.
2020-04-14 10:49:48 -07:00
Conner Fromknecht 37dca27a3d htlcswitch: thread clock from switch to mailbox 2020-04-14 10:49:26 -07:00
Conner Fromknecht 63f3d0b012 htlcswitch/mailbox: advance packet head after delivery
This commit delays the advancement of the pktHead until after the
message has been delivered. This is a prepatory step, as in the future
we may fail to deliver the packet due to a deadline expiring.
2020-04-14 10:48:59 -07:00
Conner Fromknecht 564534c829 htlcswitch: move packet failure to mailbox
This commit moves the current logic for sending failures out of the link
and into the mailbox in preparation for our failing delayed htlcs. We do
so because the mailbox may need to fail packets while the link is
offline, and needs to be able to complete the task without member
methods on the link.
2020-04-14 10:48:40 -07:00
Conner Fromknecht 12bbf28e65 htlcswitch: make handleBatchFwdErrors a pure function 2020-04-14 10:48:23 -07:00
Conner Fromknecht f3051efeb3 htlcswitch/mailbox: block until mailbox shutdown
Fixes a bug where Stop() wouldn't actually wait for the mailbox to exit.
2020-04-14 10:48:06 -07:00
Conner Fromknecht 5b38ed0b3e htlcswitch/link: correct link log statement 2020-04-14 10:47:47 -07:00
Conner Fromknecht d4823161d8 lnrpc/verrpc: correct mispelling of compilation 2020-04-13 23:45:02 -07:00
Conner Fromknecht d6fa2f9092 peer: filter channels loaded into switch via whitelist
This is less brittle than blacklisting states since it may not be clear
that new states needs to be added. Now that HasChanStatus is fixed for
ChanStatusDefault, we can safely implement this.
2020-04-13 15:19:59 -07:00
Conner Fromknecht f93a8ab7d0 cmd/lncli: add version command that reads verrpc.GetVersion 2020-04-10 16:39:31 -07:00
Conner Fromknecht 91cd7e633a lnrpc+rpcserver: expose git commit hash in getinfo 2020-04-10 16:39:31 -07:00
Conner Fromknecht 5c04038c18 bulid: only return semantic version from Version()
The version field in getinfo is kept the same for backwards
compatibility.
2020-04-10 16:39:23 -07:00
Conner Fromknecht a25269c4d3 lnrpc/verrpc: add Versioner RPC server 2020-04-10 16:39:23 -07:00
Conner Fromknecht d66f15d01f make+build: compile go version into binary 2020-04-10 16:39:23 -07:00
Conner Fromknecht 07420835d0 make+build: compile build tags into binary 2020-04-10 16:39:23 -07:00
Conner Fromknecht 75a1a1fbab make+build: compile SHA1 commit hash into binary 2020-04-10 16:39:22 -07:00
Conner Fromknecht b68764f86c build/version: check AppPreRelease semantics in init()
We'll do the validation during construction of the runtime so that we
can safely use the AppPreRelease field externally without needing to
normalize it.
2020-04-10 16:39:22 -07:00
Conner Fromknecht 640aadb61a build/version: expose AppMajor, AppMinor, AppPatch, etc. 2020-04-10 16:39:22 -07:00
Conner Fromknecht 06bd645e5d build/version: fix incomplete semanticAlphabet godoc 2020-04-10 16:39:22 -07:00
Conner Fromknecht 93089aaaf8 channeldb/channel: don't print ChanStatusDefault when it's not
This commit removes ChanStatusDefault from the list of
orderedChanStatusFlags since it is not flag. As with the prior commit,
the logic around these flags assumes everything in the list is a flag,
but ChanStatusDefault is not.

It turns out we properly special case that if the channel is in
ChanStatusDefault that we only return ChanStatusDefault. However, if any
of the bits are set we would always report ChanStatusDefault since
status&0 == 0. This fixed simply by removing ChanStatusDefault from the
list since we only need the list to express non-default status flags.
2020-04-10 16:11:44 -07:00
Conner Fromknecht f71cc951fd channeldb/channel: fix HasChanStatus for ChanStatusDefault
This commit resovles a lingering issue w/in the codebase wrt how the
ChannelStatus flags are defined. Currently ChannelStatus is improperly
used to define a bit field and the individual flags themselves. As a
result, HasChanStatus accepts queries on particular status (combinations
of flags) and individual flags themselves.

This is an issue because the way HasChanStatus computes whether the
channel has a particular status assumes the provided inputs are all
flags (or at least combinations of flags).

However, ChanStatusDefault is simply the absence of any other flag.
Hence, HasChanStatus will always return true when querying for
ChanStatusDefault because status&0 == 0 is always true.

Longer term we should should consider splitting these definitions into
flags and particular states, and change the way construct or operate on
them, but for now I've just special-cased this one value. Fortunately,
we don't query HasChannelStatus w/ ChanStatusDefault anywhere in the
codebase so we dodge a bullet here, but it'd be nice to have some
greater assurances moving forward.
2020-04-10 16:05:12 -07:00
Conner Fromknecht c1b9b272cd input/size: assert witness size constants
This commit introduces a new test case that asserts all of the witness
size constants currently in the codebase. We also reintroduce the
AcceptedHtlcSuccessWitnessSize and OfferedHtlcTimeoutWitnessSize
constants that were recently removed for the sake of completeness.

In asserting the witnes sizes, there were three uncovered discrepancies:
 * OfferedHtlcSuccessWitnessSize overestimated by about 30% because it
   included an extra signature in the calculation.

 * ToLocalPenaltyWitnessSize was underestimated by one byte, because it
   was missing the length byte for the OP_TRUE. This has implications
   the watchtower protocol since the client and server are assumed to
   share the same weight estimates used for signing. This commit keeps
   the current behavior, with the intention of rolling out negotiation
   for which weight estimate to use for a given session.

 * AcceptedHtlcScriptSize was underestimated by one byte because it was
   missing a length byte for the value 32 pushed on the stack when
   asserting the preimage's length. This affects all AcceptedHtlc*
   witness sizes.
2020-04-10 15:34:27 -07:00
Conner Fromknecht f2b6e2af04 input: pass input.Signature to multisig spend
Modifies SpendMultiSig to accept input.Signature, so that we can
ultimately assert the size of multisig witnesses.
2020-04-10 14:27:35 -07:00
Conner Fromknecht 0f94b8dc62 multi: return input.Signature from SignOutputRaw 2020-04-10 14:27:35 -07:00
Conner Fromknecht 37dffb225a input: introduce Signature iface
This commit introduces the Signature interface which will be used by our
witness construction methods instead of passing in raw byte slices. This
will be used later to inject various kinds of mock signatures, e.g.
73-byte signatures for simulating worst-case witness weight.
2020-04-09 12:49:11 -07:00
Conner Fromknecht 2b2c8b5a10 lnwallet/interface_test: wait for bitcoind startup
Flakes locally for me on darwin.
2020-04-09 12:49:07 -07:00
Conner Fromknecht 2ccec4bc5c Merge pull request #4152 from cfromknecht/lncli-invoices-category
cmd/lncli: move invoice-related cmds to Invoices category
2020-04-07 15:48:38 -07:00
Conner Fromknecht b8da7e54fb Merge pull request #4145 from cfromknecht/remove-overflow-queue
htlcswitch: remove overflow queue
2020-04-07 14:33:30 -07:00
Conner Fromknecht f50649d21b htlcswitch/link: remove overflow queue
This commit removes the overflowQueue from the link. We do so in order
to promote better UX for senders, so that HTLCs are failed faster when
the commitment is full. This gives the sender the opportunity to try
another, more open path, rather than perceive the HTLC as being stuck.

At the same time, we remove the total number of active goroutines in lnd
by a factor of N where N is the number of active channels.
2020-04-07 13:20:36 -07:00
Conner Fromknecht 68d1753dcb htlcswitch/test_utils: send htlcs before waiting for result
This commit is preparation for the test added in the subsequent commit.
We modify makeHoldPayment to return any failures direectly when trying
to add an HTLC to the switch. This lets us know that the HTLC was indeed
sent without failure when the method returns.
2020-04-07 11:56:22 -07:00
Conner Fromknecht 5a057de5c4 htlcswitch/mailbox: remove errors from AckPacket, Start, Stop
A following commits will move/modify callsites of AckPacket, Start, and
Stop, none of which use the return value and ultimately cause the linter
to complain. However, none of these in-memory operations can fail so we
just remove the returned errors altogether.
2020-04-07 11:55:54 -07:00
Conner Fromknecht e86ddf6ae7 htlcswitch/link: remove unused isReProcess argument 2020-04-07 11:55:25 -07:00
Conner Fromknecht 759d7a122f htlcswitch/test_utils: add missing return
This commit corrects a bug in the testing harness that could cause
more than one error to be returned on the error channel.
2020-04-07 11:54:56 -07:00
Conner Fromknecht 310e20f8b7 invoices/invoiceregistry: remove debug spew 2020-04-07 11:54:29 -07:00