Commit Graph

2792 Commits

Author SHA1 Message Date
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
Andrew Poelstra 9ab2aa52fd
Merge pull request #101 from tamasblummer/is_op_return
check if output is OP_RETURN
2018-06-23 15:19:18 +00:00
Tamas Blummer caeadb42be check if output is OP_RETURN 2018-06-23 14:49:55 +02:00
Igor Aleksanov 2ff5f8e51e Added module with consensus parameters (#93) 2018-06-23 10:23:34 +02:00
Andrew Poelstra 93d426db2e
Merge pull request #99 from rust-bitcoin/2018-06-revert-pr-84
Reverts #84, bumps Cargo minor version number, and re-adds #84
2018-06-22 16:12:53 +00:00
Igor Aleksanov 7988b78c1f Added regtest
Completed regtest integration to the code

Added tests for regtest

Get rid of panics
2018-06-16 22:56:32 +00:00
Andrew Poelstra 5c753fb517 Bump version to 0.13.2 2018-06-16 22:55:27 +00:00
Andrew Poelstra bc5cb3bc31 Revert "Added regtest"
This reverts commit 34e228c699.
2018-06-16 22:55:12 +00: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
Andrew Poelstra 18460e347e
Merge pull request #97 from romanz/master
Fix 2 small typos in comments
2018-06-10 21:09:15 +00:00
Roman Zeyde 69ea2a760b
Fix 2 small typos in comments 2018-06-09 22:27:40 +03:00
Andrew Poelstra 6dc2ad86f0
Merge pull request #92 from rust-bitcoin/version-0.13.1
bump version to 0.13.1
2018-06-04 21:02:20 +00:00
Andrew Poelstra 2db9aeab2d bump version to 0.13.1 2018-06-04 19:29:59 +00:00
Andrew Poelstra 62d080afc7
Merge pull request #83 from tamasblummer/is_coinbase
add is_coin_base
2018-06-04 18:46:03 +00:00
Andrew Poelstra dd176b4177
Merge pull request #84 from popzxc/add-regtest
Added regtest network
2018-06-04 18:42:05 +00:00
Andrew Poelstra fb0c782df6
Merge pull request #89 from tamasblummer/wittness_block
add witness inv types
2018-06-04 18:34:28 +00:00
Andrew Poelstra 33261c7a12
Merge pull request #91 from TheBlueMatt/master
Check in fuzz inputs for all current targets
2018-06-04 18:32:19 +00:00
Andrew Poelstra eebd185a01
Merge pull request #90 from TheBlueMatt/merkle-expose
Expose merkleroot(Vec<Sha256dHash>) publicly
2018-06-04 18:15:35 +00:00
Matt Corallo 63765a2467 Check in good fuzzing starting points for current fuzz targets 2018-06-04 10:36:48 -04:00
Matt Corallo e2403a37fa Don't try to do a base58 checksum if an address is excessively long 2018-06-04 10:23:55 -04:00
Matt Corallo dab2f0b6b6 Switch fuzztarget SHA256 to simply XOR'ing all input bytes 2018-06-04 10:23:26 -04:00
Tamás Blummer 47b2364554
Merge branch 'master' into wittness_block 2018-06-04 04:24:51 +02:00
Matt Corallo b78ab0f60b Expose merkleroot(Vec<Sha256dHash>) publicly
In a project of mine I needed to check the merkle root before
moving some Vec<Transaction>s around, so need to be able to
calculate the merkle root on a Vec<Sha256dHash> directly.
2018-06-01 18:50:31 -04:00
Tamas Blummer 3921899c65 add is_coin_base
add data access as copy
2018-06-01 21:39:51 +02:00
Igor Aleksanov 97908ea058 Merge branch 'master' into add-regtest 2018-05-29 12:21:56 +03:00
Igor Aleksanov 34e228c699 Added regtest
Completed regtest integration to the code

Added tests for regtest

Get rid of panics
2018-05-29 12:21:41 +03:00
Igor Aleksanov 881972b2a5 Fix multiplication for uint256 (#88) 2018-05-28 20:41:07 +02:00
Tamas Blummer 9f2d737045 add witness inv types 2018-05-28 15:24:35 +02:00
Andrew Poelstra feec1cae70
Merge pull request #87 from petertodd/2018-05-remove-cargo-instructions
Remove cargo usage from README
2018-05-27 15:45:07 +00:00