Commit Graph
100 Commits
Author SHA1 Message Date
Olaoluwa Osuntokun e2229b74e7 Merge pull request #1081 from t4sk/queryroutes-return-msat
Include millisatoshis in queryroutes
2018-04-18 19:33:43 -07:00
Olaoluwa Osuntokun 431f3f3185 build: update to latest btcwallet commit
In this commit we update to the latest version of btcwallet which will
properly detect bitcoind rejections when attempting to retransmit
unmnined transaction on restart. Additionally, we'll now remove any
transaction that are rejected from the mempool at broadcast time.

Related to #1030.
2018-04-18 19:01:25 -07:00
Olaoluwa Osuntokun 005510b54f chainntnfs/bitcoindnotify: fix possible panic with lack of txindex
In this commit, we fix a recently introduced bug which can result in a
panic when bitcoind nodes without a txindex active are started. The
issue was that we would still defence the transaction's blockhash, which
would be nil if we detected that the backend didn't have the txindex
active.
2018-04-17 20:08:58 -07:00
Olaoluwa Osuntokun 188b8462cd lnwallet: update addr in transactions_test.go for new regtest hrp 2018-04-17 19:26:32 -07:00
Olaoluwa Osuntokun d63b923f5e Revert "rpcserver: remove uneccessary signal to breacharbiter at force close"
This reverts commit 0f90c950da.

We actually still need to notify the BRAR of a force close, as
otherwise, it doesn't have a signal to exit due to a local force close
event.
2018-04-17 19:05:40 -07:00
Olaoluwa Osuntokun 21b6c62bf9 Merge pull request #1020 from mecampbellsoup/add-version-to-getnetworkinfo-rpc
Add version field to GetInfo RPC endpoint
2018-04-17 18:41:18 -07:00
Olaoluwa Osuntokun f6e6196f65 Merge pull request #898 from vapopov/hrprefix
Wrong BOLT11 prefix in regtest
2018-04-17 18:30:37 -07:00
Olaoluwa Osuntokun 8649181e95 build: update to latest version of btcd with proper regtest hrp 2018-04-17 18:28:25 -07:00
Olaoluwa Osuntokun 1f4a02e814 Merge pull request #751 from wpaulino/txindex
Remove txindex requirement for full nodes
2018-04-17 18:20:10 -07:00
Olaoluwa Osuntokun 7f039980c1 lnd+cmd/lncli: allow users to disable logging sub-systems all together 2018-04-16 19:18:04 -07:00
Olaoluwa Osuntokun 09291d6aeb contractcourt: ensure the closeObserver exits on quit 2018-04-16 17:28:48 -07:00
Olaoluwa Osuntokun f23848cac0 Merge pull request #1093 from halseth/copy-htlc-rhash
[bugfix] Copy htlc rhash when returing ListChannelsResponse
2018-04-16 17:18:56 -07:00
Olaoluwa Osuntokun 87c1ca1a84 Merge pull request #1105 from halseth/chainntfs-btcd-hostorical-mempool-spends
Notify on confirmed spends during btcd rescans
2018-04-16 16:38:46 -07:00
Olaoluwa Osuntokun b0709b45f7 Merge pull request #1090 from halseth/servertest-build-flag
[trivial] server test: add !rpctest build flag
2018-04-13 20:43:49 -07:00
Olaoluwa Osuntokun 4bf86aab27 test: in testUpdateChannelPolicy wait for Alice to learn of all channels
In this commit, we fix an existing flake in the integration tests. If it
was the case that Alice didn't yet know of all the channels, then the
payment attempt below would fail at times, depending on other timing
factors in the test. We fix this flake by waiting for Alice to learn of
all channels before we proceed to the actual testing logic.
2018-04-13 15:35:59 -07:00
Olaoluwa Osuntokun 5f0d07e485 Merge pull request #1089 from halseth/resolvecontract-missing-return-on-exit
Add missing return on exit to resolveContract
2018-04-13 14:23:13 -07:00
Olaoluwa Osuntokun cc08baec63 Merge pull request #1088 from Roasbeef/chan-close-fix
contractcourt: fix co-op chan close issue by not closing over loop iterator variable
2018-04-13 13:41:41 -07:00
Olaoluwa Osuntokun 86ad6d318e Merge pull request #889 from wpaulino/chainnotifier-updates
chainntnfs: add incremental update notifications within ChainNotifier
2018-04-12 19:21:26 -07:00
Olaoluwa Osuntokun aaa8fa33b1 contractcourt: when creating resolveContract closure don't bind to loop variable
In this commit, we fix a long standing bug where at times a co-op
channel closure wouldn't be properly marked as fully closed in the
database. The culprit was a re-occurring code flaw we've seen many times
in the codebase: a closure variable that closes over a loop iterator
variable. Before this instance, I assumed that this could only pop up
when goroutines bind to the loop iterator within a  closure. However,
this instance is the exact same issue, but within a regular closure that
has _delayed_ execution. As the closure doesn't execute until long after
the loop has finished executing, it may still be holding onto the _last_
item the loop iterator variable was assigned to.

