Commit Graph

387 Commits

Author SHA1 Message Date
bluetegu
d942bb58c3 Add support for IncludeUnannounced property of ChannelGraphRequest in
DescribeGraph rpc server method.
2018-10-04 14:54:35 -04:00
Olaoluwa Osuntokun
4b1334ad49
rpc: populate additional information in AbandonChannel close summary
In this commit, we extend the AbandonChannel RPC method to store as much
information as possible within the CloseSummary. Most importantly, we
store the current and next (if available) revocation of the remote party
along with the channel config for the local party. With this
information, we have enough data to be able to generate a custom signer
for a new commitment state, or to prove that the channel was indeed
ours if needed.
2018-09-28 16:43:17 -07:00
Wilmer Paulino
bdcc847a44
rpc: remove NewWitnessAddress RPC
In this commit, we remove the unnecessary NewWitnessAddress RPC. We do
this as, at the moment, we only expose the wallet to generate witness
addresses. Now that the RPC has been removed, its REST endpoint has been
assigned to the NewAddress RPC, which should be the de facto way of
having the wallet generate any type of supported address.

Fixes #1986.
2018-09-28 02:52:09 -07:00
Roei Erez
6bc01384d6 udpate code to include the value_sat and value_msat fields in payments 2018-09-27 08:58:18 +03:00
Joost Jager
ab67b9a4de
rpcserver+lnrpc+lncli: add AbandonChannel rpc call
Using AbandonChannel, a channel can be abandoned. This means
removing all state without any on-chain or off-chain action.
A close summary is the only thing that is stored in the db after
abandoning.

A specific close type Abandoned is added. Abandoned channels
can be retrieved via the ClosedChannels RPC.
2018-09-18 12:20:27 -07:00
Oliver Gugger
10b976187d
rpcserver: handle unconfirmed TX properly when listing all transactions 2018-09-15 11:29:32 +02:00
Wilmer Paulino
012d4f5c8c
rpcserver: include new proto fields in ListInvoices rpc 2018-09-12 22:11:59 -07:00
Johan T. Halseth
d742529bb2
rpcserver: set AmtPaidMsat when creating RPC invoice 2018-09-07 14:13:48 +02:00
Roei Erez
f0201fbb32 amount paid should be in satoshies as other fields used for amount 2018-09-05 11:41:48 +03:00
Wilmer Paulino
2906629ae5
rpcserver: implement pagination support for listing invoices
Co-authored-by: Andrey Savitskiy <taketa@users.noreply.github.com>
Co-authored-by: Valentine Wallace <valentine.m.wallace@gmail.com>
2018-08-21 18:00:08 -07:00
Wilmer Paulino
a3cec7e036
rpcserver: set minConfs field in openChanReq 2018-08-16 20:19:29 -07:00
Wilmer Paulino
5c414bb1d0
multi: make OpenChannel take in openChanReq 2018-08-16 20:19:26 -07:00
Wilmer Paulino
29efb02968
rpcserver: enforce fee floor for fee rates input by the user
In a previous commit, we modified our fee rates to be sat/kw internally
as it was possible that the estimated fee rate was not enough to
properly broadcast the transaction. To remedy this, we decided to add a
fee floor, but this would only be enforced when querying the fee
estimator. In this commit, we attempt to do the same thing, but for fee
rates input manually by the user.
2018-08-13 14:39:08 -07:00
Joost Jager
3e7473f4f0 routing: backward searching 2018-08-09 20:23:40 -07:00
Joost Jager
6c918a1806 channeldb: store unknown policies in database
The commit ensures that for every channel, there will always
be two entries in the edges bucket. If the policy from one or
both ends of the channel is unknown, it is marked as such.

