Commit Graph

928 Commits

Author SHA1 Message Date
Oliver Gugger
f9d4600ff8
Merge pull request #7645 from shaurya947/bitcoind-minmempoolfee
sweep+lnrpc: enforce provided fee rate is no less than relay fee
2023-05-30 13:15:22 +02:00
shaurya947
85ab96cd09
lnrpc: move CalculateFeeRate from rpcserver.go to rpc_utils.go
This refactor aims to house the CalculateFeeRate function in a more
"shareable" location. It used to be a non-exported function inside
of rpcserver.go. However, other routines, such as FundPsbt inside
of walletkit_server.go, could also rely on the same fee calculation
functionality. So we move the function to rpc_utils.go and export it,
and we will reuse it in the FundPsbt workflow in a future PR.
2023-05-26 11:16:51 -04:00
shaurya947
c8e4d8e69b
rpcserver: attach channel Memo to *lnrpc.Channel struct
This allows us the memo to be returned in responses such as
listchannels.
2023-05-18 13:02:30 -04:00
shaurya947
7c6faa4c98
funding: add Memo to InitFundingMsg struct
We add byte-array field called Memo to the InitFundingMsg struct.
We also provide a value for this from
rpcserver.go#parseOpenChannelReq().
2023-05-18 13:02:30 -04:00
shaurya947
1724409647
rpcserver: enforce memo length is less than 500 characters
In this commit we ensure that the string length of the memo field
specified as part of the OpenChannelRequest is no longer than 500.
2023-05-18 13:02:24 -04:00
Oliver Gugger
8df4edef1b
Merge pull request #7624 from ellemouton/marshalBytesAndStringTxid
multi: populate both string and byte TXID in lnrpc.Outpoint
2023-05-08 17:32:54 +02:00
Carla Kirk-Cohen
3f9f0ea5d1
multi/refactor: separate methods for get and set node announcement
In preparation for a more complex function signature for set node
announcement, separate get and set so that readonly callers don't need
to handle the extra arguments.
2023-05-04 10:35:42 -04:00
Elle Mouton
7b186716a1
multi: populate both string and byte TXID in lnrpc.Outpoint
This commit adds a a new `MarshalOutPoint` helper in the `lnrpc` package
that can be used to convert a `wire.Outpoint` to an `lnrpc.Outpoint`.
By using this helper, we are less likely to forget to populate both the
string and byte form of the TXID.
2023-04-24 16:19:26 +02:00
Bjarne Magnussen
0e5b3e77cb lnd: handles the FundMax field inside parseOpenChannelReq
Adds handling of the `FundMax` field when parsing an
`OpenChannelRequest` with `rpcServer.parseOpenChannelReq`.
2023-04-05 23:05:07 +02:00
djkazic
41016587eb Add peer_scid_alias field to lnrpc.Channel 2023-03-31 11:20:27 -04:00
Eval EXEC
cbcbddfe29
rpcserver: add time_lock_delta overflow check 2023-03-23 21:34:12 +08:00
yyforyongyu
9bd0dcd121
rpcserver: add debug log for rpc calls 2023-03-17 10:01:42 +08:00
Slyghtning
213bdb2e01 rpcserver: assign peer alias lookup error 2023-03-03 10:07:44 +01:00
yyforyongyu
c26917ee1f
multi: rename LookupHtlc to LookupHtlcResolution for clarity 2023-03-01 01:47:08 +08:00
yyforyongyu
38d0ee9291
lnd: don't allow lookup when StoreFinalHtlcResolutions is false 2023-02-27 16:59:16 +08:00
Slyghtning
3e5943b7f9 rpcserver: enrich ListChannels with peer alias 2023-02-24 10:49:11 +01:00
Joost Jager
784c0631f3
rpcserver: expose store final htlc resolutions flag on info call
The storage of final htlc resolutions is a safety-critical feature. By
exposing it through the GetInfo call, connected applications can
ensure that the feature is turned on and avoid relying on the assumption
that lnd was configured correctly.
2023-02-13 11:53:27 +01:00
Joost Jager
db5dc4d360
rpcserver: fix line lengths 2023-02-13 11:53:10 +01:00
yyforyongyu
ced8833895
channelnotifier: add InactiveLinkEvent
This commit adds a new event `InactiveLinkEvent` to be used when a link
becomes inactive.
2023-01-18 03:46:16 +08:00
positiveblue
5ff5225245
multi: break invoice depenency on channeldb
Now that we have the new package `lnd/channeldb/models` we can invert the
depenency between `channeldb` and `invoices`.