The fix for this issue is very simple: re-assign the channel point
before creating the closure. Without this fix, we would go to call
db.MarkChanFullyClosed on a channel that may not have yet actually be in
the pending close state, causing all executions to fail.

Fixes #1054.
Fixes #1056.
Fixes #1075.
2018-04-12 18:54:33 -07:00
Olaoluwa Osuntokun f052f18312 test: extend closeChannelAndAssert to also check that channel is no longer pending close
In this commit, we extend the closeChannelAndAssert testing utility
function to ensure that the channel is no longer marked as "pending
close" in the database. With this change, we hop to catch a recently
reported issue wherein users report that a co-op close channel has been
fully confirmed, yet it still pops up in the `pendingchannels` command.
2018-04-12 18:54:32 -07:00
Olaoluwa Osuntokun 7a13378671 channeldb+contractcourt: add additional logging around co-op channel closes 2018-04-12 17:13:37 -07:00
Olaoluwa Osuntokun f667e3b29f Merge pull request #1079 from cfromknecht/chain-watcher-unlock
contractcourt/chain_watcher: release mutex on return
2018-04-11 16:16:24 -07:00
Olaoluwa Osuntokun bc029b9cd4 contractcourt: properly log error if unable to update chan close state 2018-04-10 16:55:32 -07:00
Olaoluwa Osuntokun 12cb35a6c9 Merge pull request #1067 from cfromknecht/fmgr-scope-fix
fundingmanager: fixes range-goroutine scoping bug
2018-04-09 20:49:50 -07:00
Olaoluwa Osuntokun 32ad632aa1 Merge pull request #956 from halseth/channel-newlocalforceclosesummary
[refactor] lnwallet/channel: add NewLocalForceCloseSummary
2018-04-09 20:47:53 -07:00
Olaoluwa Osuntokun 9d29c4f43d server: only swap out the port for inbound connections
Note that the check is actually reversed to the quirk atm in the server
logic, where inbound and outbound are reversed.

