Commit Graph

470 Commits

Author SHA1 Message Date
Andrew Poelstra 3a2e1ce09e
Merge pull request #143 from jeandudey/2018-08-c-conv
Use `as_`,`to_`,`into_` conventions for array types.
2018-08-20 23:11:11 +00:00
Jean Pierre Dudey b78d7a7428 Use `str::starts_with` method to check bech32 address prefixes.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-20 18:11:14 -04:00
Jean Pierre Dudey 4dfb98bd70 Use `as_`,`to_`,`into_` conventions for array types.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-20 17:20:43 -04:00
Andrew Poelstra 2d961412af
Merge pull request #139 from jeandudey/2018-08-18-outpoint
Rename `TxOutRef` to `OutPoint` and use it in `TxIn`.
2018-08-20 18:18:00 +00:00
Andrew Poelstra ec47b798fe
Merge pull request #125 from jeandudey/2018-08-11-serde-shim
Update to serde 1.0
2018-08-20 18:04:47 +00:00
Jean Pierre Dudey 32631e44ad Rename `TxOutRef` to `OutPoint` and use it in `TxIn`.
Previously this structure was unused, it's now being used by the `TxIn`
structure to simplify the code a little bit and avoid confusions. Also
the rust-lightning source code has an `OutPoint` similar to this one
but with the `vout` index as an `u16` to avoid unsafe conversions.

I've added to new methods to `OutPoint`:

- `null`: Creates a new "null" `OutPoint`.
- `is_null`: Checks if the given `OutPoint` is null.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-20 13:46:10 -04:00
Jean Pierre Dudey 1b4aba1d80 Update serde to 1.0 and strason to 0.4
The `serde_struct_impl!` macro has been modified to be compatible
with the serde 1.0 crate, we use this macro and not the `serde_derive`
crate because the latter doesn't support Rust 1.14.0 which is shipped
on Debian stable and we should remain compatible with it.

Two new features were added:

- "serde": enables serialization/deserialization for common types, it pulls
the serde 1.0 dependency.
- "serde-decimal": enables serialization/deserialization for `UDecimal`/`Decimal`,
this pulls the strason 0.4 depdendency and the serde 1.0 dependency.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-20 13:42:34 -04:00
Andrew Poelstra 84040caa70
Merge pull request #113 from rust-bitcoin/2018-07-secp-0.10.0
update to secp256k1 0.10.0
2018-08-20 16:05:09 +00:00
Andrew Poelstra 94f3d4b0f9 update to secp256k1 0.10.0 2018-08-20 15:28:43 +00:00
Andrew Poelstra 85ddb66be0
Merge pull request #138 from dongcarl/2018-8-usize-fix
Fix compilation warning when comparing usize and u64 on 32-bit arch
2018-08-20 14:11:26 +00:00
Andrew Poelstra dca4cb4d54
Merge pull request #95 from alekseysidorov/impl-standard-traits
Added Ord and Hash implementations for the Address type
2018-08-20 14:10:05 +00:00
Aleksei 356d13e465 Add some useful standard trait implementations 2018-08-20 12:11:17 +03:00
Carl Dong 9da96e1d46 Fix compilation warning when comparing usize and u64 on 32-bit arch 2018-08-17 10:08:56 -07:00
Andrew Poelstra 6c82001ead
Merge pull request #128 from jeandudey/2018-08-12-bitcoinconsenus
Remove unused "bitcoinconsenus" feature.
2018-08-15 20:55:51 +00:00
Andrew Poelstra a1c9a25d07
Merge pull request #133 from romanz/master
Remove variable shadowing in listener.rs
2018-08-15 20:52:56 +00:00
Roman Zeyde fdbccf055d
Remove variable shadowing in listener.rs 2018-08-15 09:43:35 +03:00
Andrew Poelstra 14f5db070a
Merge pull request #132 from dongcarl/deserialize-fix
Ready for Review: Make deserialize error if input bytes not consumed
2018-08-15 01:35:21 +00:00
Carl Dong 70203831d6 Make deserialize error if input bytes not consumed
- Adjust tests in encodable.rs to account for this change
2018-08-14 16:50:33 -07:00
Andrew Poelstra bf9c749b0c
Merge pull request #129 from dongcarl/bip32-derive-test
Ready for Review: Add derive_* methods to Extended*Key
2018-08-13 20:52:07 +00:00
Carl Dong 60577f286d Add derive_* methods to Extended*Key
- Add derive_pub to ExtendedPubKey
- Add derive_priv to ExtendedPrivKey
- Removed from_path from ExtendedPrivKey as it is superseded by
  derive_priv
- Add checking of derive_pub and derive_priv to test_path
- Add checking of correct error when invoking ckd_pub on a hardened
  ChildNumber
