Skip to content

Commit e9b20ce

Browse files
committed
Do not use bitcoin::blockdata
The `rust-bitcoin` project is working towards making the public API separate from the directory structure; eventually the `bitcoin::blockdata` will go away, to make maintenance easier here stop using the `blockdata` module. Do not run the formatter, so as to make review easier. This patch was created mechanically using: search-and-replace bitcoin::blockdata bitcoin and having defined ```bash search-and-replace () { if (($# != 2)) then echo "Usage: $0 <this> <that>" return fi local this="$1" local that="$2" for file in $(git grep -l "$this") do perl -pi -e "s/$this/$that/g" "$file" done } ```
1 parent 0d2fe67 commit e9b20ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+173
-173
lines changed

fuzz/src/chanmon_consistency.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
//! channel being force-closed.
2020
2121
use bitcoin::amount::Amount;
22-
use bitcoin::blockdata::constants::genesis_block;
23-
use bitcoin::blockdata::locktime::absolute::LockTime;
24-
use bitcoin::blockdata::opcodes;
25-
use bitcoin::blockdata::script::{Builder, ScriptBuf};
26-
use bitcoin::blockdata::transaction::{Transaction, TxOut};
22+
use bitcoin::constants::genesis_block;
23+
use bitcoin::locktime::absolute::LockTime;
24+
use bitcoin::opcodes;
25+
use bitcoin::script::{Builder, ScriptBuf};
26+
use bitcoin::transaction::{Transaction, TxOut};
2727
use bitcoin::network::Network;
2828
use bitcoin::transaction::Version;
2929

fuzz/src/full_stack.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
//! This test has been very useful, though due to its complexity good starting inputs are critical.
1515
1616
use bitcoin::amount::Amount;
17-
use bitcoin::blockdata::constants::genesis_block;
18-
use bitcoin::blockdata::locktime::absolute::LockTime;
19-
use bitcoin::blockdata::opcodes;
20-
use bitcoin::blockdata::script::{Builder, ScriptBuf};
21-
use bitcoin::blockdata::transaction::{Transaction, TxOut};
17+
use bitcoin::constants::genesis_block;
18+
use bitcoin::locktime::absolute::LockTime;
19+
use bitcoin::opcodes;
20+
use bitcoin::script::{Builder, ScriptBuf};
21+
use bitcoin::transaction::{Transaction, TxOut};
2222
use bitcoin::consensus::encode::deserialize;
2323
use bitcoin::network::Network;
2424
use bitcoin::transaction::Version;

fuzz/src/onion_message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Imports that need to be added manually
22
use bech32::u5;
3-
use bitcoin::blockdata::script::ScriptBuf;
3+
use bitcoin::script::ScriptBuf;
44
use bitcoin::secp256k1::ecdh::SharedSecret;
55
use bitcoin::secp256k1::ecdsa::RecoverableSignature;
66
use bitcoin::secp256k1::schnorr;

fuzz/src/router.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
// licenses.
99

1010
use bitcoin::amount::Amount;
11-
use bitcoin::blockdata::constants::ChainHash;
12-
use bitcoin::blockdata::script::Builder;
13-
use bitcoin::blockdata::transaction::TxOut;
11+
use bitcoin::constants::ChainHash;
12+
use bitcoin::script::Builder;
13+
use bitcoin::transaction::TxOut;
1414

1515
use lightning::blinded_path::{BlindedHop, BlindedPath, IntroductionNode};
1616
use lightning::chain::transaction::OutPoint;

