Skip to content

Commit 345e69e

Browse files
committed
Update bitcoin crate to 0.29.0
1 parent d024251 commit 345e69e

36 files changed

+208
-182
lines changed

fuzz/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ stdin_fuzz = []
2020
afl = { version = "0.4", optional = true }
2121
lightning = { path = "../lightning", features = ["regex"] }
2222
lightning-rapid-gossip-sync = { path = "../lightning-rapid-gossip-sync" }
23-
bitcoin = { version = "0.28.1", features = ["secp-lowmemory"] }
23+
bitcoin = { version = "0.29.0", features = ["secp-lowmemory"] }
2424
hex = "0.3"
2525
honggfuzz = { version = "0.5", optional = true }
2626
libfuzzer-sys = { version = "0.4", optional = true }

fuzz/src/chanmon_consistency.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl KeysInterface for KeyProvider {
169169
fn ecdh(&self, recipient: Recipient, other_key: &PublicKey, tweak: Option<&[u8; 32]>) -> Result<SharedSecret, ()> {
170170
let mut node_secret = self.get_node_secret(recipient)?;
171171
if let Some(tweak) = tweak {
172-
node_secret.mul_assign(tweak).map_err(|_| ())?;
172+
node_secret = node_secret.mul_tweak(tweak).map_err(|_| ())?;
173173
}
174174
Ok(SharedSecret::new(other_key, &node_secret))
175175
}
@@ -447,7 +447,7 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out) {
447447
let events = $source.get_and_clear_pending_events();
448448
assert_eq!(events.len(), 1);
449449
if let events::Event::FundingGenerationReady { ref temporary_channel_id, ref channel_value_satoshis, ref output_script, .. } = events[0] {
450-
let tx = Transaction { version: $chan_id, lock_time: 0, input: Vec::new(), output: vec![TxOut {
450+
let tx = Transaction { version: $chan_id, lock_time: PackedLockTime::ZERO, input: Vec::new(), output: vec![TxOut {
451451
value: *channel_value_satoshis, script_pubkey: output_script.clone(),
452452
}]};
453453
funding_output = OutPoint { txid: tx.txid(), index: 0 };
@@ -481,11 +481,11 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out) {
481481
macro_rules! confirm_txn {
482482
($node: expr) => { {
483483
let chain_hash = genesis_block(Network::Bitcoin).block_hash();
484-
let mut header = BlockHeader { version: 0x20000000, prev_blockhash: chain_hash, merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
484+
let mut header = BlockHeader { version: 0x20000000, prev_blockhash: chain_hash, merkle_root: TxMerkleNode::all_zeros(), time: 42, bits: 42, nonce: 42 };
485485
let txdata: Vec<_> = channel_txn.iter().enumerate().map(|(i, tx)| (i + 1, tx)).collect();
486486
$node.transactions_confirmed(&header, &txdata, 1);
487487
for _ in 2..100 {
488-
header = BlockHeader { version: 0x20000000, prev_blockhash: header.block_hash(), merkle_root: Default::default(), time: 42, bits: 42, nonce: 42 };
488+
header = BlockHeader { version: 0x20000000, prev_blockhash: header.block_hash(), merkle_root: TxMerkleNode::all_zeros(), time: 42, bits: 42, nonce: 42 };
489489
}
490490
$node.best_block_updated(&header, 99);
491491
} }

fuzz/src/full_stack.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl<'a> MoneyLossDetector<'a> {
213213
}
214214

215215
self.blocks_connected += 1;
216-
let header = BlockHeader { version: 0x20000000, prev_blockhash: self.header_hashes[self.height].0, merkle_root: Default::default(), time: self.blocks_connected, bits: 42, nonce: 42 };
216+
let header = BlockHeader { version: 0x20000000, prev_blockhash: self.header_hashes[self.height].0, merkle_root: TxMerkleNode::all_zeros(), time: self.blocks_connected, bits: 42, nonce: 42 };
217217
self.height += 1;
218218
self.manager.transactions_confirmed(&header, &txdata, self.height as u32);
219219
self.manager.best_block_updated(&header, self.height as u32);
@@ -230,7 +230,7 @@ impl<'a> MoneyLossDetector<'a> {
230230

231231
fn disconnect_block(&mut self) {
232232
if self.height > 0 && (self.max_height < 6 || self.height >= self.max_height - 6) {
233-
let header = BlockHeader { version: 0x20000000, prev_blockhash: self.header_hashes[self.height - 1].0, merkle_root: Default::default(), time: self.header_hashes[self.height].1, bits: 42, nonce: 42 };
233+
let header = BlockHeader { version: 0x20000000, prev_blockhash: self.header_hashes[self.height - 1].0, merkle_root: TxMerkleNode::all_zeros(), time: self.header_hashes[self.height].1, bits: 42, nonce: 42 };
234234
self.manager.block_disconnected(&header, self.height as u32);
235235
self.monitor.block_disconnected(&header, self.height as u32);
236236
self.height -= 1;
@@ -273,7 +273,7 @@ impl KeysInterface for KeyProvider {
273273
fn ecdh(&self, recipient: Recipient, other_key: &PublicKey, tweak: Option<&[u8; 32]>) -> Result<SharedSecret, ()> {
274274
let mut node_secret = self.get_node_secret(recipient)?;
275275
if let Some(tweak) = tweak {
276-
node_secret.mul_assign(tweak).map_err(|_| ())?;
276+
node_secret = node_secret.mul_tweak(tweak).map_err(|_| ())?;
277277
}
278278
Ok(SharedSecret::new(other_key, &node_secret))
279279
}
@@ -564,7 +564,7 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
564564
},
565565
10 => {
566566
'outer_loop: for funding_generation in pending_funding_generation.drain(..) {
567-
let mut tx = Transaction { version: 0, lock_time: 0, input: Vec::new(), output: vec![TxOut {
567+
let mut tx = Transaction { version: 0, lock_time: PackedLockTime::ZERO, input: Vec::new(), output: vec![TxOut {
568568
value: funding_generation.2, script_pubkey: funding_generation.3,
569569
}] };
570570
let funding_output = 'search_loop: loop {

lightning-background-processor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ all-features = true
1414
rustdoc-args = ["--cfg", "docsrs"]
1515

1616
[dependencies]
17-
bitcoin = "0.28.1"
17+
bitcoin = "0.29.0"
1818
lightning = { version = "0.0.110", path = "../lightning", features = ["std"] }
1919
lightning-rapid-gossip-sync = { version = "0.0.110", path = "../lightning-rapid-gossip-sync" }
2020

lightning-background-processor/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ impl Drop for BackgroundProcessor {
488488
mod tests {
489489
use bitcoin::blockdata::block::BlockHeader;
490490
use bitcoin::blockdata::constants::genesis_block;
491+
use bitcoin::blockdata::locktime::PackedLockTime;
491492
use bitcoin::blockdata::transaction::{Transaction, TxOut};
492493
use bitcoin::network::constants::Network;
493494
use lightning::chain::{BestBlock, Confirm, chainmonitor};
@@ -513,6 +514,8 @@ mod tests {
513514
use std::sync::{Arc, Mutex};
514515
use std::sync::mpsc::SyncSender;
515516
use std::time::Duration;
517+
use bitcoin::hashes::Hash;
518+
use bitcoin::TxMerkleNode;
516519
use lightning::routing::scoring::{FixedPenaltyScorer};
517520
use lightning_rapid_gossip_sync::RapidGossipSync;
518521
use super::{BackgroundProcessor, GossipSync, FRESHNESS_TIMER};
@@ -700,7 +703,7 @@ mod tests {
700703
assert_eq!(channel_value_satoshis, $channel_value);
701704
assert_eq!(user_channel_id, 42);
702705

703-
let tx = Transaction { version: 1 as i32, lock_time: 0, input: Vec::new(), output: vec![TxOut {
706+
let tx = Transaction { version: 1 as i32, lock_time: PackedLockTime(0), input: Vec::new(), output: vec![TxOut {
704707
value: channel_value_satoshis, script_pubkey: output_script.clone(),
705708
}]};
706709
(temporary_channel_id, tx)
@@ -722,7 +725,7 @@ mod tests {
722725
for i in 1..=depth {
723726
let prev_blockhash = node.best_block.block_hash();
724727
let height = node.best_block.height() + 1;
725-
let header = BlockHeader { version: 0x20000000, prev_blockhash, merkle_root: Default::default(), time: height, bits: 42, nonce: 42 };
728+
let header = BlockHeader { version: 0x20000000, prev_blockhash, merkle_root: TxMerkleNode::all_zeros(), time: height, bits: 42, nonce: 42 };
726729
let txdata = vec![(0, tx)];
727730
node.best_block = BestBlock::new(header.block_hash(), height);
728731
match i {

lightning-block-sync/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ rest-client = [ "serde", "serde_json", "chunked_transfer" ]
1818
rpc-client = [ "serde", "serde_json", "chunked_transfer" ]
1919

2020
[dependencies]
21-
bitcoin = "0.28.1"
21+
bitcoin = "0.29.0"
2222
lightning = { version = "0.0.110", path = "../lightning" }
2323
futures = { version = "0.3" }
2424
tokio = { version = "1.0", features = [ "io-util", "net", "time" ], optional = true }

lightning-block-sync/src/test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use bitcoin::hash_types::BlockHash;
77
use bitcoin::network::constants::Network;
88
use bitcoin::util::uint::Uint256;
99
use bitcoin::util::hash::bitcoin_merkle_root;
10-
use bitcoin::Transaction;
10+
use bitcoin::{PackedLockTime, Transaction};
1111

1212
use lightning::chain;
1313

@@ -45,7 +45,7 @@ impl Blockchain {
4545
// but that's OK because those tests don't trigger the check.
4646
let coinbase = Transaction {
4747
version: 0,
48-
lock_time: 0,
48+
lock_time: PackedLockTime::ZERO,
4949
input: vec![],
5050
output: vec![]
5151
};

lightning-invoice/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ no-std = ["hashbrown", "lightning/no-std", "core2/alloc"]
1919
std = ["bitcoin_hashes/std", "num-traits/std", "lightning/std", "bech32/std"]
2020

2121
[dependencies]
22-
bech32 = { version = "0.8", default-features = false }
22+
bech32 = { version = "0.9.0", default-features = false }
2323
lightning = { version = "0.0.110", path = "../lightning", default-features = false }
24-
secp256k1 = { version = "0.22", default-features = false, features = ["recovery", "alloc"] }
24+
secp256k1 = { version = "0.24.0", default-features = false, features = ["recovery", "alloc"] }
2525
num-traits = { version = "0.2.8", default-features = false }
2626
bitcoin_hashes = { version = "0.10", default-features = false }
2727
hashbrown = { version = "0.11", optional = true }

lightning-net-tokio/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ all-features = true
1515
rustdoc-args = ["--cfg", "docsrs"]
1616

1717
[dependencies]
18-
bitcoin = "0.28.1"
18+
bitcoin = "0.29.0"
1919
lightning = { version = "0.0.110", path = "../lightning" }
2020
tokio = { version = "1.0", features = [ "io-util", "macros", "rt", "sync", "net", "time" ] }
2121

lightning-persister/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ rustdoc-args = ["--cfg", "docsrs"]
1616
_bench_unstable = ["lightning/_bench_unstable"]
1717

1818
[dependencies]
19-
bitcoin = "0.28.1"
19+
bitcoin = "0.29.0"
2020
lightning = { version = "0.0.110", path = "../lightning" }
2121
libc = "0.2"
2222

0 commit comments

Comments
 (0)