Commit Graph

48 Commits

Author SHA1 Message Date
Tobin Harding 3f5caa501f Clean up module level rustdocs
Docs can always do with a bit of love.

Clean up the module level (`//!`) rustdocs for all public modules.

I claim uniform is better than any specific method/style. I tried to fit
in with what ever was either most sane of most prevalent, therefore
attaining uniformity without unnecessary code churn (one exception being
the changes to headings described below).

Notes:

* Headings - use heading as a regular sentence for all modules e.g.,

```
//! Bitcoin network messages.
```

as opposed to
```
//! # Bitcoin Network Messages
```

It was not clear which style to use so I picked a 'random' mature
project and copied their style.

* Added 'This module' in _most_ places as the start of the module
description, however I was not religious about this one.

* Fixed line length if necessary since most of our code seems to follow
short (80 char) line lengths for comments anyways.

* Added periods and fixed obvious (and sometimes not so obvious)
grammatically errors.

* Added a trailing `//!` to every block since this was almost universal
already. I don't really like this one but I'm guessing it is Andrew's
preferred style since its on the copyright notices as well.
2021-11-06 10:59:53 +11:00
Riccardo Casatta 24acfe3672
Implement Bip341 signature hash, create unified SigHashCache for taproot, segwit and legacy inputs 2021-07-21 12:05:18 +02:00
Devrandom 4826d0c6cc no_std support
Based on the original work by Justin Moon.

*MSRV unchanged from 1.29.0.*

