Commit Graph

1225 Commits

Author SHA1 Message Date
Andrew Poelstra 65d8bda73b
Merge rust-bitcoin/rust-bitcoin#633: Document cargo features
95fb4e01f9 Document cargo features (Martin Habovstiak)

Pull request description:

  This documents cargo features in two ways: explictly in text and in code
  using `#[doc(cfg(...))]` attribute where possible. Notably, this is
  impossible for `serde` derives. The attribute is contitional and only
  activated for docs.rs or explicit local builds.

  This change also adds `package.metadata.docs.rs` field to `Cargo.toml`
  which instructs docs.rs to build with relevant features and with
  `docsrs` config activated enabling `#[doc(cfg(...))] attributes.

  I also took the opportunity to fix a few missing spaces in nearby code.

  Notes for reviewers:

  * To build and look at result locally run: `RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --features std,secp-recovery,base64,rand,use-serde,bitcoinconsensus --open` (don't confuse `RUSTDOCFLAGS` with `RUSTFLAGS` - took me a while to figure that out 😞)
  * You should see needed features being called out - e.g. in `Script::verify`
  * More information and some screenshots: https://github.com/rust-lang/cargo/issues/8103#issuecomment-653154049
  * For an example why this matters see: https://github.com/Kixunil/loptos/issues/1 😉
  * Serde issue: https://github.com/serde-rs/serde/issues/2063

ACKs for top commit:
  dr-orlovsky:
    ACK 95fb4e01f9
  apoelstra:
    ACK 95fb4e01f9

Tree-SHA512: 4d6428bfa05cbeb2d8737f0239aa1836b5f36f4b040e1ac5e0862663c4ea783711d122182dd8313913fd593ab224915bd8def5e268b272215bee2c9856a27674
2021-09-14 16:03:13 +00:00
Martin Habovstiak 95fb4e01f9 Document cargo features
This documents cargo features in two ways: explictly in text and in code
using `#[doc(cfg(...))]` attribute where possible. Notably, this is
impossible for `serde` derives. The attribute is contitional and only
activated for docs.rs or explicit local builds.