Fixes #1063.
2018-04-09 19:55:01 -07:00
Olaoluwa Osuntokun 13945de806 Merge pull request #1041 from aakselrod/bitcoind-cn-ooo-fix
chainntnfs/bitcoindnotify: rescan blocks manually instead of rewinding
2018-04-06 20:32:24 -07:00
Olaoluwa Osuntokun 5b5491338b Merge pull request #1019 from Roasbeef/proper-link-constraints
htlcswitch: properly apply the fee constraints of the *outgoing* link when accepting HTLC's
2018-04-06 18:31:13 -07:00
Olaoluwa Osuntokun 31d2f4595f Merge pull request #1035 from Roasbeef/bip-compliant-neutrino
build: update to point to BIP158+BIP157 compliant btcd+btcutil+neutrino
2018-04-06 18:11:15 -07:00
Olaoluwa Osuntokun 3b47a24a7e build: update to point to BIP158+BIP157 compliant btcd+btcutil+neutrino 2018-04-06 16:29:30 -07:00
Olaoluwa Osuntokun fb3c488d3c build: update to version of btcd w/ mempool spend ntfns 2018-04-06 16:21:09 -07:00
Olaoluwa Osuntokun 1034bdf9e0 Merge pull request #1034 from halseth/funding-custom-csv-delay-bugfix
[bugfix] Custom remote_csv_delay and min_htlc_msat
2018-04-06 15:41:04 -07:00
Olaoluwa Osuntokun a6ffe999c6 routing: prune vertex, not ege after repeated FeeInsufficientErrors
In this commit, we modify the way we handle FeeInsufficientErrors to
more aggressively route around nodes that repeatedly return the same
error to us. This will ensure we skip older nodes on the network which
are running a buggier older version of lnd. Eventually most nodes will
upgrade to this new version, making this change less needed.

We also update the existing test to properly use a multi-hop route to
ensure that we route around the offending node.
2018-04-06 14:52:02 -07:00
Olaoluwa Osuntokun aa7f83d72e lnwire: remove pointer receiver from ToUint64 for ShortChannelID 2018-04-06 14:52:02 -07:00
Olaoluwa Osuntokun 3fa2e08665 test: update testUpdateChannelPolicy to ensure Bob's link uses the proper policies
In this commit, we update the testUpdateChannelPolicy to exercise the
recent set of changes within the switch. If one applies this test to a
fresh branch (without those new changes) it should fail. This is due to
the fact that before, Bob would attempt to apply the constraints of the
incoming link (which we updated) instead of the outgoing link. With the
recent set of changes, the test now properly passes.
2018-04-06 14:52:01 -07:00
Olaoluwa Osuntokun ffabb17ce6 peer: use new fetchLastChanUpdate method to populate the ChannelLinkConfig 2018-04-06 14:52:01 -07:00
Olaoluwa Osuntokun 8b520377bb htlcswitch: fix TestUpdateForwardingPolicy
In this commit, we fix the TestUpdateForwardingPolicy test case after
the recent modification in the way we handling validating constraints
within the link. After the recent set of changes, Bob will properly use
his outgoing link to validate the set of fee related constraints rather
than the incoming link. As a result, we need to modify the second
channel link, not the first for the test to still be applicable.
2018-04-06 14:52:01 -07:00
Olaoluwa Osuntokun ec8e3b626d htlcswitch: update unit tests to account for recent API changes 2018-04-06 14:52:00 -07:00
Olaoluwa Osuntokun 0a47b2c4ad htlcswitch: remove linkControl in favor of a mutex guarding all channel indexes
In this commit, we simplify the switch's code a bit. Rather than having
a set of channels we use to mutate or query for the set of current
links, we'll instead now just use a mutex to guard a set of link
indexes. This serves to simplify the ode, and also make it such that we
don't need to block forwarding in order to add/remove a link.
2018-04-06 14:52:00 -07:00
Olaoluwa Osuntokun 7037d55f65 htlcswitch: perform fee related checks at forwarding time
In this commit, we fix a very old, lingering bug within the link. When
accepting an HTLC we are meant to validate the fee against the
constraints of the *outgoing* link. This is due to the fact that we're
offering a payment transit service on our outgoing link. Before this
commit, we would use the policies of the *incoming* link. This would at
times lead to odd routing errors as we would go to route, get an error
update and then route again, repeating the process.

With this commit, we'll properly use the incoming link for timelock
related constraints, and the outgoing link for fee related constraints.
We do this by introducing a new HtlcSatisfiesPolicy method in the link.
This method should return a non-nil error if the link can carry the HTLC
as it satisfies its current forwarding policy. We'll use this method now
at *forwarding* time to ensure that we only forward to links that
actually accept the policy. This fixes a number of bugs that existed
before that could result in a link accepting an HTLC that actually
violated its policy. In the case that the policy is violated for *all*
links, we take care to return the error returned by the *target* link so
the caller can update their sending accordingly.