- Move all the invoice related types and errors to the
`invoices` package.

- Ensure that all the packages dealing with invoices use the types and
  interfaces defined in the `invoices` package.

- Implement the InvoiceDB interface (defined in `lnd/invoices`) in
  channeldb.

- Add new mock for InterfaceDB.

- `InvoiceRegistery` tests are now in its own subpacakge (they need to
  import both invoices & channeldb). This is temporary until we can
  decouple them.
2023-01-16 07:31:09 -08:00
bitromortac
454c115b6e
routing+routerrpc: add capacity in rpcs
FetchPairCapacity is used by the following endpoints to introduce the
capacity for probability calculations:

* QueryProbability
* QueryRoutes
2022-12-12 13:22:29 +01:00
Oliver Gugger
625c6f1949
Merge pull request #7227 from Crypt-iQ/tlv_change_to_p2p
multi: update to tlv/v1.1.0 and use new *P2P tlv decoding variants
2022-12-05 23:11:30 +01:00
eugene
032632b4e0
multi: update to tlv/v1.1.0 and use new *P2P tlv decoding variants
This changes the call-sites in several places to use the *P2P variants
to not trigger an OOM on untrusted input. This makes the code safe with
the new tlv version. Note that the call-sites prior to this change were
also safe.
2022-12-05 09:32:56 -05:00
yyforyongyu
e9269c2093
channeldb+lnd: rpc server filters payments by date 2022-12-05 20:04:47 +08:00
yyforyongyu
234b9a3d97
channeldb+lnd: rpc server filters invoices by date 2022-12-05 20:03:58 +08:00
Oliver Gugger
ad8e25cbc9
multi: don't access loop variables in goroutines
This commit makes sure that no loop variables or other temporary
variables are accessed directly in a goroutine but are instead passed
into the goroutine through a parameter. This makes sure a copy of the
value is put on the stack and is not changed while the outside loop
continues.
2022-11-21 13:54:23 +01:00
st4rgut24
8d6d1564c0 cli: revise help text for addinvoice lncli command [skip ci] 2022-11-11 14:31:04 -08:00
Joost Jager
3a89a84744
rpcserver: add LookupHtlc call 2022-10-27 16:43:09 +02:00
Slyghtning
46b8de35ac lnrpc+lncli: rename skip_peer_alias_lookup to reflect opt-in behavior 2022-10-27 07:11:19 -04:00
yyforyongyu
3b250b294c
rpcserver+lntemp: add more error logs to PendingChannels
This commit adds error logs to `PendingChannels` and changes how we
assert the num of pending force close channels, see the docs for more
info.
2022-10-27 01:11:33 +08:00
Joost Jager
6e073cb213
rpcserver: expose graph tlv data 2022-10-25 18:17:35 +02:00
Joost Jager
0663a92bff
rpcserver: extract marshalNode 2022-10-25 18:17:34 +02:00
Joost Jager
01e7f09dfb
rpcserver: extract marshalDBRoutingPolicy 2022-10-25 15:24:48 +02:00
Slyghtning
3e4c98c938 rpcserver: enrich ForwardingHistory with peer alias
In this commit a helper method in ForwardingHistory is introduced that enriches
each ForwardingEvent by peer alias names for the incoming and outgoing channel.
2022-10-20 09:23:47 -04:00
Roei Erez
b6a24b52fe
lnrpc+rpcserver: add remote reserve to openchannel request 2022-10-07 14:57:05 +02:00
Slyghtning
1e030c2d48 rpcserver: parse channel fees into InitFundingMsg 2022-09-29 08:21:09 -04:00
Elle Mouton
081546ee00
rpcserver: error on zero local balance in openchan req
In this commit, we catch and error on the specific case where an
openchannel request has a zero-value local funding amount. This is just
to ensure that the error message returned makes more sense.
2022-09-26 13:29:28 +02:00
yyforyongyu
0735522194
multi: fix make fmt 2022-08-23 22:10:24 +08:00
Elle Mouton
ca6a2e12e0
rpcserver+docs: add default case to addr type switch
This commit adds a default case to the address type switch statement in
the NewAddress rpc server function. This catches any invalid address
types and returns an error.
2022-08-22 17:25:56 +02:00
Olaoluwa Osuntokun
be5bc79444
Merge pull request #6716 from Crypt-iQ/zeroconfacceptor
multi: add zeroconfacceptor to default reject incoming channels
2022-08-12 14:20:11 -07:00
eugene
c2a4a9adbc
multi: add zeroconfacceptor that default rejects if no rpc acceptors
This is a safety mechanism so that zero-conf channels are not accepted
by default if no rpc acceptor exists.
2022-08-12 16:30:42 -04:00
Olaoluwa Osuntokun
bcff2f07de
rpc: use P2TR addresses when sending funds back to wallet (anchor reserve) 2022-08-11 17:26:18 -07:00
eugene
aa576adecc
rpc+cli: add general ListAliases function to dump all aliases 2022-08-09 14:11:08 -04:00
eugene
48f270fe20
rpc: add zero-conf, alias information to {list,closed}channels 2022-08-09 14:09:41 -04:00
Olaoluwa Osuntokun
1e556aa189
multi: thread through the new max fee field for co-op close
In this commit, we parse the new max fee field, and pass it through the
switch, all the way to the peer where it's ultimately passed into the
chan closer state machine.
2022-07-26 17:23:16 -07:00
Elle Mouton
25acb51ba3
multi: registration complete MW interceptor msg
In this commit, we change the flow of the rpc middleware registration
a bit. In order to allow a client to add rpc middleware interceptors in
a deterministic order, we now make the server send a "registration
complete" message to the client after compeleting the registration
process so that the client knows when it can go ahead and register the
next client.
2022-07-20 14:58:47 -05:00
eugene
49dd4b9e34
multi: add zero-conf, scid-alias channel-types to rpc
This allows the open channel rpcs to use the zero-conf or scid-alias
channel types.
2022-07-07 17:10:30 -04:00
eugene
0ba67015da
rpcserver+invoicesrpc: alias-aware AddInvoice,AddHoldInvoice rpc
AddInvoice,AddHoldInvoice now issue invoices that include our
peer's aliases. Some extra sanity checks are included to ensure we
don't leak our confirmed SCID for a private channel.
2022-07-07 17:10:29 -04:00
eugene
1aa9626606
server+funding: allow scid-alias, zero-conf chantypes, scid-alias
feature-bit channels

