Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to upstream v0.14 branch #205

Merged
merged 579 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
579 commits
Select commit Hold shift + click to select a range
c19bef9
rpcperms+lnd: use macaroon service from interceptor chain
guggero Sep 23, 2021
388eca7
chainreg: add chain source and channel constraints
guggero Sep 23, 2021
2556ec4
lnd+pilot: use minHTLCIn instead of whole config
guggero Sep 23, 2021
4a330f1
walletunlocker+lnd: move WalletUnlockParams
guggero Sep 23, 2021
7d20cb6
dcrlncli: Reduce defaultRecoveryWindow (gap limit)
matheusd Feb 12, 2024
c9aa318
multi: Bring upstream init refactor
guggero Sep 23, 2021
9b5d800
server: use deduped addrMap for connReq creation
ellemouton Oct 7, 2021
50dae2f
multi: Lint fixes
matheusd Jan 25, 2024
4f6d408
tor: rename dial to dialProxy
yyforyongyu Sep 23, 2021
b485b12
tor: patch unit tests for tor controller
yyforyongyu Sep 23, 2021
4ffb32e
tor: add logging to tor controller
yyforyongyu Sep 23, 2021
5b60c85
tor: remove Onion Service upon shutdown
yyforyongyu Sep 23, 2021
781614b
tor: add a new response reader for tor controller
yyforyongyu Sep 24, 2021
30209c0
tor: add GETINFO method to check liveness of onion service
yyforyongyu Sep 25, 2021
2a907c5
tor: add method Reconnect to reset connection
yyforyongyu Sep 27, 2021
57f447c
healthcheck: add CheckTorServiceStatus to monitor Tor connection
yyforyongyu Sep 27, 2021
b9a15a2
multi: add tor connection healthcheck
yyforyongyu Sep 27, 2021
eb1f814
tor: Lint fixes
matheusd Jan 25, 2024
f1b70d8
lntest: avoid global ServeMux
torkelrogstad Aug 26, 2021
fb6b3de
multi: refactor SignMessage to specify hashing
guggero Oct 14, 2021
a0807be
multi: Prevent doubleHash in SignMessage
matheusd Jan 25, 2024
fe67fe3
multi: extract key ring creation from chain control
guggero Oct 14, 2021
506ecc4
signrpc: add compact_sig flag to SignMessage
guggero Oct 14, 2021
a96f8b9
walletrpc: Add AddressType and Change to NextAddr
matheusd Jan 25, 2024
0355e1d
multi: forward SendCoins call over RPC
guggero Oct 14, 2021
aa978e9
multi: allow watch-only wallet creation
guggero Oct 14, 2021
8bd59f8
multi: create and list all default internal accounts
guggero Oct 14, 2021
155ec6c
cmd/lncli+walletrpc: add createwatchonly command
guggero Oct 14, 2021
002a8b3
itest: refactor tests to be re-used
guggero Oct 14, 2021
418c12f
lntest: add itest for remote signing
guggero Oct 14, 2021
fde0e6a
lnrpc: send custom message
joostjager May 31, 2021
9787833
lnrpc: receive custom message
joostjager May 31, 2021
cfb1171
multi: move bandwidth hints behind interface
carlaKC Oct 19, 2021
2852cc3
multi: thread bandwidth check amount down to MayAddOutgoingHtlc
carlaKC Oct 19, 2021
e3e6e5a
itest: More log info to debug CI flake
matheusd Jan 26, 2024
4919a3b
htlcswitch: Log reasons for not shutting down link
matheusd Jan 26, 2024
975a54c
itest: Step around itest flake
matheusd Jan 26, 2024
dc0f817
chainntnfs: Delay spend/confirm notifications
matheusd Jan 29, 2024
117af0d
lncfg: add protocol config option for script enforced lease support
wpaulino Jul 13, 2021
71ef8ad
lnwire+feature: add feature bit for script enforced lease support
wpaulino Jul 13, 2021
216b402
lnwire: add LeaseExpiry custom record for Open+AcceptChannel
wpaulino Jul 28, 2021
1dcfbd2
channeldb: add new ChannelType bit for script enforced leased channels
wpaulino Jul 14, 2021
aead9e4
funding+lnwallet: support funding new script enforced leased channels
wpaulino Jul 14, 2021
b87cd17
input: add scripts for new script enforced lease commitment type
wpaulino Jul 13, 2021
a8ef173
input: add witness gen and weight estimates for new commitment type
wpaulino Jul 13, 2021
ce6ed15
lnwallet: coalesce different supported output scripts into single method
wpaulino Jul 15, 2021
3e20d9e
lnwallet: support transactions and scripts for new commitment type
wpaulino Jul 15, 2021
816bd89
input: add new constructor to support CSV and CLTV locked inputs
wpaulino Jul 13, 2021
37aae2f
contractcourt: handle sweeping script-enforced leased channel outputs
wpaulino Jul 14, 2021
c6d4be6
sweep: remove previous exclusive group upon re-offered inputs
wpaulino Jul 15, 2021
dab624f
lnrpc: add new CommitmentType for script enforced leased channels
wpaulino Jul 15, 2021
c21b18a
chanacceptor: include commitment type in channel acceptor requests
wpaulino Jul 15, 2021
a0640e4
itest: update itests to use new script-enforced lease commitment type
wpaulino Jul 13, 2021
a6c7dcf
chanbackup: support backup restore of script enforced leased channels
wpaulino Jul 26, 2021
42852c0
itest: test backup restore of script enforced lease channel type
wpaulino Jul 26, 2021
eb9d2c9
multi: Lint fixes
matheusd Jan 29, 2024
eca823b
itest: defer close of done channel
guggero Oct 8, 2021
4bff868
lnrpc: log channel point in coop close warning
alexbosworth Oct 22, 2021
7ced097
lnwire: switch chan_type feature to bits 44/45
Roasbeef Oct 20, 2021
bc5de1c
routing: relax penalties for channel disabled errors
champo Aug 2, 2021
f4c4942
routing: add test case for result interpretation of Channel Disabled …
champo Sep 6, 2021
790feaa
routing: report success up to the failing node on FailChannelDisabled
champo Oct 24, 2021
6c9f640
docs+lncfg+sample-lnd.conf: add no-graph-cache option
guggero Oct 21, 2021
e8d3d61
lnd+channeldb: add graph cache option to channeldb
guggero Oct 21, 2021
22efc5a
channeldb: implement DB fallback for path finding
guggero Oct 21, 2021
e857d24
multi: use single read transaction for path finding
guggero Oct 21, 2021
ff4e075
routing: run path finding tests against cache and DB
guggero Oct 21, 2021
f21ff3e
itest: test path finding without cache
guggero Oct 21, 2021
0d3839f
sweep: add label to sweep transactions
bjarnemagnussen Oct 26, 2021
dde399c
config: fix reflection parsing in LiT
guggero Oct 21, 2021
39703b1
rpcperms: don't intercept if no middleware is registered
guggero Oct 21, 2021
f309f48
htlcswitch: remove 5 second timeout for data race unit tests
Crypt-iQ Oct 5, 2021
de80e5f
lnrpc/invoicesrpc: add new invoice ref LookupInvoiceV2 method
Roasbeef Sep 29, 2021
3059ad7
channeldb: add new AMPInvoiceState field to store AMP sub-invoice met…
Roasbeef Oct 14, 2021
8b3e5c7
channeldb: store AMP invoice htlc sets in new prefix key near invoice
Roasbeef Oct 14, 2021
5cbdba2
channeldb: don't cancel other HTLCs w/ diff setID once once is settled
Roasbeef Oct 14, 2021
efe3658
channeldb: for AMP don't update the main invoice state in updateInvoice
Roasbeef Oct 14, 2021
18bc1f6
channeldb: for AMP, store set ID w/ invoice num in settle index
Roasbeef Oct 14, 2021
ddc3892
channeldb: optimize updateInvoice for AMP by only reading relevant HTLCs
Roasbeef Oct 14, 2021
6755ee9
lnrpc/invoicesrpc: expose new lookup modifier to LookupInvoiceV2
Roasbeef Oct 14, 2021
93d647a
lnrpc: populate new AmpInvoiceState field in CreateRPCInvoice
Roasbeef Oct 14, 2021
8d5bbb8
channeldb: add new test to exercise cancellation of multiple AMP setIDs
Roasbeef Oct 14, 2021
c5de566
channeldb: add new TestSettleIndexAmpPayments test case
Roasbeef Oct 14, 2021
5d2b6f9
invoices: recognize AMP invoice settles during ntnf dispatch+catchup
Roasbeef Oct 14, 2021
f5973e7
invoices: update cancel logic for AMP invoices to be more efficient
Roasbeef Oct 14, 2021
a31f8ac
invoices: update testSpontaneousAmpPayment for new AMP logic
Roasbeef Oct 14, 2021
b3742d3
lntest: add new itest for repeated payments to the same AMP invoice
Roasbeef Oct 14, 2021
e8e7e3a
routerrpc: de-duplicate htlc held by interceptor
roeierez Sep 29, 2021
dd31d4d
itest: dedup interceptor packets
roeierez Oct 3, 2021
411b236
invoices: do not log when invoice is already deleted
bhandras Nov 1, 2021
bf31835
kvdb/postgres: convert all types of panic data to error
joostjager Sep 27, 2021
09b90a3
kvdb/postgres/test: single instance embedded postgres database
joostjager Sep 27, 2021
0b2e0b4
channeldb/test: test with postgres
joostjager Jul 16, 2021
cfd9e55
kvdb: add loggableKeyName method
halseth Oct 31, 2021
0451f26
kvdb/bolt_compact: filter out non-ASCII from bucket name before printing
halseth Oct 21, 2021
75caffb
docs: Added instructions on how to build proto definitions for Swift …
schjonhaug Oct 26, 2021
503a4b5
lnrpc: add public key detail to signrpc KeyDescriptor [skip ci]
blastshielddown Nov 1, 2021
72f5aed
itest: fix REST WebSocket ping/pong itest
guggero Oct 29, 2021
3aadba3
itest: wait for channel to be properly closed
guggero Oct 29, 2021
bbf0192
lntest: count unconfirmed balance as well
guggero Oct 29, 2021
7973fb0
channeldb: fix crash when inbound policy is unset
bhandras Nov 1, 2021
aef6c79
channeldb: add failing test to demonstrate panic w/o graph cache
Roasbeef Nov 3, 2021
dcd69f0
discovery: revamp premature update map
Roasbeef Oct 29, 2021
5b26d47
discovery: revamp recent rejects map
Roasbeef Nov 4, 2021
096acf8
channeldb: add new ForEachNode method using the channel graph cache
Roasbeef Oct 19, 2021
a165e1e
rpc: optimize GetNetworkInfo by using the channel graph cache
Roasbeef Oct 19, 2021
4814ae3
rpc: optimize DescribeGraph by caching the response
Roasbeef Oct 19, 2021
6f84e71
server: cleanup persistentPeerAddr when pruned
ellemouton Nov 3, 2021
6e28b9b
server: use one func for peer re-connection
ellemouton Nov 3, 2021
ded87f4
server: stagger multi addr connection attempts
ellemouton Nov 3, 2021
7abf3ec
server: defer ticker stop to avoid goroutine leak
Roasbeef Nov 5, 2021
37944de
lnd: simplify listener creation
guggero Nov 4, 2021
97d316b
config_builder: always send admin mac on chan
guggero Nov 4, 2021
1d3d3a9
channeldb: avoid locking the graph cache while iterating channels
bhandras Nov 6, 2021
231d6fe
lnrpc+rpcperms+lntest: add unique MW message ID
guggero Nov 8, 2021
2a44a4a
rpcperms: add unique request ID
guggero Nov 8, 2021
3dfaea4
lnd: standardize printing to stdout
guggero Nov 8, 2021
da10092
lnd: make sure error is logged to file
guggero Nov 8, 2021
b650895
multi: run go fmt with go 1.17
guggero Nov 8, 2021
0c0c7ad
config: move directory creation to after path fixes
guggero Nov 8, 2021
d657917
cmd/lncli: fix nil map in payment req [skip ci]
guggero Nov 16, 2021
8b2d39b
cmd/lncli: remove --amp-reuse flag from lncli payinvoice
Roasbeef Nov 17, 2021
b6d1d88
postgres: add connection limit
joostjager Nov 17, 2021
da3d34b
multi: Lint fixes
matheusd Jan 30, 2024
851c79f
kvdb/bolt_compact: have log message take account space multiplier
jyturley Nov 10, 2021
bc128dc
channeldb: check fetchOpenChannel() error
nayuta-ueno Nov 23, 2021
6cb22fc
tor+healthcheck: fix healthcheck for multiple services
guggero Nov 23, 2021
eb8dec9
htlcswitch: fix hint in link tests [skip ci]
greywolve Nov 23, 2021
b6e3cc6
feature: if a bit is unset, then all other features that dep it shoul…
Roasbeef Nov 19, 2021
48955d2
contractcourt: only supplement resolvers if channel has historical state
Roasbeef Nov 18, 2021
f9e5647
funding: don't negotiate on known types
guggero Nov 24, 2021
1501355
funding: don't fail flow on channel type
guggero Nov 24, 2021
b668572
funding: ensure a local funding w/ explicit type can't be downgraded
Roasbeef Nov 24, 2021
70ec5df
docs+Makefile: remove goveralls
guggero Nov 29, 2021
a511250
mod+tools+Makefile: use go install to fetch dependencies
guggero Nov 29, 2021
a2bfe41
multi: Remove GO111MODULE env variable in Makefile
naveensrinivasan Oct 1, 2021
bfacfd3
etcd: make max message size configurable
bhandras Dec 2, 2021
e2a5b72
routerrpc: fix wrong error messages
sputn1ck Dec 8, 2021
4bbb90d
chainfee: handle conf target not found in cache
yyforyongyu Dec 7, 2021
41d361a
chainfee: update test TestWebAPIFeeEstimator
yyforyongyu Dec 7, 2021
713338d
routing: fix memory corruption in MC store
bhandras Dec 7, 2021
5e9144e
lncli: Add json flag to trackpayment [skip ci]
mattbajorek Dec 6, 2021
eb49753
lnwallet: don't enforce new reserved value in PSBT midstep
Kixunil Jul 17, 2021
8902ba7
test: don't enforce reserved value in PSBT midstep
Kixunil Aug 11, 2021
d1c28df
lnrpc: refactor populating lnrpc.Transaction inside SubscribeTransaction
bjarnemagnussen Oct 14, 2021
5b0ca60
lnwallet+docs: minrelayfee always above fee floor
ellemouton Dec 10, 2021
212b805
netann: clarify invalid config timeout constraints [skip ci]
mattbajorek Dec 9, 2021
1655e5f
funding: always send a channel type in explicit mode
Roasbeef Dec 10, 2021
d775a0d
multi: enhance logging for debugging peer connection
yyforyongyu Dec 12, 2021
cd50f2b
server: fix peers not ignored during bootstrapping
yyforyongyu Dec 12, 2021
47a1f04
rpcserver: expose ChanStatusFlags in pending close
yyforyongyu Nov 13, 2021
cb9bf02
kvdb/postgres: fix tests
joostjager Dec 20, 2021
59ee669
kvdb/postgres: fix context cancellation
joostjager Dec 22, 2021
7f13678
itest: increase pg database connection limit
joostjager Dec 27, 2021
cfb7697
discovery: add verbose network messages related logs
yyforyongyu Dec 13, 2021
b5c19c6
chainntnfs: add more verbose logs for txnotifier
yyforyongyu Dec 13, 2021
968ae9c
funding: add String method for channelOpeningState
yyforyongyu Dec 13, 2021
c6be5de
funding: add explicit log to avoid confusion
yyforyongyu Dec 13, 2021
2c89771
discovery: shorten mutex locking closure
yyforyongyu Dec 13, 2021
2416775
discovery: transit all inactive syncers when needed
yyforyongyu Nov 26, 2021
3593071
routing+discovery: uniform error codes in routing
yyforyongyu Dec 13, 2021
e560cce
discovery: sync blocks in a dedicated goroutine
yyforyongyu Dec 13, 2021
aad6bcc
discovery: resend premature messages when new blocks arrive
yyforyongyu Dec 3, 2021
efd400d
discovery: use source instead of peer for accurate rejectCache
Crypt-iQ Nov 24, 2021
2c309a1
itest: add test_common to hold commonly used methods
yyforyongyu Sep 14, 2021
caae4e6
itest: add run context to harness node
yyforyongyu Sep 18, 2021
98d32a3
itest: use ProcessState and runCtx to control process quit
yyforyongyu Sep 18, 2021
f835449
itest: manage context within HarnessNode
yyforyongyu Sep 14, 2021
01b5b93
itest: rename harness net file and add run context
yyforyongyu Sep 14, 2021
1983446
itest: use run context when making rpc requests
yyforyongyu Sep 14, 2021
c2f13b0
itest: replace fakeLogger with v2 logger with Discard
yyforyongyu Sep 15, 2021
33ebc6e
makefile: add itest-clean to kill uncleaned processes
yyforyongyu Nov 10, 2021
ad1383a
itest: shorten functions inside harness node
yyforyongyu Sep 18, 2021
6e98152
itest: use node.rpc namespace inside harness net
yyforyongyu Sep 18, 2021
3e88207
itest: add method waitTillServerState in harness node
yyforyongyu Sep 18, 2021
394eb1e
itest: refactor initClientWhenReady to clean up init node
yyforyongyu Sep 18, 2021
6c325a4
itest: introduce harness miner
yyforyongyu Sep 18, 2021
6d60990
itest: start using harness miner in harness net
yyforyongyu Sep 18, 2021
641e1de
itest: fix RPC middleware itest
guggero Jan 5, 2022
2a8ef65
itest: Misc context fixes
matheusd Jan 30, 2024
c62a9fa
lntest: fix colliding variable name
guggero Jan 6, 2022
1f91745
lntest: export ListenerFormat constant
guggero Jan 6, 2022
c4659db
lntest: export base node config for re-use
guggero Jan 6, 2022
fc217e9
multi: fix formatting
guggero Jan 5, 2022
4df2bb9
signrpc: remove incomplete sentence and TODO
guggero Jan 5, 2022
f4ffbe5
lnwallet+lntest+mod: bump btcwallet to export ScriptForOutput
guggero Jan 5, 2022
e8dc300
lnwallet: add derivation and prev TX to UTXO
guggero Jan 5, 2022
95818b9
btcwallet: add SignPsbt
guggero Jan 5, 2022
9aad695
walletrpc+itest: add SignPsbt RPC
guggero Jan 5, 2022
63c2a8a
multi: add nochainbackend option
guggero Jan 5, 2022
aee88a3
htlcswitch: fix duplicate close
joostjager Jan 6, 2022
2e3f091
rpcserver: split PendingChannels into three sections
yyforyongyu Jan 7, 2022
778366f
rpcserver: add closing txid in WaitingCloseChannel
yyforyongyu Jan 7, 2022
30de199
peer: always defer clean up of the block epoch client used for ping h…
Roasbeef Jan 6, 2022
abe98e7
lnwire+peer: clamp pong bytes, make ping handler more effcieint
Roasbeef Jan 11, 2022
aaf1501
contractcourt: catch error when no historical bucket exists
Roasbeef Jan 13, 2022
2b25b10
routing: add option to force import MC pair history
bhandras Jan 19, 2022
5273f85
lncli: add force flag to
bhandras Jan 19, 2022
6da03f3
kvdb/postgres: use readonly db transaction if possible
joostjager Dec 23, 2021
34c0716
routing: remove unused ForEachChannel
joostjager Dec 26, 2021
3566811
kvdb: add ForAll
joostjager Dec 24, 2021
7d1a7fb
channeldb: extract AddNodeFeatures
joostjager Dec 24, 2021
9b4d0b5
channeldb: extract deserializeChanEdgePolicyRaw
joostjager Dec 24, 2021
39037f4
channeldb: optimize ForEachChannel
joostjager Jan 14, 2022
1e2985a
channeldb: reallocate node in ForEachNodeCacheable
joostjager Jan 14, 2022
3a73939
channeldb: speed up graph cache loading
joostjager Dec 23, 2021
da168b4
macaroons: add GetCustomCaveatCondition func
sangaman Jan 20, 2022
6a1b42a
rpcperms: set CustomCaveatCondition on middleware req
sangaman Jan 21, 2022
ee05570
server+contractcourt: add breachResolver that subscribes to breacharb…
Crypt-iQ Jan 13, 2022
c1d9cd4
contractcourt: handle writing BreachResolution in arbitrator log
Crypt-iQ Jan 13, 2022
3b28a81
contractcourt: create breachResolver if BreachResolution present
Crypt-iQ Jan 13, 2022
3ce3c7e
server+contractcourt: hand-off BreachCloseInfo to channel arbitrator
Crypt-iQ Jan 13, 2022
8ccd3a7
lnrpc: fix the existing routing fee inaccuracy
ErikEk Sep 11, 2021
32c12c1
itest: add test for the channel policy fee rate round down bug
bhandras Jan 25, 2022
65be514
lnwallet: introduce default routing fee calculation
guggero Feb 2, 2022
66f91a5
lnrpc: use amount based default routing fee
guggero Feb 2, 2022
0a6342a
lncli: use amount based default routing fee
guggero Feb 2, 2022
27db545
lnwallet: increase legacy fee limit threshold to 1k sats
Roasbeef Feb 3, 2022
27ffb7c
invoicesrpc: add HopHintInfo decoupling hop hint from channel internals
carlaKC Jan 27, 2022
3e1307b
invoicesrpc: pass in specialized config for select hop hints
carlaKC Jan 27, 2022
d491710
invoicerpc: return hop hints from select hop hint rather than functions
carlaKC Jan 27, 2022
52b226f
invoicerpc: move hop hint to constant and add tests to select hop hint
carlaKC Jan 27, 2022
2b4a437
invoices: fix deadlock in invoice registry
bhandras Mar 11, 2022
263bde9
lnwire: add length validation in NewSigFromRawSignature
yyforyongyu Mar 8, 2022
d73cb6d
netann: create testSigBytes for unit test
yyforyongyu Mar 8, 2022
2bccab1
lnrpc: add new locked balance field for WalletBalance
Roasbeef Feb 18, 2022
561efe1
sweep: remove all unconfirmed descendant transactions when a sweep co…
Roasbeef Feb 18, 2022
e0a7710
lntest/itest: add new itest for 3rd party anchor spends
Roasbeef Mar 4, 2022
e9f45fa
cluster: configurable session TTL for the leader elector
bhandras Mar 16, 2022
1feeee5
config: update sample-lnd.conf
bhandras Mar 22, 2022
f3fab58
itest: make use of session ttl in failover test
bhandras Mar 17, 2022
315fa94
lnd: disable REST proxy HTTP method fallback
guggero Mar 23, 2022
3846080
walletrpc: add debug log statement for invalid PSBT
guggero Mar 16, 2022
bc5bc56
hdkeychain: Test pubkeys of every family when deriving privkey
matheusd Feb 1, 2024
2a7d763
itest: add new test for SignOutputRaw RPC
guggero Mar 16, 2022
c65fddf
lntest+lnwallet: add AddressInfo to WalletController
guggero Mar 16, 2022
8ebb3cc
multi: fix rebase issues, update release notes
Roasbeef Mar 25, 2022
3c2f423
[skip-ci] payments-expiration-grace-period needs time unit
BhaagBoseDK Oct 24, 2021
ed25ee1
lnrpc: ignore legacy onion payload as an option for SendToRoute
Roasbeef Mar 31, 2022
d3cd36e
routing: fail in-flight attempts cleanly on terminal payment failure
bhandras Mar 21, 2022
a61b10a
psbt: Lint fixes
matheusd Feb 1, 2024
7dcd03e
breacharbiter: Wait for all spend events before recreating justice tx
matheusd Feb 1, 2024
6c5ca2a
chainntfs: Save second miner log
matheusd Feb 5, 2024
1b997a6
itest: Fix flake in local timeout test
matheusd Feb 9, 2024
65bcab6
chainntfns: Prevent double sending of Update ntfns
matheusd Feb 12, 2024
08fa708
testutils: Add timeout to rpctest setup
matheusd Feb 12, 2024
84aa17c
itest: Fix flake on testWipeForwardingPackages
matheusd Feb 12, 2024
f910e8d
docs: Update upstream-prs.csv file
matheusd Feb 13, 2024
4dc105e
build: Bump minor version to v0.6.0
matheusd Feb 13, 2024
e958fc3
docs: Add release notes for v0.6.0
matheusd Feb 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ run:
deadline: 10m