In this commit, we also remove the prior linkControl channel in the
channelLink. Instead, of sending a message to update the internal link
policy, we'll use a mutex in place. This simplifies the code, and also
adds some necessary refactoring in anticipation of the next follow up
commit.
2018-04-06 14:52:00 -07:00
Olaoluwa Osuntokun 9d4cea93f0 discovery: fix deadlock in processChanPolicyUpdate
In this commit, we fix an existing deadlock in the
processChanPolicyUpdate method. Before this commit, within
processChanPolicyUpdate, we would directly call updateChannel *within*
the ForEachChannel closure. This would at times result in a deadlock, as
updateChannel will itself attempt to create a write transaction in order
to persist the newly updated channel.

We fix this deadlock by simply performing another loop once we know the
set of channels that we wish to update. This second loop will actually
update the channels on disk.
2018-04-06 14:51:57 -07:00
Olaoluwa Osuntokun 80d57f3ddf build: udpate to version of btcwallet w/ re-org fix 2018-04-06 14:40:22 -07:00
Olaoluwa Osuntokun 3575aef7e2 Merge pull request #1040 from Roasbeef/write-buf-peer
peer: re-use a static writeBuf within writeMessage optimize memory usage
2018-04-06 14:31:28 -07:00
Olaoluwa Osuntokun 7cbe78eeee peer: re-use a static writeBuf within writeMessage optimize memory usage
In this commit, we might a very small change to the way writing messages
works in the peer, which should have large implications w.r.t reducing
memory usage amongst chatty nodes.

When profiling the heap on one of my nodes earlier, I noticed this
fragment:
```
Showing top 20 nodes out of 68
      flat  flat%   sum%        cum   cum%
         0     0%     0%    75.53MB 54.61%  main.(*peer).writeHandler
   75.53MB 54.61% 54.61%    75.53MB 54.61%  main.(*peer).writeMessage
```

Which points to an inefficiency with the way we handle allocations when
writing new messages, drilling down further we see:
```
(pprof) list writeMessage
Total: 138.31MB
ROUTINE ======================== main.(*peer).writeMessage in /root/go/src/github.com/lightningnetwork/lnd/peer.go
   75.53MB    75.53MB (flat, cum) 54.61% of Total
         .          .   1104:   p.logWireMessage(msg, false)
         .          .   1105:
         .          .   1106:   // As the Lightning wire protocol is fully message oriented, we only
         .          .   1107:   // allows one wire message per outer encapsulated crypto message. So
         .          .   1108:   // we'll create a temporary buffer to write the message directly to.
   75.53MB    75.53MB   1109:   var msgPayload [lnwire.MaxMessagePayload]byte
         .          .   1110:   b := bytes.NewBuffer(msgPayload[0:0:len(msgPayload)])
         .          .   1111:
         .          .   1112:   // With the temp buffer created and sliced properly (length zero, full
         .          .   1113:   // capacity), we'll now encode the message directly into this buffer.
         .          .   1114:   n, err := lnwire.WriteMessage(b, msg, 0)
(pprof) list writeHandler
Total: 138.31MB
ROUTINE ======================== main.(*peer).writeHandler in /root/go/src/github.com/lightningnetwork/lnd/peer.go
         0    75.53MB (flat, cum) 54.61% of Total
         .          .   1148:
         .          .   1149:                   // Write out the message to the socket, closing the
         .          .   1150:                   // 'sentChan' if it's non-nil, The 'sentChan' allows
         .          .   1151:                   // callers to optionally synchronize sends with the
         .          .   1152:                   // writeHandler.
         .    75.53MB   1153:                   err := p.writeMessage(outMsg.msg)
         .          .   1154:                   if outMsg.errChan != nil {
         .          .   1155:                           outMsg.errChan <- err
         .          .   1156:                   }
         .          .   1157:
         .          .   1158:                   if err != nil {
```