This allows opening zero-conf chan-type, scid-alias chan-type, and
scid-alias feature-bit channels. scid-alias chan-type channels are
required to be private. Two paths are available for opening a zero-conf
channel:

* explicit chan-type negotiation
* LDK carve-out where chan-types are not used, LND is on the
  receiving end, and a ChannelAcceptor is used to enable zero-conf

When a zero-conf channel is negotiated, the funding manager:
* sends a FundingLocked with an alias
* waits for a FundingLocked from the remote peer
* calls addToRouterGraph to persist the channel using our alias in
  the graph. The peer's alias is used to send them a ChannelUpdate.
* wait for six confirmations. If public, the alias edge in the
  graph is deleted and replaced (not atomically) with the confirmed
  edge. Our policy is also read-and-replaced, but the counterparty's
  policy won't exist until they send it to us.

When a scid-alias-feature channel is negotiated, the funding manager:
* sends a FundingLocked with an alias:
* calls addToRouterGraph, sends ChannelUpdate with the confirmed SCID
  since it exists.
* when six confirmations occurs, the edge is deleted and re-inserted
  since the peer may have sent us an alias ChannelUpdate that we are
  storing in the graph.

Since it is possible for a user to toggle the scid-alias-feature-bit
to on while channels exist in the funding manager, care has been taken
to ensure that an alias is ALWAYS sent in the funding_locked message
if this happens.
2022-07-07 17:10:28 -04:00
priyanshiiit
8578433b3d lnrpc+lnd: adds required reserve in walletbalance rpc 2022-06-28 23:31:51 +05:30