linters:
skip-files: "mobile\\/.*generated\\.go"
# Skip autogenerated files for mobile and gRPC.
skip-files:
- "mobile\\/.*generated\\.go"
- "\\.pb\\.go$"
- "\\.pb\\.gw\\.go$"

disable-all: true
enable:
Expand Down
111 changes: 60 additions & 51 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@ ESCPKG := github.com\/decred\/dcrlnd

DCRD_PKG := github.com/decred/dcrd
DCRWALLET_PKG := github.com/decred/dcrwallet
GOVERALLS_PKG := github.com/mattn/goveralls
LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
GOACC_PKG := github.com/ory/go-acc
FALAFEL_PKG := github.com/lightninglabs/falafel
GOIMPORTS_PKG := golang.org/x/tools/cmd/goimports
GOFUZZ_BUILD_PKG := github.com/dvyukov/go-fuzz/go-fuzz-build
GOFUZZ_PKG := github.com/dvyukov/go-fuzz/go-fuzz
GOFUZZ_DEP_PKG := github.com/dvyukov/go-fuzz/go-fuzz-dep

GO_BIN := ${GOPATH}/bin
DCRD_BIN := $(GO_BIN)/dcrd
GOMOBILE_BIN := GO111MODULE=off $(GO_BIN)/gomobile
GOVERALLS_BIN := $(GO_BIN)/goveralls
LINT_BIN := $(GO_BIN)/golangci-lint
GOACC_BIN := $(GO_BIN)/go-acc
GOFUZZ_BUILD_BIN := $(GO_BIN)/go-fuzz-build
GOFUZZ_BIN := $(GO_BIN)/go-fuzz