Ah hah! We create a _new_ buffer each time we want to write a message
out. This is unnecessary and _very_ wasteful (as seen by the profile).
The fix is simple: re-use a buffer unique to each peer when writing out
messages. Since we know what the max message size is, we just allocate
one of these 65KB buffers for each peer, and keep it around until the
peer is removed.
2018-04-06 12:55:17 -07:00
Olaoluwa Osuntokun e30881a14c Merge pull request #1033 from stevenroose/close-offline
rpcserver: Clarify failure closing offline channel
2018-04-06 12:20:30 -07:00
Olaoluwa Osuntokun b7875fce4c Merge pull request #969 from halseth/chainntnfs-chain-spends
chainntnfs: optionally only notify spends on block inclusion
2018-04-05 21:40:38 -07:00
Olaoluwa Osuntokun 706cc02639 Merge pull request #958 from vapopov/pending_balance
Include a pending_balance in channelbalance response
2018-04-05 21:16:22 -07:00
Olaoluwa Osuntokun e0adb0a4dd Merge pull request #1007 from wpaulino/htlc-switch-stats
htlcswitch: fix periodic calculation of satoshis sent/received
2018-04-05 20:44:27 -07:00
Olaoluwa Osuntokun 28737474ce Merge pull request #929 from guggero/aezeed-test
aezeed: add tests and README
2018-04-05 19:52:00 -07:00
Olaoluwa Osuntokun 065b39bc0b Merge pull request #1025 from Roasbeef/incoming-htlc-breach-retribution
lnwallet+test: properly generate the sender HTLC script in a contract breach scenario
2018-04-05 17:58:31 -07:00
Olaoluwa Osuntokun f07b1cc267 Merge pull request #1026 from Roasbeef/link-sig-errors
htlcswitch+lnwallet: ensure the Error is sent to remote peer before d/c, add detailed err for htlc sig rejection
2018-04-05 16:28:25 -07:00
Olaoluwa Osuntokun 7da8cb2910 lnwallet: add new TestNewBreachRetributionSkipsDustHtlcs test 2018-04-05 16:20:22 -07:00
Olaoluwa Osuntokun f79af461d3 lnwallet: in NewBreachRetribution create the htlcRetributions slice to capacity, not length
In this commit, we fix an existing bug in the NewBreachRetribution
method. Rather than creating the slice to the proper length, we instead
now create it to the proper _capacity_. As we'll now properly filter out
any dust HTLCs, before this commit, even if no HTLCs were added, then
the slice would still have a full length, meaning callers could actually
interact with _blank_ HtlcRetribution structs.

The fix is simple: create the slice with the proper capacity, and append
to the end of it.
2018-04-05 16:19:49 -07:00
Olaoluwa Osuntokun 406fdbbf64 brontide: increase timeout to 5s 2018-04-05 15:54:47 -07:00
Olaoluwa Osuntokun c393475d39 lnwallet: ensure that we skip dust HTLC's in NewBreachRetribution 2018-04-04 18:41:38 -07:00
Olaoluwa Osuntokun 4e44528bff lnwallet: fix ordering of keys when we generate the sender script during a breach
In this commit, we fix an existing within lnd. Before this commit,
within NewBreachRetribution the order of the keys when generating the
sender HTLC script was incorrect. As in this case, the remote party is
the sender, their key should be first. However, the order was swapped,
meaning that at breach time, our transaction would be rejected as it had
the incorrect witness script.