This change also adds `package.metadata.docs.rs` field to `Cargo.toml`
which instructs docs.rs to build with relevant features and with
`docsrs` config activated enabling `#[doc(cfg(...))] attributes.

I also took the opportunity to fix a few missing spaces in nearby code.
2021-09-14 12:24:57 +02:00
Andrew Poelstra 57d7baf05b
Merge rust-bitcoin/rust-bitcoin#580: Add Bloom filter network messages
894f0f09b6 Add Bloom filter network messages (Ben Carman)

Pull request description:

  Adds initial support for parsing the `merkleblock`, `filterload`, `filteradd` and `filterclear` network messages.

  https://developer.bitcoin.org/reference/p2p_networking.html#filteradd

  https://developer.bitcoin.org/reference/p2p_networking.html#filterclear

ACKs for top commit:
  dr-orlovsky:
    ACK 894f0f09b6
  apoelstra:
    ACK 894f0f09b6

Tree-SHA512: 6483457faf4e63fad0c9ac52b473c37fb04ad28ec60c92e5c3b5be7472d02fd873cbccfe387799002d1862b88bcdc2ded3a7b03349f3ac8fd591942dae005e6d
2021-09-13 21:36:28 +00:00
Ben Carman 894f0f09b6
Add Bloom filter network messages
Co-authored-by: jrawsthorne <jake@jakerawsthorne.co.uk>
2021-09-13 15:08:38 -05:00
Sanket Kanjalkar 9710728d89
Merge pull request #651 from LNP-BP/fix/amount-sum-nostd 2021-09-13 06:04:23 -07:00
Dr Maxim Orlovsky d20669522e
Fixing no_std for Amount sum iterator 2021-09-13 10:36:07 +02:00
Dr. Maxim Orlovsky b2c8a7ebc1
Merge pull request #615 from sgeisler/2021-06-sum-amounts
Implement `Sum` for amount types
2021-09-11 00:11:15 +02:00
Dr. Maxim Orlovsky 697e8f5194
Merge pull request #626 from visvirial/impl-vsize
Implement `Block.get_strippedsize()` and `Transaction.get_vsize()`
2021-09-11 00:09:22 +02:00
Andrew Poelstra 13a6c3b4d6
Merge rust-bitcoin/rust-bitcoin#625: Improvements to Error types (part 4)
994079b099 Refactoring error variants: removing unused; better names & inner types (Dr Maxim Orlovsky)

Pull request description:

  Removes controversial aspects from #560 (all `io::Error`-related changes) and leaves the rest

ACKs for top commit:
  sanket1729:
    ACK 994079b099
  apoelstra:
    ACK 994079b099

Tree-SHA512: 020e49193c885e862f45e5f7baabf1d22a3ec09e78fd7f573b2f3d327beb4f91683951ba080b3d804e8337a188dcad0f38ba70ee8059aef0681a0b2bba0a2140
2021-09-08 21:22:32 +00:00
Andrew Poelstra 2a655f4b58
Merge pull request #617 from LNP-BP/feat/witness-version
WitnessVersion type
2021-09-08 20:58:57 +00:00
Sanket Kanjalkar bd5d875e8a
Merge pull request #623 from RCasatta/fixdoc
Fix documentation referencing macro var
2021-08-12 18:38:07 -07:00
Dr Maxim Orlovsky ecc400826c
Updating Script::is_witness_program to use new WitnessVersion 2021-08-10 10:34:15 +02:00
Dr Maxim Orlovsky 64c1ec0b76
WitnessVersion type 2021-08-10 10:34:15 +02:00
Dr. Maxim Orlovsky 4e3c2c32fc
Merge pull request #632 from tcharding/prefixes 2021-08-09 23:26:15 +02:00
Dr. Maxim Orlovsky 8ae030b951
Merge pull request #618 from elsirion/possible_networks 2021-08-09 23:25:06 +02:00
Dr. Maxim Orlovsky 33393e0bf4
Merge pull request #621 from RCasatta/verify_with_amount 2021-08-09 23:23:09 +02:00
Dr. Maxim Orlovsky 808e1708c3
Merge pull request #596 from RCasatta/script_ser 2021-08-09 23:22:06 +02:00
Dr. Maxim Orlovsky 310f4eb769
Merge pull request #640 from RCasatta/fix_date
fix changelog date
2021-08-08 15:16:10 +02:00
Riccardo Casatta c3305384b9
fix changelog date 2021-08-06 20:30:38 +02:00
Dr Maxim Orlovsky 994079b099
Refactoring error variants: removing unused; better names & inner types 2021-08-01 21:08:39 +02:00
Dr. Maxim Orlovsky 425b528e41
Merge pull request #634 from Kixunil/remove-fuzztarget 2021-08-01 18:30:03 +02:00
Martin Habovstiak a291fee23c Removed fuzztarget feature
It seems to be unused and when there's a need for it it's better to use
`--cfg fuzzing` as in `rust-secp256k1 ` and `bitcoin_hashes`.
2021-07-29 08:13:25 +02:00
Tobin Harding adc1543e7c
Use consts for address prefix values
Instead of using magic numbers we can define constants for the address
prefix bytes. This makes it easier for future readers of the code to see
what these values are if they don't know them and/or see that they are
correct if they do know them.
2021-07-22 10:31:14 +10:00
Andrew Poelstra 5098011416
Merge pull request #631 from RCasatta/bump_027
Bump version to 0.27.0
2021-07-21 20:42:17 +00:00
Riccardo Casatta ef69f24fed
Bump version to 0.27.0 2021-07-21 08:53:51 +02:00
Andrew Poelstra df4d70a37e
Merge pull request #627 from RCasatta/bigendian
Bigendian fixes and CI test
2021-07-20 20:56:16 +00:00
Andrew Poelstra 5e6b56aba4
Merge pull request #603 from devrandom/no_std_devrandom
no_std support, keeping MSRV
2021-07-20 16:40:18 +00:00
Devrandom bba57d7d69 Embedded test via qemu 2021-07-15 09:04:49 +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
Riccardo Casatta 11d5a30f86
comment only: explain reason for swap bytes 2021-07-02 12:05:09 +02:00
Riccardo Casatta 95460f5e3c
Add cross testing on big-endian architecture 2021-06-30 10:14:15 +02:00
Riccardo Casatta 0f4d2cfcaa
swap bytes in network code instead of swapping only in little-endian 2021-06-29 16:01:34 +02:00
Riccardo Casatta 8996249f2d
remove {to/from}_le from impl_int_encodable
they are a noop on little-endian and the following {to/from}_array_le are sufficient to deal with big-endian
2021-06-29 15:57:31 +02:00
Vis Virial cdf7be4765
Add extra checks for `test_segwit_transaction()`. 2021-06-29 07:59:22 +09:00
Vis Virial 2bda871628
Remove `#[inline]` from `Transaction.get_strippedsize()`. 2021-06-29 07:40:13 +09:00
Vis Virial c9dead410a
Implement `Transaction.get_strippedsize()`.
`Block.get_strippedsize()` is also simplified and optimized.
2021-06-29 07:34:37 +09:00
Vis Virial 1bf9147a6e
Optimize `Transaction.get_vsize()` (thanks @TheBlueMatt). 2021-06-29 07:14:01 +09:00
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
elsirion 94229ae964 Implement is_valid_for_network function for Address 2021-06-26 19:34:33 +02:00
Riccardo Casatta 8f27579c7f
fix documentation referencing macro var 2021-06-25 09:56:40 +02:00
Sebastian Geisler 4dae56908b Seal `CheckedSum` 2021-06-23 15:14:24 +02:00
Riccardo Casatta a86bced568
use Amount type in verify 2021-06-21 14:43:09 +02:00
Andrew Poelstra abff973e83
Merge pull request #601 from LNP-BP/feat/bech32m-1
Bech32m adoption
2021-06-18 21:14:12 +00:00
Sebastian e334c9deea
Merge pull request #616 from sgeisler/2021-06-dust-value-amount
Use `Amount` type for dust value calculation
2021-06-16 20:51:23 +02:00
Riccardo Casatta 4a4460b1a3
Add test for script serialize/deserialize 2021-06-16 10:17:56 +02:00
Riccardo Casatta fadd368911
use different ser/de for Script in case of non human readable format 2021-06-16 10:17:40 +02:00
Dr Maxim Orlovsky aa5c36df12
Covering all BIP-173 and BIP-350 test vectors 2021-06-16 08:43:18 +02:00
Sebastian b0ae2a6842
Merge pull request #521 from RCasatta/errors_enum
Errors enum improvements
2021-06-15 14:01:56 +02:00
Matt Corallo e99177c4fb
Merge pull request #614 from devrandom/2021-06-nostd1
std -> core
2021-06-14 21:45:48 +00:00