MOBILE_BUILD_DIR :=${GOPATH}/src/$(MOBILE_PKG)/build
IOS_BUILD_DIR := $(MOBILE_BUILD_DIR)/ios
IOS_BUILD := $(IOS_BUILD_DIR)/Lndmobile.framework
IOS_BUILD := $(IOS_BUILD_DIR)/Lndmobile.xcframework
ANDROID_BUILD_DIR := $(MOBILE_BUILD_DIR)/android
ANDROID_BUILD := $(ANDROID_BUILD_DIR)/Lndmobile.aar

Expand Down Expand Up @@ -50,15 +49,14 @@ DCRWALLET_TMPDIR := $(shell mktemp -d)
GOACC_COMMIT := 80342ae2e0fcf265e99e76bcc4efd022c7c3811b
LINT_COMMIT := v1.18.0
FALAFEL_COMMIT := v0.7.1
GOFUZZ_COMMIT := 21309f307f61
GOFUZZ_COMMIT := b1f3d6f

DEPGET := cd /tmp && GO111MODULE=on go get -v
GOBUILD := CGO_ENABLED=0 GO111MODULE=on go build -v
GOINSTALL := CGO_ENABLED=0 GO111MODULE=on go install -v
GOTEST := GO111MODULE=on go test -v
GOBUILD := go build -v
GOINSTALL := go install -v
GOTEST := go test