- Add test vector 3 from BIP32 specification
2018-08-12 17:16:33 -07:00
Andrew Poelstra bc7125e955
Merge pull request #119 from jeandudey/2018-08-08-try-op
Remove `try!` macro usage and use the `?` operator instead.
2018-08-12 23:44:43 +00:00
Andrew Poelstra c16ae47871
Merge pull request #127 from jeandudey/2018-08-12-c-hidden
Hidde `From<T>` implementations for error types in Rustdoc.
2018-08-12 23:43:01 +00:00
Jean Pierre Dudey f918311b8a Remove unused "bitcoinconsenus" feature.
Also I've updated the feature name on the README.md, and fixed a typo in
src/blockdata/script.rs

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-12 16:06:06 -04: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 b2594087db Use the `?` (try) instead of the `try!` macro.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-12 12:47:31 -04:00
Andrew Poelstra 24c0f1a3fc
Merge pull request #118 from jeandudey/2018-08-08-bip32-tostring
Implement `Display` trait instead of implementing `ToString` directly.
2018-08-12 13:48:39 +00:00
Andrew Poelstra 147259d957
Merge pull request #126 from dongcarl/bip32-consistency
Ready for Review: Improve consistency for bip32::ChildNumber
2018-08-11 23:38:41 +00:00
Carl Dong c485a74c09 Add helper methods is_normal, is_hardened
- Fix documentation links
2018-08-11 13:29:10 -07:00
Carl Dong 4a5bf52ed9 Improve consistency for bip32::ChildNumber
There seemed to be some confusion as to whether the internal
represenation of a ChildNumber is supposed to be the index (0..2^31-1
for _both_ Normal and Hardened) or the actual number (0..2^31-1 for
Normal and 2^31..2^32-1 for Hardened). This commits fixes this
confusion.

- Make clear that the internal representation is the index rather
  than the actual number
- Make the internal representation non-public
- Provide methods for creating valid ChildNumbers
- Change relevant callers and tests to conform to this new ChildNumber

My rationale for using index rather than the actual number as internal
representation is that the difference between the two enum variants
already encode wether a ChildNumber is a normal one or a hardened one,
so the only bit of extra information left to be encoded is its index.
2018-08-11 12:46:46 -07:00
Andrew Poelstra ebe5133d1a
Merge pull request #110 from D4nte/regtest
Regtest bech32 address support
2018-08-11 17:21:12 +00:00
Andrew Poelstra 259c5902f1
Merge pull request #116 from jeandudey/2018-08-08-module-docs
Fix modules documentation title.
2018-08-11 17:12:50 +00:00
Andrew Poelstra ee9802d813
Merge pull request #120 from dpc/from_secret_key-doc-fix
Simple doc fix for `from_secret_key`
2018-08-11 17:05:29 +00:00
Andrew Poelstra e17c280e4f
Merge pull request #121 from jeandudey/2018-08-10-network
Refactor and add more documentation for the `Network` type.
2018-08-11 16:52:52 +00:00
Andrew Poelstra 6c53593d5f
Merge pull request #122 from dongcarl/childnumber-fixes
Add conversion between u32 and ChildNumber, fix docs
2018-08-10 22:46:22 +00:00
Carl Dong d4f28b6785 Add conversion between u32 and ChildNumber, fix docs 2018-08-10 13:49:45 -07:00
Jean Pierre Dudey 7ecb6b9dea Refactor and add more documentation for the `Network` type.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-10 14:56:19 -04:00
Dawid Ciężarkiewicz 1646a80f77 Simple doc fix for `from_secret_key` 2018-08-09 15:41:48 -07:00
Jean Pierre Dudey 0225b530cc Implement `Display` trait instead of implementing `ToString` directly.
ExtendedPubKey and ExtendedPrivKey implemented `ToString` directly but
Rust documentation says to implement `Display` and get the `ToString`
implementation for free.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-08 19:11:16 -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
Andrew Poelstra 45c699f005
Merge pull request #112 from TheBlueMatt/2018-07-p2wsh-name
Clarify to_v0_p2wsh docs a bit further
2018-07-28 18:28:00 +00:00
Andrew Poelstra cdb7ca83c9
Merge pull request #107 from savil/remove-rustc-serialize
[code hygiene] remove deprecated rustc-serialize
2018-07-28 18:24:50 +00:00
Matt Corallo 3686cd7201 Clarify to_v0_p2wsh docs a bit further 2018-07-26 15:13:44 -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
Franck Royer f05f831569 Regtest has a longer hrp, need to adjust length safety check 2018-07-26 17:06:35 +10:00
Franck Royer 0f31608796 Add support for bech32 regtest address format 2018-07-26 10:51:37 +10:00
Franck Royer ba2879cfac Add test for regtest network 2018-07-26 10:51:15 +10:00
Andrew Poelstra f7ab3241a7
Merge pull request #109 from dongcarl/patch-1
Fix to_v0_p2wsh docs
2018-07-26 00:42:24 +00:00
Carl Dong db76a63669
Fix to_v0_p2wsh docs 2018-07-25 17:11:27 -07:00
Andrew Poelstra a7aff1372e
Merge pull request #100 from sgeisler/bech32-v0.6.1
Use bech32 v0.8.0
2018-07-25 21:24:26 +00:00
Sebastian Geisler 00cca03edd use bitcoin-bech32 v0.8.0 and adapt internal API usage 2018-07-25 21:09:46 +02:00