Commit Graph

9439 Commits

Author SHA1 Message Date
Joost Jager
6e8442b333
routing: move payment session constructor 2020-04-16 16:25:24 +02:00
Olaoluwa Osuntokun
eec3799da9
build: bump version to bump version to v0.10.0-beta.rc2 2020-04-15 12:32:02 -07:00
Olaoluwa Osuntokun
30b7036709
Merge pull request #4195 from cfromknecht/mailbox-cancel-fixups
htlcswitch: mailbox cancel followups
2020-04-15 12:30:54 -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
Olaoluwa Osuntokun
95e2809ba3
build: bump version to v0.10.0-beta.rc1
We also add '.' to the semantic versioning alphabet to ensure it isn't
stripped out.
2020-04-14 20:08:36 -07:00
Olaoluwa Osuntokun
5955f83504
Merge pull request #4174 from cfromknecht/mailbox-cancel
htlcswitch: mailbox cancellation
2020-04-14 20:04:57 -07:00
Olaoluwa Osuntokun
7b066ad91e
Merge pull request #4190 from guggero/fix-windows-build
make+lnd+config: fix Windows build and version string
2020-04-14 19:57:26 -07:00
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