GOVERSION := $(shell go version | awk '{print $$3}')
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -name "*pb.go" -not -name "*pb.gw.go")
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -name "*pb.go" -not -name "*pb.gw.go" -not -name "*.pb.json.go")

TESTBINPKG := dcrlnd_testbins.tar.gz

Expand All @@ -72,17 +70,7 @@ include make/fuzz_flags.mk

DEV_TAGS := $(if ${tags},$(DEV_TAGS) ${tags},$(DEV_TAGS))

LINT = $(LINT_BIN) \
run \
--skip-files="mobile\\/.*generated\\.go" \
--disable-all \
--enable=gofmt \
--enable=vet \
--enable=gosimple \
--enable=unconvert \
--enable=ineffassign \
--enable=unused \
--deadline=10m
LINT = $(LINT_BIN) run

GREEN := "\\033[0;32m"
NC := "\\033[0m"
Expand All @@ -97,18 +85,13 @@ all: scratch check install
# ============
# DEPENDENCIES
# ============

$(GOVERALLS_BIN):
@$(call print, "Fetching goveralls.")
go get -u $(GOVERALLS_PKG)

$(LINT_BIN):
@$(call print, "Fetching linter")
$(DEPGET) $(LINT_PKG)@$(LINT_COMMIT)
@$(call print, "Installing linter.")
go install $(LINT_PKG)

