Skip to content

Commit 34d21dc

Browse files
authored
Merge branch 'lightningdevkit:main' into main
2 parents 4364e18 + 12d799e commit 34d21dc

File tree

35 files changed

+667
-554
lines changed

35 files changed

+667
-554
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ jobs:
8686
run: cargo update -p tokio --precise "1.14.0" --verbose
8787
env:
8888
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
89+
- name: Pin tokio to 1.26 for Windows
90+
if: "matrix.platform == 'windows-latest'"
91+
run: cargo update -p tokio --precise "1.26.0" --verbose
92+
env:
93+
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
8994
- name: Build on Rust ${{ matrix.toolchain }} with net-tokio
9095
if: "matrix.build-net-tokio && !matrix.coverage"
9196
run: cargo build --verbose --color always
@@ -127,18 +132,21 @@ jobs:
127132
cd lightning-transaction-sync
128133
cargo build --verbose --color always --features esplora-blocking
129134
cargo build --verbose --color always --features esplora-async
135+
cargo build --verbose --color always --features esplora-async-https
130136
- name: Build transaction sync clients on Rust ${{ matrix.toolchain }} with features and full code-linking for coverage generation
131137
if: "matrix.build-tx-sync && matrix.coverage"
132138
run: |
133139
cd lightning-transaction-sync
134140
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-blocking
135141
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async
142+
RUSTFLAGS="-C link-dead-code" cargo build --verbose --color always --features esplora-async-https
136143
- name: Test transaction sync clients on Rust ${{ matrix.toolchain }} with features
137144
if: "matrix.build-tx-sync"
138145
run: |
139146
cd lightning-transaction-sync
140147
cargo test --verbose --color always --features esplora-blocking
141148
cargo test --verbose --color always --features esplora-async
149+
cargo test --verbose --color always --features esplora-async-https
142150
- name: Test backtrace-debug builds on Rust ${{ matrix.toolchain }}
143151
if: "matrix.toolchain == 'stable'"
144152
shell: bash # Default on Winblows is powershell

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
missing support for blinded path payments (#1927, #1908, #1926).
2323
* A `lightning-custom-message` crate has been added to make combining multiple
2424
custom messages into one enum/handler easier (#1832).
25-
* `Event::PaymentPathFailure` is now generated for failure to send an HTLC
25+
* `Event::PaymentPathFailed` is now generated for failure to send an HTLC
2626
over the first hop on our local channel (#2014, #2043).
2727
* `lightning-net-tokio` no longer requires an `Arc` on `PeerManager` (#1968).
2828
* `ChannelManager::list_recent_payments` was added (#1873).
@@ -40,7 +40,7 @@
4040
if you downgrade prior to receipt (#1878).
4141
* `Event::PaymentPathFailed::network_update` will always be `None` if an
4242
0.0.114-generated event is read by a prior version of LDK (#2043).
43-
* `Event::PaymentPathFailed::all_paths_removed` will always be false if an
43+
* `Event::PaymentPathFailed::all_paths_failed` will always be false if an
4444
0.0.114-generated event is read by a prior version of LDK. Users who rely on
4545
it to determine payment retries should migrate to `Event::PaymentFailed`, in
4646
a separate release prior to upgrading to LDK 0.0.114 if downgrading is

fuzz/src/router.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
268268
inbound_htlc_minimum_msat: None,
269269
inbound_htlc_maximum_msat: None,
270270
config: None,
271+
feerate_sat_per_1000_weight: None,
271272
});
272273
}
273274
Some(&first_hops_vec[..])

lightning-background-processor/src/lib.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,9 @@ macro_rules! define_run_body {
349349
log_error!($logger, "Error: Failed to persist network graph, check your disk and permissions {}", e)
350350
}
351351

352-
last_prune_call = $get_timer(NETWORK_PRUNE_TIMER);
353352
have_pruned = true;
354353
}
354+
last_prune_call = $get_timer(NETWORK_PRUNE_TIMER);
355355
}
356356

357357
if $timer_elapsed(&mut last_scorer_persist_call, SCORER_PERSIST_TIMER) {
@@ -757,7 +757,7 @@ mod tests {
757757

758758
impl Persister {
759759
fn new(data_dir: String) -> Self {
760-
let filesystem_persister = FilesystemPersister::new(data_dir.clone());
760+
let filesystem_persister = FilesystemPersister::new(data_dir);
761761
Self { graph_error: None, graph_persistence_notifier: None, manager_error: None, scorer_error: None, filesystem_persister }
762762
}
763763

@@ -824,7 +824,7 @@ mod tests {
824824
}
825825

826826
fn expect(&mut self, expectation: TestResult) {
827-
self.event_expectations.get_or_insert_with(|| VecDeque::new()).push_back(expectation);
827+
self.event_expectations.get_or_insert_with(VecDeque::new).push_back(expectation);
828828
}
829829
}
830830

@@ -1226,7 +1226,7 @@ mod tests {
12261226
// Set up a background event handler for SpendableOutputs events.
12271227
let (sender, receiver) = std::sync::mpsc::sync_channel(1);
12281228
let event_handler = move |event: Event| match event {
1229-
Event::SpendableOutputs { .. } => sender.send(event.clone()).unwrap(),
1229+
Event::SpendableOutputs { .. } => sender.send(event).unwrap(),
12301230
Event::ChannelReady { .. } => {},
12311231
Event::ChannelClosed { .. } => {},
12321232
_ => panic!("Unexpected event: {:?}", event),
@@ -1274,7 +1274,7 @@ mod tests {
12741274
let nodes = create_nodes(2, "test_not_pruning_network_graph_until_graph_sync_completion".to_string());
12751275
let data_dir = nodes[0].persister.get_data_dir();
12761276
let (sender, receiver) = std::sync::mpsc::sync_channel(1);
1277-
let persister = Arc::new(Persister::new(data_dir.clone()).with_graph_persistence_notifier(sender));
1277+
let persister = Arc::new(Persister::new(data_dir).with_graph_persistence_notifier(sender));
12781278
let network_graph = nodes[0].network_graph.clone();
12791279
let features = ChannelFeatures::empty();
12801280
network_graph.add_channel_from_partial_announcement(42, 53, features, nodes[0].node.get_our_node_id(), nodes[1].node.get_our_node_id())
@@ -1317,7 +1317,7 @@ mod tests {
13171317
// this should have added two channels
13181318
assert_eq!(network_graph.read_only().channels().len(), 3);
13191319

1320-
let _ = receiver
1320+
receiver
13211321
.recv_timeout(Duration::from_secs(super::FIRST_NETWORK_PRUNE_TIMER * 5))
13221322
.expect("Network graph not pruned within deadline");
13231323

@@ -1344,7 +1344,7 @@ mod tests {
13441344

13451345
let nodes = create_nodes(1, "test_payment_path_scoring".to_string());
13461346
let data_dir = nodes[0].persister.get_data_dir();
1347-
let persister = Arc::new(Persister::new(data_dir.clone()));
1347+
let persister = Arc::new(Persister::new(data_dir));
13481348
let bg_processor = BackgroundProcessor::start(persister, event_handler, nodes[0].chain_monitor.clone(), nodes[0].node.clone(), nodes[0].no_gossip_sync(), nodes[0].peer_manager.clone(), nodes[0].logger.clone(), Some(nodes[0].scorer.clone()));
13491349

13501350
let scored_scid = 4242;
@@ -1369,7 +1369,6 @@ mod tests {
13691369
failure: PathFailure::OnPath { network_update: None },
13701370
path: path.clone(),
13711371
short_channel_id: Some(scored_scid),
1372-
retry: None,
13731372
});
13741373
let event = receiver
13751374
.recv_timeout(Duration::from_secs(EVENT_DEADLINE))
@@ -1389,7 +1388,6 @@ mod tests {
13891388
failure: PathFailure::OnPath { network_update: None },
13901389
path: path.clone(),
13911390
short_channel_id: None,
1392-
retry: None,
13931391
});
13941392
let event = receiver
13951393
.recv_timeout(Duration::from_secs(EVENT_DEADLINE))
@@ -1431,7 +1429,7 @@ mod tests {
14311429
nodes[0].node.push_pending_event(Event::ProbeFailed {
14321430
payment_id: PaymentId([42; 32]),
14331431
payment_hash: PaymentHash([42; 32]),
1434-
path: path.clone(),
1432+
path,
14351433
short_channel_id: Some(scored_scid),
14361434
});
14371435
let event = receiver

lightning-block-sync/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ chunked_transfer = { version = "1.4", optional = true }
2828

2929
[dev-dependencies]
3030
lightning = { version = "0.0.114", path = "../lightning", features = ["_test_utils"] }
31-
tokio = { version = "~1.14", features = [ "macros", "rt" ] }
31+
tokio = { version = "1.14", features = [ "macros", "rt" ] }

lightning-block-sync/src/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub async fn synchronize_listeners<B: Deref + Sized + Send + Sync, C: Cache, L:
181181
let chain_listener = &ChainListenerSet(chain_listeners_at_height);
182182
let mut chain_notifier = ChainNotifier { header_cache, chain_listener };
183183
chain_notifier.connect_blocks(common_ancestor, most_connected_blocks, &mut chain_poller)
184-
.await.or_else(|(e, _)| Err(e))?;
184+
.await.map_err(|(e, _)| e)?;
185185
}
186186

187187
Ok(best_header)

lightning-block-sync/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,15 +414,15 @@ impl<'a, C: Cache, L: Deref> ChainNotifier<'a, C, L> where L::Target: chain::Lis
414414
let height = header.height;
415415
let block_data = chain_poller
416416
.fetch_block(&header).await
417-
.or_else(|e| Err((e, Some(new_tip))))?;
417+
.map_err(|e| (e, Some(new_tip)))?;
418418
debug_assert_eq!(block_data.block_hash, header.block_hash);
419419

420420
match block_data.deref() {
421421
BlockData::FullBlock(block) => {
422-
self.chain_listener.block_connected(&block, height);
422+
self.chain_listener.block_connected(block, height);
423423
},
424424
BlockData::HeaderOnly(header) => {
425-
self.chain_listener.filtered_block_connected(&header, &[], height);
425+
self.chain_listener.filtered_block_connected(header, &[], height);
426426
},
427427
}
428428

lightning-block-sync/src/poll.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl Validate for BlockHeaderData {
6161
fn validate(self, block_hash: BlockHash) -> BlockSourceResult<Self::T> {
6262
let pow_valid_block_hash = self.header
6363
.validate_pow(&self.header.target())
64-
.or_else(|e| Err(BlockSourceError::persistent(e)))?;
64+
.map_err(BlockSourceError::persistent)?;
6565

6666
if pow_valid_block_hash != block_hash {
6767
return Err(BlockSourceError::persistent("invalid block hash"));
@@ -82,7 +82,7 @@ impl Validate for BlockData {
8282

8383
let pow_valid_block_hash = header
8484
.validate_pow(&header.target())
85-
.or_else(|e| Err(BlockSourceError::persistent(e)))?;
85+
.map_err(BlockSourceError::persistent)?;
8686

8787
if pow_valid_block_hash != block_hash {
8888
return Err(BlockSourceError::persistent("invalid block hash"));

lightning-block-sync/src/test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl Blockchain {
106106
BlockHeaderData {
107107
chainwork: self.blocks[0].header.work() + Uint256::from_u64(height as u64).unwrap(),
108108
height: height as u32,
109-
header: self.blocks[height].header.clone(),
109+
header: self.blocks[height].header,
110110
}
111111
}
112112

@@ -162,7 +162,7 @@ impl BlockSource for Blockchain {
162162
}
163163

164164
if self.filtered_blocks {
165-
return Ok(BlockData::HeaderOnly(block.header.clone()));
165+
return Ok(BlockData::HeaderOnly(block.header));
166166
} else {
167167
return Ok(BlockData::FullBlock(block.clone()));
168168
}

lightning-invoice/src/de.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use core::num::ParseIntError;
66
use core::str;
77
use core::str::FromStr;
88

9-
use bech32;
109
use bech32::{u5, FromBase32};
1110

1211
use bitcoin_hashes::Hash;
@@ -18,7 +17,6 @@ use lightning::routing::router::{RouteHint, RouteHintHop};
1817

1918
use num_traits::{CheckedAdd, CheckedMul};
2019

21-
use secp256k1;
2220
use secp256k1::ecdsa::{RecoveryId, RecoverableSignature};
2321
use secp256k1::PublicKey;
2422

@@ -323,9 +321,9 @@ impl FromStr for RawHrp {
323321
};
324322

325323
Ok(RawHrp {
326-
currency: currency,
324+
currency,
327325
raw_amount: amount,
328-
si_prefix: si_prefix,
326+
si_prefix,
329327
})
330328
}
331329
}
@@ -342,7 +340,7 @@ impl FromBase32 for RawDataPart {
342340
let tagged = parse_tagged_parts(&data[7..])?;
343341

344342
Ok(RawDataPart {
345-
timestamp: timestamp,
343+
timestamp,
346344
tagged_fields: tagged,
347345
})
348346
}
@@ -515,7 +513,7 @@ impl FromBase32 for ExpiryTime {
515513

516514
fn from_base32(field_data: &[u5]) -> Result<ExpiryTime, ParseError> {
517515
match parse_int_be::<u64, u5>(field_data, 32)
518-
.map(|t| ExpiryTime::from_seconds(t))
516+
.map(ExpiryTime::from_seconds)
519517
{
520518
Some(t) => Ok(t),
521519
None => Err(ParseError::IntegerOverflowError),
@@ -540,7 +538,7 @@ impl FromBase32 for Fallback {
540538
type Err = ParseError;
541539

542540
fn from_base32(field_data: &[u5]) -> Result<Fallback, ParseError> {
543-
if field_data.len() < 1 {
541+
if field_data.is_empty() {
544542
return Err(ParseError::UnexpectedEndOfTaggedFields);
545543
}
546544

@@ -554,7 +552,7 @@ impl FromBase32 for Fallback {
554552
}
555553

556554
Ok(Fallback::SegWitProgram {
557-
version: version,
555+
version,
558556
program: bytes
559557
})
560558
},

0 commit comments

Comments
 (0)