The fix is simple: swap the ordering of the keys. After this commit, the
test extension added in the prior commit now passes.
2018-04-04 18:41:37 -07:00
Olaoluwa Osuntokun e91dff44e6 test: extend testRevokedCloseRetributionRemoteHodl to have HTLCs in both directions
In this commit, we extend the testRevokedCloseRetributionRemoteHodl so
that the final broadcast revoked transaction has incoming *and* outgoing
HTLC's. As is, this test fails as there's a lingering bug in the way we
generate htlc resolutions. A follow up commit will remedy this issue.
2018-04-04 18:41:33 -07:00
Olaoluwa Osuntokun ca9174e166 peer: extend SendMessage to allow callers to block until msg is sent 2018-04-04 17:43:57 -07:00
Olaoluwa Osuntokun b3bc374ba1 htlcswitch: send a direct Error if we get a known channel error on validate commit 2018-04-04 17:41:47 -07:00
Olaoluwa Osuntokun 1c5d62a804 lnwallet: add new concrete error InvalidHtlcSigError for failed htlc sig validation
In this commit we add a new error: InvalidHtlcSigError. This error will
be returned when we're unable to validate an HTLC signature sent by the
remote party. This will allow other nodes to more easily debug _why_ the
signature was rejected.
2018-04-04 17:41:10 -07:00
Olaoluwa Osuntokun 0dbd325fd0 htlcswitch: synchronously send the error to the peer on commitment verify fail
In this commit, we fix a slight bug in lnd. Before this commit, we would
send the error to the remote peer, but in an async manner. As a result,
it was possible for the connections to be closed _before_ the error
actually reached the remote party. The fix is simple: wait for the error
to be returned when sending the message. This ensures that the error
reaches the remote party before we kill the connection.
2018-04-04 17:38:35 -07:00
Olaoluwa Osuntokun f53a99e18e htlcswitch: modify the SendMessage method on the Peer interface to optionally block
In this commit, add a new argument to the SendMessage method to allow
callers to request that the method block until the message has been sent
on the socket to the remote peer.
2018-04-04 17:36:44 -07:00
Olaoluwa Osuntokun 6fa93a78c1 lnd+lncli: bump version to 0.4.1 2018-04-02 17:08:39 -07:00
Olaoluwa Osuntokun 47a1d3f9e5 Merge pull request #955 from halseth/neutrinonotify-epoch-queue
[small] neutrinonotify: use epochqueue to notify block epochs
2018-04-02 16:23:14 -07:00
Olaoluwa Osuntokun 000e77f36c docs+README: update docs to no longer imply that only btcd is support
In this commit, we modify the docs in order to clarify that both btcd
and bitcoind are supported as chain backends. Many users expressed
confusion as the old set of docs stated that we "require" my btcd fork,
rather than clarifying that *if* you want to use btcd, then you must use
my fork.
2018-04-02 16:19:21 -07:00
Olaoluwa Osuntokun b422e4ec1e lnwallet+funding+lnd: add new config option for min accepted channel size
In this commit we add a new command line option (and a sane default) to
allow users to specify the *smallest* inbound channel that they'll
accept. Having a higher-ish limit lets users limit their channels, and
also avoid a series of very low value "spam" channels.

The new option is --minchansize, and expressed in satoshis. If we
receive an inbound channel request for a value smaller than this, then
we'll immediately reject it.
2018-04-02 16:17:58 -07:00
Olaoluwa Osuntokun de0a2ee49b server: don't directly mutate net.TCPAddr for inbound connections to set peer port
In this commit, we fix a minor logging bug introduced in a prior commit.
Before we would directly modify the *net.TCPAddr that was a part of the
brontide connection. This achieved our goal, but would print weird log
messages as we mutated the port in the already established connection.

In this commit, we fix that by ensuring we create a copy iff it's a
net.TCPAddr, then modify that and replace the instance in the
lnwire.NetAddress.

Fixes #991.
2018-04-02 16:14:33 -07:00
Olaoluwa Osuntokun 5984cbd4ff htlcswitch: allow overpaying for incoming payments
In this commit, we relax the constraints on accepting an exit hop
payment a bit. We'll now accept any incoming payment that _at least_
pays the invoice amount. This puts us further inline with the
specification, which recommends that nodes accept overpayment by a
certain margin.