$(GOACC_BIN):
@$(call print, "Fetching go-acc")
$(DEPGET) $(GOACC_PKG)@$(GOACC_COMMIT)
@$(call print, "Installing go-acc.")
go install $(GOACC_PKG)

dcrd:
@$(call print, "Installing dcrd $(DCRD_COMMIT).")
Expand All @@ -132,29 +115,40 @@ falafel:

goimports:
@$(call print, "Installing goimports.")
$(DEPGET) $(GOIMPORTS_PKG)
go install $(GOIMPORTS_PKG)

$(GOFUZZ_BIN):
@$(call print, "Fetching go-fuzz")
$(DEPGET) $(GOFUZZ_PKG)@$(GOFUZZ_COMMIT)
@$(call print, "Installing go-fuzz.")
go install $(GOFUZZ_PKG)

$(GOFUZZ_BUILD_BIN):
@$(call print, "Fetching go-fuzz-build")
$(DEPGET) $(GOFUZZ_BUILD_PKG)@$(GOFUZZ_COMMIT)
@$(call print, "Installing go-fuzz-build.")
go install $(GOFUZZ_BUILD_PKG)

$(GOFUZZ_DEP_BIN):
@$(call print, "Installing go-fuzz-dep.")
go install $(GOFUZZ_DEP_PKG)

