Skip to content
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dash-types = { git = "https://github.com/dashpay/base-sdk", rev = "89828032b6be3
bitcoin_hashes = { version = "0.14.101", default-features = false }
bip324 = "0.11"
bitcoin-crypto = { git = "https://github.com/rust-bitcoin/rust-bitcoin", rev = "7ba35c7c1dd63892bfb9c9395bbd80e2ab5df516", default-features = false }
bitcoin-units = { git = "https://github.com/rust-bitcoin/rust-bitcoin", rev = "7ba35c7c1dd63892bfb9c9395bbd80e2ab5df516", default-features = false }
hex-conservative = { version = "1.3.0" }

[workspace.package]
Expand Down
3 changes: 2 additions & 1 deletion dash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ default = ["bincode"]
base64 = [ "dep:base64" ]
rand-std = ["rand"]
rand = ["dashcore-crypto/rand"]
serde = ["dep:serde", "dashcore-crypto/serde", "dashcore_hashes/serde", "dash-network/serde", "dash-types/serde"]
serde = ["dep:serde", "bitcoin-units/serde", "dashcore-crypto/serde", "dashcore_hashes/serde", "dash-network/serde", "dash-types/serde"]
signer = ["rand", "base64"]
core-block-hash-use-x11 = ["dashcore_hashes/x11"]
bls = ["dashcore-crypto/bls"]
Expand All @@ -39,6 +39,7 @@ rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
internals = { path = "../internals", package = "dashcore-private" }
bitcoin-units = { workspace = true, features = ["std"] }
dashcore_hashes = { path = "../hashes" }
dashcore-crypto = { path = "../crypto" }
dash-network = { path = "../dash-network" }
Expand Down
12 changes: 3 additions & 9 deletions dash/src/blockdata/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ impl Block {

/// Returns the weight of the block.
pub fn weight(&self) -> Weight {
let base_weight = Weight::from_non_witness_data_size(self.base_size() as u64);
let base_weight = Weight::from_vb_unchecked(self.base_size() as u64);
let txs_weight: Weight = self.txdata.iter().map(Transaction::weight).sum();
base_weight + txs_weight
}
Expand Down Expand Up @@ -435,10 +435,7 @@ mod tests {

assert_eq!(real_decode.size(), some_block.len());
assert_eq!(real_decode.strippedsize(), some_block.len());
assert_eq!(
real_decode.weight(),
Weight::from_non_witness_data_size(some_block.len() as u64)
);
assert_eq!(real_decode.weight(), Weight::from_vb_unchecked(some_block.len() as u64));

assert_eq!(serialize(&real_decode), some_block);
}
Expand Down Expand Up @@ -483,10 +480,7 @@ mod tests {

assert_eq!(real_decode.size(), some_block.len());
assert_eq!(real_decode.strippedsize(), some_block.len());
assert_eq!(
real_decode.weight(),
Weight::from_non_witness_data_size(some_block.len() as u64)
);
assert_eq!(real_decode.weight(), Weight::from_vb_unchecked(some_block.len() as u64));

assert_eq!(serialize(&real_decode), some_block);
}
Expand Down
Loading
Loading