Commit Graph

18 Commits

Author SHA1 Message Date
sanket1729 e5acc07789
Merge rust-bitcoin/rust-bitcoin#1040: Introduce rustfmt in a non-invasive manner
ee9a3ec6a1 Enable formatter for "src" (Tobin C. Harding)
743b197124 Add use for Unexpected (Tobin C. Harding)
fd217e72c3 Use f instead of formatter (Tobin C. Harding)
7b50a96ade Do not format prelude module (Tobin C. Harding)
01471f7e65 Shield hash_newtypes from rustfmt (Tobin C. Harding)
65d19d9044 Refactor compile_error message (Tobin C. Harding)
6461e2db8d Run formatter on examples/ (Tobin C. Harding)
fd1c6589ba Add a rustfmt configuration file with explicit ignores (Tobin C. Harding)

Pull request description:

  Looks like we are getting to a place that rustfmt _might_ be able to be used. In an effort to introduce `rustfmt` without requiring devs to do excessively mundane reviews introduce `rustfmt` in a non-invasive manner. What this means is

  - Add a fully fleshed out `rustfmt` config file that explicitly ignores all the source files
  - Enable sections of code one by one so review is easier (including preparatory patches before doing each section).

  This PR currently does `examples` and all the source files at the root level of the crate (i.e. excludes all directories in `src/`). The other directories can then be done one at a time.

  Please see discussion on: https://github.com/rust-bitcoin/rust-bitcoin/pull/959 for more context.

ACKs for top commit:
  sanket1729:
    ACK ee9a3ec6a1
  apoelstra:
    ACK ee9a3ec6a1

Tree-SHA512: f4ff3c031b5d685777e09bac2df59ed8217576b807da7699f44fe00aa509d0b7fe47617a8b3eff00d3125aeece3e010b8f9dd8733d315ccb2adc0e9a7d7f07e3
2022-07-19 13:38:28 -07:00
Tobin C. Harding 6461e2db8d Run formatter on examples/
Remove "examples" from the rustfmt ignore list.
2022-07-19 13:43:12 +10:00
Tobin Harding 6967c0ed6f Add psbt example
Add an example PSBT workflow. The workflow we simulate is that of a
setup using a watch-only online wallet (contains only public keys) and a
cold-storage wallet (contains the private keys).

We create and update a PSBT using the watch-only wallet then pass the
PSBT to the cold-storage wallet to sign.

Co-authored-by: Dan Gould <d@ngould.dev>
2022-07-19 10:59:48 +10:00
KaFai Choi bb70820fed
improve example: take hex-encoded seed instead of WIF in bip32 example 2022-01-10 06:59:49 +07:00
Dr Maxim Orlovsky e6a3d603c9 BIP32 extended key `to_ecdsa()` and `to_schnorr()` methods 2022-01-09 07:17:02 +01:00
Dr Maxim Orlovsky b72f56c4ae BIP32 extended keys are using Scep256k1 keys instead of bitcoin ECDSA
According to #588, BIP32 does not support uncompressed keys and using type with compression flag is a mistake
2022-01-09 07:16:49 +01:00
Riccardo Casatta 5dfb93df71
Deprecate StreamReader
StreamReader before this commit is trying to repeatedly parse big object like
blocks at every read, causing useless overhead.
consensus_encode deal with partial data by simply blocking.

After this changes it doesn't look what remain of the StreamReader is really giving
value, so it's deprecated
2021-12-31 10:44:14 +01: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
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
Margarita Kitic 1278e68611 add bip32 example 2020-10-17 10:54:14 +02:00
Elias Rohrer 827d98d821 Fixed for rust 1.22.0. 2020-03-03 12:18:37 +01:00
Elias Rohrer aa46618da7 Intialize stream reader only once. 2020-03-03 10:48:01 +01:00
Elias Rohrer 40431f3d4f Formatted. 2020-03-03 10:48:01 +01:00
Elias Rohrer b5f5abe0b4 Removed pre-configured IP, now takes IP as argument. 2020-03-03 10:48:01 +01:00
Elias Rohrer 62f5f8e3f9 Removed explicit dependency on rand. 2020-03-03 10:48:01 +01:00
Elias Rohrer 2852083ff3 Using write_all(). 2020-03-03 10:48:01 +01:00
Elias Rohrer c4f0056856 No clone needed. 2020-03-03 10:48:01 +01:00
Elias Rohrer 9d212da0ba Added a simple handshake example. 2020-03-03 10:48:01 +01:00