When `std` is off, `no-std` must be on, and we use the [`alloc`](https://doc.rust-lang.org/alloc/) and core2 crates. The `alloc` crate requires the user define a global allocator.

* Import from `core` and `alloc` instead of `std`
* `alloc` only used if `no-std` is on
* Create `std` feature
* Create `no-std` feature which adds a core2 dependency to polyfill `std::io` features. This is an experimental feature and should be
used with caution.
* CI runs tests `no-std`
* MSRV for `no-std` is 1.51 or so
2021-07-15 09:04:49 +02:00
Devrandom 95aa3bf153 std -> core 2021-06-11 17:28:04 +02:00
Dr Maxim Orlovsky 664b09cdfd
Re-export Scep256k1 Schnorr keys under `util::schnorr`
This is second step in introducing Schnorr key support as per #588
2021-04-12 14:18:00 +02:00
Dr Maxim Orlovsky b17d7fc31c
Moving keys under `util::ecdsa`, re-exporting them at `util::key`
This is the first step in introducing Schnorr key support as per #588
2021-04-12 14:17:42 +02:00
Steven Roose a56712befc
Create tagged taproot hashes 2020-11-30 20:13:11 +00:00
Elichai Turkel 2d70623356
Remove deprecated Error::description impl 2020-10-08 17:11:18 +03:00
Elichai Turkel 023fae1f65
Add the dyn keyword where appropriate 2020-10-08 17:11:16 +03:00
Elichai Turkel 654232a3dc
Deprecate Error::description 2020-04-13 02:15:28 +03: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
Tamás Blummer c93a70487f
Add client side block filter (BIP158) (#281)
* add client side block filters with code from murmel. use siphash from bitcoin_hashes pass Bitcoin Core tests upgrade to bitcoin_hashes 0.7

* add filter.filter_id() test use BlockFilter directly

* fixed edge cases of matching empty query sets or or using empty filter
2019-07-26 09:36:25 +02:00
John L. Jegutanis aae2937d11 Add a MerkleBlock construction
This is a port of the bitcoin-core CPartialMerkleTree and CMerkleBlock classes.
Here they are called PartialMerkleTree and MerkleBlock.

These are useful for SPV clients that wish to verify that a transaction is
present in a specific block in an authenticated way.
2019-07-05 20:44:31 +02:00
Andrew Poelstra b2727b6ebe
Merge pull request #250 from stevenroose/no-strason
Remove Decimal and replace strason with serde_json
2019-07-03 17:30:21 +00:00
Steven Roose 30201f3924
Remove Decimal and replace strason with serde_json 2019-06-13 18:29:16 +01:00
Jonas Nick 30f24a39d0 Remove confusing mentions of SPV 2019-06-07 13:12:07 +00:00
Steven Roose 688d95b463
Add Amount and SignedAmount types 2019-05-31 10:18:59 +01:00
Carl Dong 4fa39c4a3e Add PSBT-specific Error data type
- Implement psbt::Error data type
- Implement conversion from psbt::Error to util::Error
- Create util::psbt module
- Create non-public util::psbt::error module
2019-02-28 10:54:53 -05:00
Carl Dong a944c7fbd0 key: Use correct error for decoding
This change also moves the secp256k1::Error wrapper from util::Error to
consensus::encode::Error, since we do not use it anywhere else. We can
add it back to util::Error once we have instances of secp256k1::Error
that are not related to consensus::encode.
2019-02-11 15:15:03 -05:00
Carl Dong 53a6efe33c Add PublicKey struct encapsulating compressedness
- Move util::privkey to util::key
- Add PublicKey struct to util::key
- Implement de/serialization methods for util:🔑:PublicKey
2019-02-11 14:56:55 -05:00
Dimitris Apostolou 132ca5ea95 Fix typos 2019-01-23 14:17:29 -05:00
Sebastian Geisler 7c7ec02ed2 Remove unused Pair iterator and util::iter module 2019-01-03 17:28:36 -08:00
Sebastian Geisler 79a88e1612 Move fuzzing code out of utils 2018-12-03 16:31:13 -08: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 bccdd06794 Replace catch-all match arms with specific ones 2018-08-21 01:58:40 -07:00
Carl Dong 0c172941af Replace serialize::Error::Detail with variants
- Add serialize::Error::ParseFailed(&'static str) variant for
  serialization errors without context
- Add appropriate variants to replace network::Error::Detail for
  serialization error with context
- Remove error method from SimpleDecoders
2018-08-21 01:58:40 -07:00
Carl Dong e5b5cbfadb Fix Error type for SimpleDecoder and SimpleEncoder
- Separate serialize::Error and network::Error from util::Error
- Remove unneeded propagate_err and consume_err
- Change fuzzing code to ignore Err type
2018-08-21 01:58:40 -07:00
Jean Pierre Dudey 6e99d2d33c Hidde `From<T>` implementations for error types in Rustdoc.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-12 12:57:59 -04: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
Matt Corallo 6826d8f35c Stub out Sha2 calls when fuzzing to mask all but the first byte 2018-03-21 18:44:10 -04:00
Tamas Blummer 1a87244b2b Implement Segwit addresses 2018-03-20 18:26:51 +01:00
Andrew Poelstra 65d8df08b8 address: implement Bech32 support 2018-03-13 14:48:01 +00:00
Tamas Blummer 77ce6f18d0 Moved blockchain and patricia_tree to rust-memblocks 2018-03-09 17:22:31 +01:00
Andrew Poelstra 047c0c149d remove `num` crate dependency 2018-02-18 15:21:13 +00:00
Andrew Poelstra f233fcac61 util: add `bip143` module to create BIP143 signature hashes 2018-01-15 17:54:32 +00:00
Andrew Poelstra 8f7bd858fb
update byteorder to 1.1 from 0.3 2017-07-28 16:19:44 +00:00
Andrew Poelstra 14af175a11 Resurrect BIP32 support 2016-06-24 19:15:57 +00:00
Andrew Poelstra 1e47019221 cargo-clippy cleanups 2016-06-21 14:35:27 +00:00
Andrew Poelstra 1dbd1c28dc Implement stdlib Error trait for util::Error type 2016-06-20 01:25:54 +00:00
Andrew Poelstra e58f536c31 Add `Decimal` type for de/serializing values 2015-11-22 10:51:19 -06:00
Andrew Poelstra 16e2a3519b Implement basic contract-hash support
Does not do stuff like validating the form of contracts, since this seems like
more of an application thing. Does not even distinguish a "nonce", just assumes
the contract has whatever uniqueness is needed baked in.
2015-10-14 15:29:19 -05:00
Andrew Poelstra 200e0fe8e3 Checkpoint commit
27 files changed, 3944 insertions(+), 3812 deletions(-) :} I've
started doing whitespace changes as well, I want everything to
be 4-space tabs from now on.
2015-04-06 20:51:11 -05:00
Andrew Poelstra 160f2f9ea6 Drop ThinVec, many other changes toward updating for librustc 2015-04-04 22:13:19 -05:00
Andrew Poelstra c3377032f8 Many syntax changes for rustc, incomplete 2015-01-18 17:39:51 -06:00
Andrew Poelstra 47c346be71 Add base58 decode/encode functionality 2014-08-24 23:03:47 -07:00
Andrew Poelstra a2ce000b2b Revamp Serializable interface to be similar to Encoder/Encodable
This is a massive simplification, fixes a couple endianness bugs (though
not all of them I don't think), should give a speedup, gets rid of the
`serialize_iter` crap.
2014-08-01 09:01:39 -07:00
Andrew Poelstra 8f826a959d Introduce `BitcoinResult`, use it instead of boolean returns in blockchain 2014-07-18 12:40:04 -07:00
Andrew Poelstra c9ad7c0b58 Initial commit, move into Cargo 2014-07-18 06:56:17 -07:00