Commit Graph

9481 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
b7d5667db0
Merge pull request #4184 from wpaulino/upfront-shutdown-reservation-cleanup
fundingmanager: check remote peer upfront shutdown support before reservation
2020-04-14 11:15:37 -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
Oliver Gugger
1e3b0672d7
config+lnd+lncli: add commit back to version string 2020-04-14 15:51:44 +02:00
Oliver Gugger
ec5bfd3df7
make: move escaped double quote to fix windows build 2020-04-14 15:51:44 +02:00
Joost Jager
19006b108c
Merge pull request #4189 from joostjager/rename-max-htlcs
routing+routerrpc+lncli: rename MaxHtlcs to MaxShards
2020-04-14 13:49:40 +02:00
Joost Jager
969eecc7d2
routing+routerrpc+lncli: rename MaxHtlcs to MaxShards 2020-04-14 10:31:59 +02:00
Conner Fromknecht
d4823161d8
lnrpc/verrpc: correct mispelling of compilation 2020-04-13 23:45:02 -07:00
Olaoluwa Osuntokun
a53a6f160e
Merge pull request #4175 from cfromknecht/fix-chanstatus-string
channeldb: correct HasChanStatus for ChanStatusDefault, fix rpc channel status
2020-04-13 18:47:33 -07:00
Olaoluwa Osuntokun
08c12d55fc
Merge pull request #4169 from bhandras/invoice_expiry_watcher_test_timeout_fix
invoices: elminitate sleep from expiry watcher tests
2020-04-13 18:46:59 -07:00
Olaoluwa Osuntokun
ee35dc1acf
Merge pull request #4185 from Roasbeef/btcutil-psbt-fixes
build: update to latest btcutil and psbt versions
2020-04-13 18:33:10 -07:00
Olaoluwa Osuntokun
84e577af45
build: update to latest btcutil and psbt versions
The latest versions of the `psbt` package includes some decoding bug
fixes.
2020-04-13 17:02:32 -07:00
Olaoluwa Osuntokun
786e278e12
Merge pull request #4163 from cfromknecht/version-rpc
verrpc: add GetVersion endpoint
2020-04-13 16:03:52 -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
Wilmer Paulino
f48c4cae37
fundingmanager: check remote peer upfront shutdown support before reservation
This addresses a bug in which a funding reservation wasn't cleaned up
properly if the remote peer didn't support upfront shutdown.
Alternatively, we could just cancel the reservation on error, but
instead we move the check above so that we don't attempt coin selection
in the first place.
2020-04-13 11:45:02 -07:00
Olaoluwa Osuntokun
8c2647de6b
Merge pull request #4172 from cfromknecht/witness-size
input: assert witness size constants
2020-04-10 16:45:04 -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
Olaoluwa Osuntokun
2c2b79d300
Merge pull request #4170 from joostjager/fix-payment-fee
lnrpc: fix payment marshalling
2020-04-10 13:52:46 -07:00
Joost Jager
e61ff2202d
lnrpc: report total fees paid
Fixes a bug where only the fees of the last route where reported.
2020-04-10 11:05:55 +02:00
Joost Jager
06f73c0a66
lnrpc: remove deprecated payment path
Not applicable anymore on the payment level with multi-part sends.
2020-04-10 11:05:52 +02:00
Olaoluwa Osuntokun
b947ed552a
Merge pull request #4075 from Roasbeef/wumbo-invoices
rpc: allow wumbo invoices
2020-04-09 19:26:41 -07:00
Olaoluwa Osuntokun
363caa441a
rpc: allow wumbo invoices
In this commit, we remove the restriction surrounding the largest
invoices that we'll allow a user to create. After #3967 has landed,
users will be able to send in _aggregate_ a payment larger than the
current max HTLC size limit in the network. As a result, we can just
treat that value as the system's MTU, and allow users to request
payments it multiples of that MTU value.

A follow up to this PR at a later time will also allow wumbo _channels_.
However, that requires us to tweak the way we scale CSV values, as post
wumbo, there is no true channel size limit, only the
_local_ limit of a given node. We also need to implement a way for nodes
to signal to other nodes their accepted max channel size.
2020-04-09 19:02:08 -07:00
Olaoluwa Osuntokun
1354a46170
Merge pull request #3967 from joostjager/mpp-send
routing: multi-shard mpp send
2020-04-09 18:54:45 -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