Vis Virial
2085dc32a7
Refactoring: define `Block.get_base_size()`.
2021-06-28 20:07:07 +09:00
Vis Virial
4ac9cef9e9
Implement `Block.get_strippedsize()` and `Transaction.get_vsize()`.
2021-06-28 20:03:42 +09:00
Devrandom
95aa3bf153
std -> core
2021-06-11 17:28:04 +02:00
Jeffrey Czyz
ade2bcee8e
Return BlockHash from BlockHeader::validate_pow
...
Validating a block's proof-of-work involves computing the block hash.
Returning it from BlockHeader::validate_pow avoids having callers
recompute the block hash if it is needed.
2021-02-17 17:40:17 -08:00
Steven Roose
94b7371424
Replace serde_struct_impl with derive-based impls
2020-12-30 16:32:52 +01:00
0xB10C
b7caf0110f
test: BlockHeader::difficulty()
...
https://github.com/rust-bitcoin/rust-bitcoin/issues/462
2020-12-26 11:33:54 +01:00
0xB10C
4eca40dcc1
test: BlockHeader::validate_pow()
...
https://github.com/rust-bitcoin/rust-bitcoin/issues/462#issuecomment-683916241
2020-12-26 11:33:39 +01:00
0xB10C
d5bf5c88a3
test: BlockHeader::work()
...
https://github.com/rust-bitcoin/rust-bitcoin/issues/462#issuecomment-683916241
2020-12-26 11:33:22 +01:00
Elichai Turkel
609b9523b8
Add benchmarks for block serialization
2020-10-08 16:28:17 +03:00
Steven Roose
9c90b39ebd
Add Block::coinbase and Block::bip34_block_height
2020-10-07 18:54:12 +02:00
Steven Roose
29a74a14ab
Move around impls in block module
...
So that an impl always succeeds the struct type definition.
2020-10-07 18:48:24 +02:00
Braydon Fuller
945db009b2
Add test for transaction and block version serialization
2020-08-19 14:12:03 -07:00
Braydon Fuller
e9f1f11c2c
Transaction and header version is signed int
2020-08-17 10:28:51 -07:00
Alexis Sellier
9cb5d2e711
Link type in rustdoc
2020-07-09 21:17:02 +02:00
Alexis Sellier
e8cecfe1d3
Add `BlockHeader::u256_from_compact_target` function
...
This implements the counterparty to BlockHeader::compact_target_from_u256,
to convert a compact u32 to a Uint256.
2020-07-09 21:17:02 +02:00
Andrew Poelstra
c3a7d1b27c
Merge pull request #417 from shesek/202003-block-size-weight
...
Add Block::get_size() and Block::get_weight()
2020-04-07 14:12:15 +00:00
Elichai Turkel
a473d01b17
Made some idiomatic changes
2020-03-29 17:15:15 +03:00
Nadav Ivgi
94032f6817
Add Block::get_size() and Block::get_weight()
2020-03-27 21:54:46 +03:00
Elichai Turkel
c19b736566
Remove the hex dependency
2020-01-20 18:50:02 +02:00
Steven Roose
8e52b8ce4d
Remove the BitcoinHash trait
...
Replaced by a `block_hash` method on both `Block` and `BlockHeader`.
2020-01-10 11:34:16 +00:00
Dr Maxim Orlovsky
5fc24dea33
Multiple fixes for hash types and their computing
...
Unit test for wtxid and SegWit transactions
2020-01-01 13:54:23 +01:00
Dr Maxim Orlovsky
0abe15b1f6
Moving from BitcoinHash to Wtxid for Transactions
2020-01-01 13:52:20 +01:00
Dr Maxim Orlovsky
f5a8087105
New hash types: MerkleRoot/Branch, WitnessCommit, SigHash, FilterHash
2020-01-01 13:50:17 +01:00
Dr Maxim Orlovsky
5f4f629bb1
Replaced all hash160, sha256 and sha256d with the new hash types throughout the code
...
Embedding Txid's in the doc exaples
2020-01-01 13:44:34 +01:00
Dr Maxim Orlovsky
5ef39e34fa
Implementing (W)Pubkey/ScriptHash and BlockHash
2020-01-01 13:42:22 +01:00
Dr Maxim Orlovsky
ec92a05682
New HashTypes defined according to #284 (WIP), Txid is completed
2020-01-01 13:41:42 +01:00
Matt Corallo
acb43af981
Drop byteorder dependency
...
Taking an external dependency just to convert ints to byte arrays
is somewhat of a waste, especially when Rust isn't very aggressive
about doing cross-crate LTO.
Note that the latest LLVM pattern-matches this, and while I haven't
tested it, that should mean this means no loss of optimization.
2019-12-05 10:41:00 -05:00
Tamas Blummer
38d5ae4e3f
enable serde serialization for block and blockheader
2019-08-24 14:26:18 +02:00
Steven Roose
48f4c1989f
Rename bitcoin_hashes dependency to hashes
2019-08-16 15:52:27 +01:00
Jonas Nick
30f24a39d0
Remove confusing mentions of SPV
2019-06-07 13:12:07 +00:00
Steven Roose
093d60bf7f
Rename BlockHeader::spv_validate to validate_pow
2019-06-06 10:39:03 +01:00
Matt Corallo
4f96a87475
Drop LoneHeaders and just use BlockHeader
...
The protocol has a bug where a 0u8 is pushed at the end of each
block header on the wire in headers messages. WHy this bug came
about is unrealted and shouldn't impact API design.
2019-05-17 17:55:02 -04:00
Matt Corallo
084703cba9
Merge pull request #218 from tamasblummer/merkle_root_fix
...
Merkle root calculation and witness commitment check for Block
2019-02-16 19:05:42 -05:00
ariard
51971dd533
Fix typos and clarify some comment in blockdata, block, address ( #230 )
2019-02-04 07:30:41 +01:00
Tamas Blummer
d8c93d9935
Implement Witness commitment check for Block. Remove MerkleRoot implementations for types implementing BitcoinHash as
...
it is misleading. MerkleRoot is defined instead for a Block.
2019-02-01 17:46:26 +01:00
Carl Dong
99f63a8ca4
Convert codebase from util::hash to bitcoin_hashes
...
Also replace unsafe transmute with call to read_u64_into
2019-01-24 16:27:52 -05:00
Carl Dong
0f42ca69b0
Move relevant names into consensus::encode
...
- Move network::encodable::* to consensus::encode::*
- Rename Consensus{En,De}codable to {En,De}codable (now under
consensus::encode)
- Move network::serialize::Error to consensus::encode::Error
- Remove Raw{En,De}coder, implement {En,De}coder for T: {Write,Read}
instead
- Move network::serialize::Simple{En,De}coder to
consensus::encode::{En,De}coder
- Rename util::Error::Serialize to util::Error::Encode
- Modify comments to refer to new names
- Modify files to refer to new names
- Expose {En,De}cod{able,er}, {de,}serialize, Params
- Do not return Result for serialize{,_hex} as serializing to a Vec
should never fail
2018-09-25 21:19:35 +08:00
Carl Dong
8e0e4eb55a
Move serialize::BitcoinHash to util: #️⃣ :BitcoinHash
...
- Use Sha256dEncoder for calculating merkle root
- Remove BitcoinHash implementation for Vec<u8>
2018-09-25 21:19:10 +08:00
Jean Pierre Dudey
77c185d9ec
Fix modules documentation title.
...
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-08 17:38:50 -04:00
Savil Srivastava
933dcaeb82
[code hygiene] remove deprecated rustc-serialize
...
Addresses #96 .
Turns out it was being used for hex encoding/decoding, so replaced that with the `hex` crate.
i chose to import the `decode` method as:
```
use hex::decode as hex_decode
```
so that it is clear to the reader what is being decoded when it is called. "decode" is such a generic sounding function name that it would get confusing otherwise.
2018-07-26 09:49:15 -07:00
Igor Aleksanov
14a920ab7d
Added method to convert target from Uint256 to compact form ( #86 )
...
Renamed method for getting compact from u256
Removed unnecessary asserts from convert function
2018-06-12 20:58:25 +02:00
Roman Zeyde
69ea2a760b
Fix 2 small typos in comments
2018-06-09 22:27:40 +03:00
Roman Zeyde
44d0ad90e9
block: fix a small typo in comment
2018-04-11 12:23:15 +03:00
Andrew Poelstra
047c0c149d
remove `num` crate dependency
2018-02-18 15:21:13 +00:00
Tamas Blummer
3efe511cc6
add difficulty calculation
2018-02-11 19:58:26 +01:00
Andrew Poelstra
af10b153be
segwit: add transaction/block serialization support for BIP141/BIP144; bump to 0.8
...
Do not yet support new sighash type
2016-08-24 16:24:55 +00:00
Andrew Poelstra
35832e3da0
Remove some unused trait imports
2016-05-27 18:36:42 +00:00
Andrew Poelstra
5e03adc9aa
Changes for cargo-clippy warnings
2015-10-28 11:27:23 -05:00
Andrew Poelstra
17e27ec09f
*** IT COMPILES ON RUSTC NIGHTLY ***
...
Many unit test failures, but this is progress.
2015-04-10 20:55:59 -05:00
Andrew Poelstra
3117f95b62
Checkpoint commit: into warnings!
2015-04-10 18:15:57 -05:00