# ============
# INSTALLATION
# ============

build:
@$(call print, "Building debug dcrlnd and dcrlncli.")
$(GOBUILD) -tags="$(DEV_TAGS)" -o dcrlnd-debug $(LDFLAGS) $(PKG)/cmd/dcrlnd
$(GOBUILD) -tags="$(DEV_TAGS)" -o dcrlncli-debug $(LDFLAGS) $(PKG)/cmd/dcrlncli
CGO_ENABLED=0 $(GOBUILD) -tags="$(DEV_TAGS)" -o dcrlnd-debug $(LDFLAGS) $(PKG)/cmd/dcrlnd
CGO_ENABLED=0 $(GOBUILD) -tags="$(DEV_TAGS)" -o dcrlncli-debug $(LDFLAGS) $(PKG)/cmd/dcrlncli

build-itest:
@$(call print, "Building itest dcrlnd and dcrlncli.")
$(GOBUILD) -tags="$(ITEST_TAGS)" -o dcrlnd-itest$(EXEC_SUFFIX) $(ITEST_LDFLAGS) $(PKG)/cmd/dcrlnd
$(GOBUILD) -tags="$(ITEST_TAGS)" -o dcrlncli-itest$(EXEC_SUFFIX) $(ITEST_LDFLAGS) $(PKG)/cmd/dcrlncli
CGO_ENABLED=0 $(GOBUILD) -tags="$(ITEST_TAGS)" -o dcrlnd-itest$(EXEC_SUFFIX) $(ITEST_LDFLAGS) $(PKG)/cmd/dcrlnd
CGO_ENABLED=0 $(GOBUILD) -tags="$(ITEST_TAGS)" -o dcrlncli-itest$(EXEC_SUFFIX) $(ITEST_LDFLAGS) $(PKG)/cmd/dcrlncli