lightning-background-processor/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,9 +1011,9 @@ impl Drop for BackgroundProcessor {
10111011
#[cfg(all(feature = "std", test))]
10121012
mod tests {
10131013
use super::{BackgroundProcessor, GossipSync, FRESHNESS_TIMER};
1014-
use bitcoin::blockdata::constants::{genesis_block, ChainHash};
1015-
use bitcoin::blockdata::locktime::absolute::LockTime;
1016-
use bitcoin::blockdata::transaction::{Transaction, TxOut};
1014+
use bitcoin::constants::{genesis_block, ChainHash};
1015+
use bitcoin::locktime::absolute::LockTime;
1016+
use bitcoin::transaction::{Transaction, TxOut};
10171017
use bitcoin::hashes::Hash;
10181018
use bitcoin::network::Network;
10191019
use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};

lightning-block-sync/src/convert.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::http::{BinaryResponse, JsonResponse};
22
use crate::utils::hex_to_work;
33
use crate::{BlockHeaderData, BlockSourceError};
44

5-
use bitcoin::blockdata::block::{Block, Header};
5+
use bitcoin::block::{Block, Header};
66
use bitcoin::consensus::encode;
77
use bitcoin::hash_types::{BlockHash, TxMerkleNode, Txid};
88
use bitcoin::hashes::hex::FromHex;
@@ -95,7 +95,7 @@ impl TryFrom<serde_json::Value> for BlockHeaderData {
9595

9696
Ok(BlockHeaderData {
9797
header: Header {
98-
version: bitcoin::blockdata::block::Version::from_consensus(
98+
version: bitcoin::block::Version::from_consensus(
9999
get_field!("version", as_i64).try_into().map_err(|_| ())?,
100100
),
101101
prev_blockhash: if let Some(hash_str) = response.get("previousblockhash") {
@@ -292,7 +292,7 @@ impl TryInto<GetUtxosResponse> for JsonResponse {
292292
#[cfg(test)]
293293
pub(crate) mod tests {
294294
use super::*;
295-
use bitcoin::blockdata::constants::genesis_block;
295+
use bitcoin::constants::genesis_block;
296296
use bitcoin::hashes::Hash;
297297
use bitcoin::network::Network;
298298
use hex::DisplayHex;

lightning-block-sync/src/gossip.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
55
use crate::{AsyncBlockSourceResult, BlockData, BlockSource, BlockSourceError};
66

7-
use bitcoin::blockdata::block::Block;
8-
use bitcoin::blockdata::constants::ChainHash;
9-
use bitcoin::blockdata::transaction::{OutPoint, TxOut};
7+
use bitcoin::block::Block;
8+
use bitcoin::constants::ChainHash;
9+
use bitcoin::transaction::{OutPoint, TxOut};
1010
use bitcoin::hash_types::BlockHash;
1111

1212
use lightning::ln::peer_handler::APeerManager;

lightning-block-sync/src/init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use crate::poll::{ChainPoller, Validate, ValidatedBlockHeader};
55
use crate::{BlockSource, BlockSourceResult, Cache, ChainNotifier};
66

7-
use bitcoin::blockdata::block::Header;
7+
use bitcoin::block::Header;
88
use bitcoin::hash_types::BlockHash;
99
use bitcoin::network::Network;
1010

lightning-block-sync/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ mod utils;
4444

4545
use crate::poll::{ChainTip, Poll, ValidatedBlockHeader};
4646

47-
use bitcoin::blockdata::block::{Block, Header};
47+
use bitcoin::block::{Block, Header};
4848
use bitcoin::hash_types::BlockHash;
4949
use bitcoin::pow::Work;
5050

lightning-block-sync/src/test_utils.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use crate::{
44
UnboundedCache,
55
};
66

7-
use bitcoin::blockdata::block::{Block, Header, Version};
8-
use bitcoin::blockdata::constants::genesis_block;
9-
use bitcoin::blockdata::locktime::absolute::LockTime;
7+
use bitcoin::block::{Block, Header, Version};
8+
use bitcoin::constants::genesis_block;
9+
use bitcoin::locktime::absolute::LockTime;
1010
use bitcoin::hash_types::{BlockHash, TxMerkleNode};
1111
use bitcoin::network::Network;
1212
use bitcoin::transaction;

0 commit comments

Comments
 (0)