Fixes #1002.
2018-04-02 15:58:56 -07:00
Olaoluwa Osuntokun d82f67cc1d brontide: decrease handshake timeout to 1s 2018-04-02 15:56:47 -07:00
Olaoluwa Osuntokun 138da98df6 Merge pull request #992 from cfromknecht/makefile-docs
Makefile docs
2018-04-02 15:46:36 -07:00
Olaoluwa Osuntokun 8f08983fda Merge pull request #1001 from cfromknecht/brontide-async-handshake
brontide/listener: make handshake asynchronous
2018-04-02 15:38:26 -07:00
Olaoluwa Osuntokun 9b729654f6 server: remove all pending conn reqs within DisconnectPeer 2018-03-31 16:26:19 -07:00
Olaoluwa Osuntokun 48982015fe build: commit latest inputs-digest for dep 2018-03-31 16:25:41 -07:00
Olaoluwa Osuntokun 72e59077ba makefile: update install directive to just use go install 2018-03-31 16:25:21 -07:00
Olaoluwa Osuntokun 29c9d78c63 Merge pull request #965 from cfromknecht/makefile-fix-and-timeout
Switch to Makefile Build System
2018-03-31 16:09:59 -07:00
Olaoluwa Osuntokun 6be6b48e09 Merge pull request #840 from halseth/openchannel-csv-delay
Add CSV delay flag to openchannel
2018-03-31 16:05:08 -07:00
Olaoluwa Osuntokun ffb1b65eca Merge pull request #982 from cfromknecht/server-conns
server: cleanup persistent connection retries
2018-03-31 15:56:29 -07:00
Olaoluwa Osuntokun 4480052cd6 server: ensure a default backoff is always used 2018-03-30 19:11:12 -07:00
Olaoluwa Osuntokun 956d20ebdc funding+lnd: ensure we reconnect to new channel peers
In this commit, we fix a minor bug in the prior versions of lnd. Before
this commit, if we received a new inbound connection for channel
creation, the channel was created, and then the peer disconnected, we
wouldn't automatically reconnect.

In this commit we fix this issue by overloading the WatchNewChannel
method to also accept the peer's ID so we can add it to the set of
persistent connections.
2018-03-30 18:42:40 -07:00
Olaoluwa Osuntokun d34c37f3dd server: when constructing peer addr's attempt to locate proper port, fallback to default port
In this commit, we fix an existing bug within the codebase: if a peer
connected to us inbound, then we'd attempt to use the assigned port when
re-establishing a connection to them. We fix this issue in this commit
by adding a new method to look up any advertisements for the peer, and
use the specified port that matches our connection attempt. If we can't
find a proper advertisement, then we'll simply use the default peer
port.
2018-03-30 15:59:11 -07:00
Olaoluwa Osuntokun 71b8195ad0 funding: remove old TODO 2018-03-30 15:57:19 -07:00
Olaoluwa Osuntokun b2e1d6988c server: don't immediately add bootstrap peer to set of persistent connections 2018-03-30 15:16:18 -07:00
Olaoluwa Osuntokun 2526827b6d test: modify sphinx replay test to force close the final channel
In this commit, we modify the sphinx replay test to actually force close
that final channel. We do this, as otherwise, we'll now reject the co-op
close attempt as the channel still has active HTLCs.
2018-03-30 14:53:05 -07:00
Olaoluwa Osuntokun 8d71ed2f64 lnwire: return pointer to ErrUnknownAddrType to ensure type switch in peer.go catches it
Related to #979.
2018-03-30 14:26:09 -07:00
Olaoluwa Osuntokun 9dee2ce8f2 lnwire: properly return UnknownMessage if we encounter an unknown message type 2018-03-30 14:25:27 -07:00
Olaoluwa Osuntokun 90636b49b2 server: properly format peer pubkey in NotifyWhenOnline logging msg
Fixes #978.
2018-03-30 13:15:49 -07:00
Olaoluwa Osuntokun c5c23eb833 Merge pull request #974 from Roasbeef/invoice-expiry-fix
zpay32+rpc: ensure we can encode an expiry of math.MaxUint64, limit to 1 year in seconds
2018-03-30 13:12:53 -07:00
Olaoluwa Osuntokun 447a031435 peer: reject remote closes with active HTLCs
In this commit, we follow up to the prior commit by ensuring we won't
accept a co-op close request for a chennel with active HTLCs. When
creating a chanCloser for the first time, we'll check the set of HTLC's
and reject a request (by sending a wire error) if the target channel
still as active HTLC's.
2018-03-30 13:06:57 -07:00
Olaoluwa Osuntokun ecbeca5f29 rpc: disallow attempting a co-op close of a channel with active HTLCs
In this commit, we fix a bug that at times could cause any dangling
HTLC's to be sent to miner's fees if a user attempted to close out a
channel cooperatively that still had pending HTLC's. We'll first prevent
this at the RPC level by rejecting any attempts to trigger a co-op
channel closure while a channel still have dangling HTLC's.
2018-03-30 12:51:01 -07:00
Olaoluwa Osuntokun ef4512d1d8 rpc: limit the larger invoice expiry to 1 year
This is a follow up to the prior commit. In order to add an additional
layer of defense, we'll reject any expiry greater than 1 year.
2018-03-29 16:25:11 -07:00
Olaoluwa Osuntokun 10847170ee zpay32: adjust uint64 encoding to account for math.MaxUnit64
In this commit, we fix a logic error in our routine for converting a
uint64 to/from base32. Before this commit, we assumed that the max
number of groups was 12. However, the math.MaxUint64 (1<<64 - 1) can
actually consume more than 12 groups with an extra set of bits. Before
this commit, we would panic when attempting to parse an invoice
generated like so:
  * addinvoice --amt 1337000 --expiry 99999999999999999