build-itest-race:
@$(call print, "Building itest with race detector.")
CGO_ENABLED=1 $(GOBUILD) -race -tags="$(ITEST_TAGS)" -o lntest/itest/lnd-itest$(EXEC_SUFFIX) $(ITEST_LDFLAGS) $(PKG)/cmd/dcrlnd

@$(call print, "Building itest binary for ${backend} backend.")
CGO_ENABLED=0 $(GOTEST) -v ./lntest/itest -tags="$(DEV_TAGS) $(RPC_TAGS) rpctest $(backend)" -c -o lntest/itest/itest.test$(EXEC_SUFFIX)

install:
@$(call print, "Installing dcrlnd and dcrlncli.")
Expand All @@ -180,7 +174,23 @@ scratch: build

check: unit itest

itest-only:
db-instance:
ifeq ($(dbbackend),postgres)
# Remove a previous postgres instance if it exists.
docker rm lnd-postgres --force || echo "Starting new postgres container"

# Start a fresh postgres instance. Allow a maximum of 500 connections so
# that multiple lnd instances with a maximum number of connections of 50
# each can run concurrently.
docker run --name lnd-postgres -e POSTGRES_PASSWORD=postgres -p 6432:5432 -d postgres:13-alpine -N 500
docker logs -f lnd-postgres &

# Wait for the instance to be started.
sleep $(POSTGRES_START_DELAY)
endif


itest-only: db-instance
@$(call print, "Building itest binary for $(backend) backend")
CGO_ENABLED=0 $(GOTEST) -v ./lntest/itest -tags="$(DEV_TAGS) $(RPC_TAGS) rpctest $(backend)" -c -o lntest/itest/itest.test