This allows efficient lookup of incoming edges. This is
required for backwards payment path finding.
2018-08-09 20:23:40 -07:00
Wilmer Paulino
336f1c156e
rpcserver: convert sat/vbyte fee rates input by the user to sat/kw
In this commit, we explicitly convert sat/vbyte fee rates input by the
user to sat/kw. We do this as users are typically more accustomed to
sat/vbyte fee rates, rather than sat/kw.
2018-08-09 17:29:53 -07:00
Conner Fromknecht
cf2c371042
multi: fix linting errors 2018-08-02 18:20:50 -07:00
Conner Fromknecht
1ded697e8d
multi: sort import paths with gofmt 2018-08-02 18:20:49 -07:00
Olaoluwa Osuntokun
07defe5f93
rpc+peer: use pkScripts for close ntfns 2018-07-31 21:28:52 -07:00
Stefan Menzel
e776a06cfb rpc: disallow a negative invoice amount in AddInvoice 2018-07-25 20:11:46 -07:00
Olaoluwa Osuntokun
e0baa49690
Merge pull request #1387 from wpaulino/send-disable-chan-update
multi: send a channel update with disabled flag set on channel close
2018-07-23 17:46:37 -07:00
Olaoluwa Osuntokun
6f60f139f4 multi: switch over import paths from roasbeef/* to btcsuite/* 2018-07-13 17:05:39 -07:00
Wilmer Paulino
ee10b0a76c
rpcserver: set recently added disabled field to routing policies 2018-07-11 17:07:01 -07:00
Olaoluwa Osuntokun
904342b9e8
rpc: populate response of AddInvoice w/ add index of new invoice 2018-07-06 12:22:02 -07:00
Olaoluwa Osuntokun
892a413be3
rpc: update SubscribeInvoices to send backlog ntfns, also send add ntfns 2018-07-06 12:21:59 -07:00
Olaoluwa Osuntokun
e4c5840472
rpc: ensure new invoice fields are populated in RPC responses 2018-07-06 12:21:58 -07:00
Olaoluwa Osuntokun
b3bb65ea43
rpc: restore proper debug HTLC usage
In this commit, we fix a slight regression that happened when the
sendtoroute RPC call was implemented. As a result of the refactoring,
the debughtlc mode silently broke. In this commit, we fix this by
checking against the zero hash, rather than the length of the payment
hash, as since we use a fixed sized byte slice, it will always be zero.
2018-06-30 17:13:19 -05:00
Olaoluwa Osuntokun
c19c872cff
lnd: update invoiceRegistry to match new switch requirements 2018-06-29 16:03:51 -07:00
Olaoluwa Osuntokun
c914de177b Revert "rpc: include the FinalCltvDelta when writing new invoices to disk"
This reverts commit 4e264ee88e765b9cd15369a02378091c6520a1e6.
2018-06-29 12:40:53 -07:00
Olaoluwa Osuntokun
ff771968b6
Merge pull request #1392 from cfromknecht/signal-package
Signal/Interrupt package
2018-06-28 19:08:51 -07:00
Conner Fromknecht
5144df645b
rpcserver: request shutdown from signal package 2018-06-28 16:17:02 -07:00
Olaoluwa Osuntokun
4e264ee88e
rpc: include the FinalCltvDelta when writing new invoices to disk 2018-06-26 19:50:05 -07:00
Olaoluwa Osuntokun
d82ef41245
rpc: sort closed channels in order of ascending height 2018-06-14 17:14:39 -07:00
Olaoluwa Osuntokun
4a0d7b0244
Merge pull request #1374 from wpaulino/zero-amount-invoice-error
rpcserver: return err when paying 0 amt invoice and amt is not specified
2018-06-13 18:56:04 -07:00
Joost Jager
f80ea51f69 rpcserver: add ClosedChannels call 2018-06-13 08:48:01 +02:00
Wilmer Paulino
63f079d1a4
rpcserver: add fee limit support for routing related RPCs 2018-06-12 18:14:49 -07:00
Sebastian Delgado
6746609ec6
Add constant and percentage-based fee limits to payments
- Extend SendRequest and QueryRoutesRequest protos
- newRoute function takes fee limit and cuts off routes that exceed it
- queryRoutes, payInvoice and sendPayment commands take the feeLimit inputs and pass them down to newRoute
- When no feeLimit is included, don't enforce any feeLimits at all (by setting feeLimit to maxValue)
2018-06-12 18:14:43 -07:00
Wilmer Paulino
f27e0baf7c
rpcserver: return err when paying 0 amt invoice and amt is not specified 2018-06-11 16:33:01 -07:00
Olaoluwa Osuntokun
15f812b10f
lnwire: don't attempt to decode an empty/nil signature 2018-06-08 13:25:56 -07:00
Olaoluwa Osuntokun
bc9eca32ab
rpc: refactor logic for SendPayment+SendToRoute
In this commit, we modify the logic for the two primary payment related
RPCs to reduce duplication, indentation, and consolidate logic. As a
result, we'll now accept rpcPaymentIntents, turn those into regular
paymentIntents (convert from proto) before finally dispatching via
unified function.
2018-06-06 20:45:56 -07:00
t4sk
982f53e6f2 rpc: modify QueryRoutes to take final_cltv_delta 2018-06-06 20:45:01 -07:00
t4sk
6ddd7b4d0d rpcserver: add SendToRoute methods
rpcserver: add SendToRoute handler
2018-06-06 20:45:00 -07:00
Wilmer Paulino
077b1fffcc
Revert "rpcserver: flip inbound bool for display, fix internally later"
This reverts commit 5126e431355ea074404064b91c57732e96d0a1e6 since the
underlying issue has now been fixed.
2018-06-06 16:30:41 -07:00
Olaoluwa Osuntokun
d98d4523e1
Merge pull request #1159 from wpaulino/onion-service-support
multi: add onion services support
2018-06-04 21:46:51 -07:00
Wilmer Paulino
d6d0c26252
rpcserver: add support to connect to onion addresses
In this commit, we now allow connections to onion addresses due to
recently adding support to properly parse them.

Co-Authored-By: Eugene <crypt-iq@users.noreply.github.com>
2018-06-04 20:41:42 -07:00
Olaoluwa Osuntokun
4d37508417
rpc: ensure we don't attempt to create a routing hint with a nil edge
In this commit, we fix an existing panic bug related to the recently
added routing hints feature. If it's the case that the remote node
didn't send us their edge, then when we go to compare the public keys to
see if they match, we may attempt to deref an nil pointer.

In order to fix this, we'll instead check the edgeInfo, which is
guaranteed to also exist if the channel was found in the database. As a
defensive step, before we go to actually aces the struct, we'll check
that's it's non-nil and proceed if it is nil.
2018-06-04 17:21:42 -07:00
Wilmer Paulino
e363766394
multi: increase max funding and payment amount 60x under Litecoin 2018-05-25 00:11:20 -04:00
Johan T. Halseth
5cef2bacde
rpcserver: add TODO for removing coop closes from "pending close" channels 2018-05-24 10:29:20 +02:00
Oliver Gugger
3eff9804ee macaroons: add technical documentation, fix comments 2018-05-18 10:13:25 +02:00
Conner Fromknecht
f963f91a3c
multi: use mutex-guarded ShortChanID() on OpenChannel 2018-05-09 16:06:49 -07:00
Johan T. Halseth
409ab08c36
rpcserver: remove send to settledContracts 2018-05-02 08:43:30 +02:00
Olaoluwa Osuntokun
c54a91f44d
rpc: modify SignMessage+VerifyMessage to bind msg to LN context
In this commit, we modify the SignMessage+VerifyMessage slightly in
order to bind the message we're signing to our specific context. We do
this by pre-pending the ascii text "Lightning Signed Message:" to the
msg before we run it through dsha256. Adding this prefix binds the
message to our context in order to avoid accidentally signing a sighash
or the like.
2018-04-25 19:45:32 -07:00
Johan T. Halseth
97977c8a06
rpcserver: add channels waiting for commitment confirmation to pending channels response 2018-04-25 09:37:25 +02:00
Wilmer Paulino
a34b2d7de2
rpcserver: add missing continue if link wasn't retrieved
In this commit, we avoid hitting a possible panic in the case that we
were unable to retrieve the link of a channel from the HTLC switch while
determining which channels should be used as routing hints for an
invoice.
2018-04-21 11:31:50 -04:00
Wilmer Paulino
4e90691bf3
rpcserver: include routing hints when sending payments 2018-04-20 19:45:01 -04:00
Wilmer Paulino
d1a717ba88
rpcserver: add ability to populate routing hints when creating an invoice 2018-04-20 19:45:00 -04:00
Wilmer Paulino
1b137bf14c
rpcserver: populate the routing hints of an invoice when decoding it 2018-04-20 04:01:36 -04:00
t4sk
49510d775f rpcserver: include millisatoshis in marshallRoute 2018-04-19 09:15:21 +08:00
Olaoluwa Osuntokun
d63b923f5e
Revert "rpcserver: remove uneccessary signal to breacharbiter at force close"
This reverts commit 0f90c950daaec7843e305f32d10e36411fb0b47f.

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
practicalswift
663c396235 multi: fix a-vs-an typos 2018-04-17 19:02:04 -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
Johan T. Halseth
daeeca0bc3
rpcserver: make copy of htlc rhash before returning in listchannels
This commit fixes a bug where all the HTLC rhash slices in a
ListChannelsResponse would be tied to the loop variable, making them all
take the hash of the last HTLC in the list. This commit fixes it by
making a copy of the slice.
2018-04-15 11:36:20 +02:00
mecampbellsoup
bd398540c1 Add version field to GetInfo RPC endpoint
This is inspired by the Bitcoin RPC `getnetworkinfo` endpoint which also
includes version information:
https://bitcoin.org/en/developer-reference#getnetworkinfo
2018-04-10 09:27:44 -04: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
e30881a14c
Merge pull request #1033 from stevenroose/close-offline
rpcserver: Clarify failure closing offline channel
2018-04-06 12:20:30 -07:00
Steven Roose
445924b7a9 rpcserver: Clarify failure closing offline channel 2018-04-06 10:42:14 +02:00
Vadym Popov
29f1fda60d
rpcserver: include a pending_open_balance in channelbalance response
Changes in `ChannelBalance` rpcserver method implementation to
add `pending_open_balance` counted according state of opened channel
2018-04-01 02:40:50 +03: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
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
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
Johan T. Halseth
0f90c950da
rpcserver: remove uneccessary signal to breacharbiter at force close
This signal is no longer needed, as the breacharbiter is given
the UnilateralClosure chain event.
2018-03-28 08:10:19 +02:00
Nalin Bhardwaj
bca87535b3
rpcserver: fix GetInfo testnet detection
Fixes bug with Litecoin testnet detection.
2018-03-24 15:01:12 +05:30
Johan T. Halseth
938aefb573
rpcserver: pass incoming RemoteCsvDelay to server.OpenChannel 2018-03-22 14:54:00 +01:00
Olaoluwa Osuntokun
7d14ed7a06
Merge pull request #904 from Roasbeef/invoice-macaroon
rpc+lnd: add new invoice-only macaroon
2018-03-21 15:27:31 -07:00
Olaoluwa Osuntokun
0155bcfd5c
Merge pull request #881 from Roasbeef/autopilot-target-chan-size
funding+pilot: increase min channel size, allow specifying chan size range for autopilot
2018-03-21 15:11:25 -07:00
Olaoluwa Osuntokun
a07579c541
rpc: modify the entity of invoice related RPC's to target the invoice entity
In this commit, we modify the existing invoice RPC macaroon permissions
to target a more specific entity: “invoices”. As a result of this
commit, once node operators update, they’ll need to regenerate their
readonly.macaroon as it now needs this additional entity encoded within
it.
2018-03-21 15:08:54 -07:00
Olaoluwa Osuntokun
6a294e7489
rpc: extend writePermissions and readPermissions with the invoice entity
In the prior commit, we added a new set of permissions and also a new
entity: “invoices”. We’ll add this set of entities to the read and
write permissions accordingly as well to ensure that the existing
macaroons have access to all the items that the invoice.macaroon does.
2018-03-21 15:08:53 -07:00
Olaoluwa Osuntokun
6c6285344b
rpc: add new invoicePermissions bakery.Op slice for an invoice only macaroon
In this commit, we add a new invoicePermissions slice. This contains
all the permission that a holder of an invoice.macaroon is able to
access, and no others. We also include read and write access to
addresses as this may be useful from the PoV of a merchant or exchange.
2018-03-21 15:08:50 -07:00
Wilmer Paulino
85b03780f3
rpcserver: determine which channels to return based on passed params 2018-03-19 11:19:04 -04:00
Olaoluwa Osuntokun
8127685462
funding+rpc: raise min channel size to 20k satoshis
In this commit, we raise the min channel size to 20k satoshis. This
will be evaluated before we check for dusty commitments. The goal of
this is to ensure ample room for fees at current, and future fee
levels.
2018-03-18 17:10:25 -07:00
Conner Fromknecht
bb16f9d29a
rpcserver: use primary chain default CLTV for add invoice 2018-03-14 16:57:43 -07:00
Olaoluwa Osuntokun
800eea931f
build+multi: switch from bolt to bbolt
In this commit, we switch from boltbd/bolt to coreos/bbolt as the
former is no longer being actively maintained.
2018-03-10 19:01:13 -08:00
Conner Fromknecht
935c757102
rpcserver: allow unsafe-disconects 2018-03-09 21:18:15 -08:00
Olaoluwa Osuntokun
b41222b316
rpc: update RPC server to disallow p2pkh adds, assume segwit for ConfirmedBalance 2018-03-06 16:04:04 -05:00
Olaoluwa Osuntokun
02852cdc3b
rpc: implement new ForwardingHistory command 2018-03-06 13:56:12 -05:00
Olaoluwa Osuntokun
06c1030999
rpc: populate new day, week, and month fee sums in FeeReport 2018-03-06 13:56:12 -05:00
vegardengen
a1fb22eb8d rpc: properly populate fee field in listpayments 2018-03-06 13:21:03 -05:00
Olaoluwa Osuntokun
f7ec490f44
Merge pull request #762 from halseth/fee-estimator
Add types for representing fee rates
2018-02-26 17:22:50 -08:00
Olaoluwa Osuntokun
7f04d927a0
rpc: fix queryroutes bug that assumed precise number of returned routes
In this commit, we fix a bug in the query routes RPC that could at
times lead to a panic. This would happen if the number of returned
routes was less than the number of expected routes. To remedy this,
we’ll return the minimum of the number of requested routes, and the
number of routes actually returned.
2018-02-26 16:31:50 -08:00
Johan T. Halseth
ba3f3e1942
rpcserver: express fee rates using types 2018-02-26 22:42:27 +01:00
Johan T. Halseth
31ec79e7ae
Merge branch 'master' into master 2018-02-21 13:54:26 +01:00
Jason Dufair
84551c616f lnwallet/lnrpc: Expose sync status to gRPC interface
This commit adds wallet_best_block_timestamp to the gRPC interface.
This is done in order to allow clients to calculate progress while
lnd syncs to the blockchain. wallet_best_block_timestamp is exposed
via the GetInfo() rpc call. Additionally, IsSynced() returns the
WalletBestBlockTimestamp as the second value in the tuple
that is returned, providing additional detail when querying about the
status of the sync. The BtcWallet interface has also been updated
accordingly.

This commit was created to support the issue to
[Add progress bar for chain sync] (lightninglabs/lightning-app#10) in
lightning-app
2018-02-20 19:00:06 -08:00
MeshCollider
2c2ed3c6a9 multi: Unify use of NodeKey in log messages 2018-02-19 17:48:39 -08:00
MeshCollider
4c42079436 multi: ensure NodeKey is set in rpc/cli 2018-02-19 17:48:39 -08:00
MeshCollider
915c4201b9 multi: remove internal peer_id usage 2018-02-19 17:48:39 -08:00
Daniel McNally
56c01ebcfe rpcserver: passing active net to zpay32.Decode 2018-02-19 10:20:54 -05:00
Olaoluwa Osuntokun
1879130f64
rpc: modify QueryRoutes response to return exact number of requested routes 2018-02-12 16:29:12 -08:00