To fix this issue, we modify our logic to expect at most 13 groups.
Additionally, we've added a new test that would panic before applying
this commit.

Fixes #972.
2018-03-29 16:24:20 -07:00
Olaoluwa Osuntokun a0fe4fb716 Merge pull request #968 from halseth/chanarb-doublespend
contractcourt/channel_arbitrator: ignore ErrDoubleSpend on force close
2018-03-29 16:11:38 -07:00
Olaoluwa Osuntokun 117441b7d0 Merge pull request #928 from adrienemery/python-docs
docs: encode macaroon in python grpc example
2018-03-29 15:36:30 -07:00
Olaoluwa Osuntokun 1a8bec4ed1 Merge pull request #967 from halseth/breachretribution-curve-nil
[mini] contractcourt/chain_watcher: don't print curve of DoubleTweak
2018-03-29 15:34:51 -07:00
Olaoluwa Osuntokun 87d77a1b87 Merge pull request #962 from cfromknecht/makefile-dep
Makefile w/ dep
2018-03-28 20:07:19 -07:00
Olaoluwa Osuntokun 0162b93e13 Merge pull request #957 from cfromknecht/bump-ltc-dust-limit
chainregistery: correct ltc dust limit
2018-03-28 16:10:42 -07:00
Olaoluwa Osuntokun 90a13aedcf Merge pull request #954 from halseth/remove-breacharbiter-signal
[mini] rpcserver: remove uneccessary signal to breacharbiter at force close
2018-03-28 15:21:42 -07:00
Olaoluwa Osuntokun 41ea771989 Merge pull request #953 from cfromknecht/mark-open-in-mem
channeldb: update ShortChanID in-mem during MarkAsOpen
2018-03-28 15:19:56 -07:00
Olaoluwa Osuntokun 51ae820a0c Merge pull request #959 from halseth/notifier-order
Add spend notification to client map before recording it with backend
2018-03-28 15:01:02 -07:00
Olaoluwa Osuntokun d5b218b286 Merge pull request #911 from nalinbhardwaj/litecoin
Litecoin fixes
2018-03-28 14:59:16 -07:00