Skip to content

Bump dependencies to bitcoin 0.27 and bech32 0.8 #1012

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

Merged
merged 4 commits into from
Jul 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
1.41.0,
# 1.45.2 is MSRV for lightning-net-tokio, lightning-block-sync, and coverage generation
1.45.2,
# 1.49.0 is MSRV for no_std builds using hashbrown
1.49.0]
# 1.47.0 will be the MSRV for no_std builds using hashbrown once core2 is updated
1.47.0]
include:
- toolchain: stable
build-net-tokio: true
Expand All @@ -41,8 +41,8 @@ jobs:
build-net-tokio: true
build-no-std: false
coverage: true
- toolchain: 1.49.0
build-no-std: true
- toolchain: 1.47.0
build-no-std: false
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout source code
Expand Down
2 changes: 1 addition & 1 deletion fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ stdin_fuzz = []
[dependencies]
afl = { version = "0.4", optional = true }
lightning = { path = "../lightning", features = ["fuzztarget"] }
bitcoin = { version = "0.26", features = ["fuzztarget", "secp-lowmemory"] }
bitcoin = { version = "0.27", features = ["fuzztarget", "secp-lowmemory"] }
hex = "0.3"
honggfuzz = { version = "0.5", optional = true }
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion lightning-background-processor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Utilities to perform required background tasks for Rust Lightning.
edition = "2018"

[dependencies]
bitcoin = "0.26"
bitcoin = "0.27"
lightning = { version = "0.0.99", path = "../lightning", features = ["allow_wallclock_use"] }
lightning-persister = { version = "0.0.99", path = "../lightning-persister" }

Expand Down
2 changes: 1 addition & 1 deletion lightning-block-sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rest-client = [ "serde", "serde_json", "chunked_transfer" ]
rpc-client = [ "serde", "serde_json", "chunked_transfer" ]

[dependencies]
bitcoin = "0.26"
bitcoin = "0.27"
lightning = { version = "0.0.99", path = "../lightning" }
tokio = { version = "1.0", features = [ "io-util", "net", "time" ], optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }
Expand Down
4 changes: 2 additions & 2 deletions lightning-invoice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ keywords = [ "lightning", "bitcoin", "invoice", "BOLT11" ]
readme = "README.md"

[dependencies]
bech32 = "0.7"
bech32 = "0.8"
lightning = { version = "0.0.99", path = "../lightning" }
secp256k1 = { version = "0.20", features = ["recovery"] }
num-traits = "0.2.8"
bitcoin_hashes = "0.9.4"
bitcoin_hashes = "0.10"

[dev-dependencies]
lightning = { version = "0.0.99", path = "../lightning", features = ["_test_utils"] }
2 changes: 1 addition & 1 deletion lightning-invoice/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ honggfuzz_fuzz = ["honggfuzz"]
honggfuzz = { version = "0.5", optional = true }
afl = { version = "0.4", optional = true }
lightning-invoice = { path = ".."}
bech32 = "0.7"
bech32 = "0.8"

# Prevent this from interfering with workspaces
[workspace]
Expand Down
8 changes: 7 additions & 1 deletion lightning-invoice/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,13 @@ impl FromStr for SignedRawInvoice {
type Err = ParseError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
let (hrp, data) = bech32::decode(s)?;
let (hrp, data, var) = bech32::decode(s)?;

if var == bech32::Variant::Bech32m {
// Consider Bech32m addresses to be "Invalid Checksum", since that is what we'd get if
// we didn't support Bech32m (which lightning does not use).
return Err(ParseError::Bech32Error(bech32::Error::InvalidChecksum));
}

if data.len() < 104 {
return Err(ParseError::TooShortDataPart);
Expand Down
2 changes: 1 addition & 1 deletion lightning-invoice/src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl Display for SignedRawInvoice {
let mut data = self.raw_invoice.data.to_base32();
data.extend_from_slice(&self.signature.to_base32());

bech32::encode_to_fmt(f, &hrp, data).expect("HRP is valid")?;
bech32::encode_to_fmt(f, &hrp, data, bech32::Variant::Bech32).expect("HRP is valid")?;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion lightning-net-tokio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ For Rust-Lightning clients which wish to make direct connections to Lightning P2
edition = "2018"

[dependencies]
bitcoin = "0.26"
bitcoin = "0.27"
lightning = { version = "0.0.99", path = "../lightning" }
tokio = { version = "1.0", features = [ "io-util", "macros", "rt", "sync", "net", "time" ] }

Expand Down
2 changes: 1 addition & 1 deletion lightning-persister/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Utilities to manage Rust-Lightning channel data persistence and retrieval.
unstable = ["lightning/unstable"]

[dependencies]
bitcoin = "0.26"
bitcoin = "0.27"
lightning = { version = "0.0.99", path = "../lightning" }
libc = "0.2"

Expand Down
8 changes: 4 additions & 4 deletions lightning/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ max_level_debug = []
unsafe_revoked_tx_signing = []
unstable = []

no_std = ["hashbrown"]
std = []
no_std = ["hashbrown", "bitcoin/no-std"]
std = ["bitcoin/std"]

default = ["std"]

[dependencies]
bitcoin = "0.26"
bitcoin = "0.27"

hashbrown = { version = "0.11", optional = true }
hex = { version = "0.3", optional = true }
Expand All @@ -43,7 +43,7 @@ hex = "0.3"
regex = "0.1.80"

[dev-dependencies.bitcoin]
version = "0.26"
version = "0.27"
features = ["bitcoinconsensus"]

[package.metadata.docs.rs]
Expand Down
1 change: 1 addition & 0 deletions lightning/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#![cfg_attr(all(any(test, feature = "_test_utils"), feature = "unstable"), feature(test))]
#[cfg(all(any(test, feature = "_test_utils"), feature = "unstable"))] extern crate test;

#[macro_use]
extern crate alloc;
extern crate bitcoin;
extern crate core;
Expand Down
9 changes: 5 additions & 4 deletions lightning/src/ln/channelmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5114,23 +5114,24 @@ impl<'a, Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
mod tests {
use bitcoin::hashes::Hash;
use bitcoin::hashes::sha256::Hash as Sha256;
use core::sync::atomic::{AtomicBool, Ordering};
use core::time::Duration;
use ln::{PaymentPreimage, PaymentHash, PaymentSecret};
use ln::channelmanager::PersistenceNotifier;
use ln::features::{InitFeatures, InvoiceFeatures};
use ln::functional_test_utils::*;
use ln::msgs;
use ln::msgs::ChannelMessageHandler;
use routing::router::{get_keysend_route, get_route};
use util::events::{Event, MessageSendEvent, MessageSendEventsProvider};
use util::test_utils;
use std::sync::Arc;
use std::thread;

#[cfg(feature = "std")]
#[test]
fn test_wait_timeout() {
use ln::channelmanager::PersistenceNotifier;
use sync::Arc;
use core::sync::atomic::{AtomicBool, Ordering};
use std::thread;

let persistence_notifier = Arc::new(PersistenceNotifier::new());
let thread_notifier = Arc::clone(&persistence_notifier);

Expand Down