Expand All @@ -199,7 +209,14 @@ itest-parallel-run:
rm -rf lntest/itest/*.log lntest/itest/.logs-*
EXEC_SUFFIX=$(EXEC_SUFFIX) echo "$$(seq 0 $$(expr $(ITEST_PARALLELISM) - 1))" | xargs -P $(ITEST_PARALLELISM) -n 1 -I {} scripts/itest_part.sh {} $(NUM_ITEST_TRANCHES) $(TEST_FLAGS) $(ITEST_FLAGS)

itest-parallel: dcrd dcrwallet build-itest itest-parallel-run

itest-race: build-itest-race itest-only

itest-parallel: dcrd dcrwallet db-instance build-itest itest-parallel-run

itest-clean:
@$(call print, "Cleaning old itest processes")
killall dcrlnd-itest || echo "no running dcrlnd-itest process found";

unit-only:
@$(call print, "Running unit tests.")
Expand All @@ -220,14 +237,8 @@ unit-race:
@$(call print, "Running unit race tests.")
$(UNIT_RACE)

goveralls: $(GOVERALLS_BIN)
@$(call print, "Sending coverage report.")
$(GOVERALLS_BIN) -coverprofile=coverage.txt -service=travis-ci

ci-race: dcrd dcrwallet unit-race

travis-cover: dcrd dcrwallet unit-cover goveralls

ci-itest: itest

package-test-binaries: dcrd dcrwallet build-itest
Expand Down Expand Up @@ -260,7 +271,7 @@ flakehunter-parallel:
# =============
# FUZZING
# =============
fuzz-build: $(GOFUZZ_BUILD_BIN)
fuzz-build: $(GOFUZZ_BUILD_BIN) $(GOFUZZ_DEP_BIN)
@$(call print, "Creating fuzz harnesses for packages '$(FUZZPKG)'.")
scripts/fuzz.sh build "$(FUZZPKG)"

Expand Down Expand Up @@ -299,7 +310,7 @@ rpc-format:

rpc-check: rpc
@$(call print, "Verifying protos.")
for rpc in $$(find lnrpc/ -name "*.proto" | $(XARGS) awk '/ rpc /{print $$2}'); do if ! grep -q $$rpc lnrpc/rest-annotations.yaml; then echo "RPC $$rpc not added to lnrpc/rest-annotations.yaml"; exit 1; fi; done
cd ./lnrpc; ../scripts/check-rest-annotations.sh
if test -n "$$(git describe --dirty | grep dirty)"; then echo "Protos not properly formatted or not compiled with v3.4.0"; git status; git diff; exit 1; fi

sample-conf-check:
Expand All @@ -312,7 +323,7 @@ mobile-rpc:

vendor:
@$(call print, "Re-creating vendor directory.")
rm -r vendor/; GO111MODULE=on go mod vendor
rm -r vendor/; go mod vendor

ios: vendor mobile-rpc
@$(call print, "Building iOS framework ($(IOS_BUILD)).")
Expand Down Expand Up @@ -350,9 +361,7 @@ clean-mobile:
unit-cover \
unit-race \
falafel \
goveralls \
ci-race \
travis-cover \
ci-itest \
flakehunter \
flake-unit \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ as well as compatible versions of `dcrd` and `dcrwallet`.
## Safety

When operating a mainnet `dcrlnd` node, please refer to our [operational safety
guildelines](docs/safety.md). It is important to note that `dcrlnd` is still
guidelines](docs/safety.md). It is important to note that `dcrlnd` is still
**beta** software and that ignoring these operational guidelines can lead to
loss of funds.

Expand Down
4 changes: 2 additions & 2 deletions automation/automation.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ func (s *Server) runForceCloseStaleChanReestablish() {
log.Debugf("Time to check channels for force close due to stale " +
"chan reestablish messages")

chans, err := s.cfg.DB.FetchAllOpenChannels()
chans, err := s.cfg.DB.ChannelStateDB().FetchAllOpenChannels()
if err != nil {
log.Errorf("Unable to list open channels: %v", err)
continue
}

for _, c := range chans {
sid := c.ShortChannelID
waitTime, err := s.cfg.DB.GetChanReestablishWaitTime(sid)
waitTime, err := s.cfg.DB.ChannelStateDB().GetChanReestablishWaitTime(sid)
if err != nil {
log.Errorf("Unable to get chan reestablish msg "+
"times for %s: %v", sid, err)
Expand Down
2 changes: 1 addition & 1 deletion autopilot/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (d *databaseChannelGraph) addRandChannel(node1, node2 *secp256k1.PublicKey,
return nil, err
}

dbNode, err := d.db.FetchLightningNode(nil, vertex)
dbNode, err := d.db.FetchLightningNode(vertex)
switch {
case err == channeldb.ErrGraphNodeNotFound:
fallthrough
Expand Down
66 changes: 66 additions & 0 deletions brontide/bench_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package brontide

import (
"bytes"
"math"
"math/rand"
"testing"
"time"

"github.com/stretchr/testify/require"
)

func BenchmarkReadHeaderAndBody(t *testing.B) {
// Create a test connection, grabbing either side of the connection
// into local variables. If the initial crypto handshake fails, then
// we'll get a non-nil error here.
localConn, remoteConn, cleanUp, err := establishTestConnection()
require.NoError(t, err, "unable to establish test connection: %v", err)
defer cleanUp()

rand.Seed(time.Now().Unix())

noiseRemoteConn := remoteConn.(*Conn)
noiseLocalConn := localConn.(*Conn)

// Now that we have a local and remote side (to set up the initial
// handshake state, we'll have the remote side write out something
// similar to a large message in the protocol.
const pktSize = 60_000
msg := bytes.Repeat([]byte("a"), pktSize)
err = noiseRemoteConn.WriteMessage(msg)
require.NoError(t, err, "unable to write encrypted message: %v", err)

cipherHeader := noiseRemoteConn.noise.nextHeaderSend
cipherMsg := noiseRemoteConn.noise.nextBodySend

var (
benchErr error
msgBuf [math.MaxUint16]byte
)

t.ReportAllocs()
t.ResetTimer()

nonceValue := noiseLocalConn.noise.recvCipher.nonce
for i := 0; i < t.N; i++ {
pktLen, benchErr := noiseLocalConn.noise.ReadHeader(
bytes.NewReader(cipherHeader),
)
require.NoError(
t, benchErr, "#%v: failed decryption: %v", i, benchErr,
)
_, benchErr = noiseLocalConn.noise.ReadBody(
bytes.NewReader(cipherMsg), msgBuf[:pktLen],
)
require.NoError(
t, benchErr, "#%v: failed decryption: %v", i, benchErr,
)

// We reset the internal nonce each time as otherwise, we'd
// continue to increment it which would cause a decryption
// failure.
noiseLocalConn.noise.recvCipher.nonce = nonceValue
}
require.NoError(t, benchErr)
}
16 changes: 11 additions & 5 deletions brontide/noise.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,11 @@ func (b *Machine) ReadHeader(r io.Reader) (uint32, error) {
}

// Attempt to decrypt+auth the packet length present in the stream.
//
// By passing in `nextCipherHeader` as the destination, we avoid making
// the library allocate a new buffer to decode the plaintext.
pktLenBytes, err := b.recvCipher.Decrypt(
nil, nil, b.nextCipherHeader[:],
nil, b.nextCipherHeader[:0], b.nextCipherHeader[:],
)
if err != nil {
return 0, err
Expand All @@ -882,10 +885,13 @@ func (b *Machine) ReadBody(r io.Reader, buf []byte) ([]byte, error) {
return nil, err
}

// Finally, decrypt the message held in the buffer, and return a
// new byte slice containing the plaintext.
// TODO(roasbeef): modify to let pass in slice
return b.recvCipher.Decrypt(nil, nil, buf)
// Finally, decrypt the message held in the buffer, and return a new
// byte slice containing the plaintext.
//
// By passing in the buf (the ciphertext) as the first argument, we end
// up re-using it as we don't force the library to allocate a new
// buffer to decode the plaintext.
return b.recvCipher.Decrypt(nil, buf[:0], buf)
}

// SetCurveToNil sets the 'Curve' parameter to nil on the handshakeState keys.
Expand Down
Loading
Loading