Commit Graph

349 Commits

Author SHA1 Message Date
Kaz Wesley 0bfef68851 newtype implementation of opcodes::All
Removes unsafety when converting u8 -> All
2018-11-11 14:11:06 -08:00
Nadav Ivgi 18fcab6715 Detect compressed p2pk in script.is_p2pk() 2018-11-08 02:37:27 +02:00
Andrew Poelstra b8a72448df
Merge pull request #153 from rust-bitcoin/2018-08-segwit-ambiguity
transaction: make 0-input de/serialization always use Segwit
2018-11-03 15:29:51 +00:00
Andrew Poelstra c2146e1bbc
Merge pull request #181 from stevenroose/export-network
Export network::constants::Network
2018-10-23 16:18:30 +00:00
Andrew Poelstra 7813c0ae3d
Merge pull request #178 from stevenroose/wif
Add explicit WIF methods for Privkey
2018-10-22 15:28:09 +00:00
Steven Roose 5f912bdeae Implement Debug for PrivKey
It returns a fixed string to prevent accidental data leakage.
2018-10-22 00:06:46 +01:00
Steven Roose f7b95c7533 Add explicit WIF methods for Privkey 2018-10-22 00:05:59 +01:00
Steven Roose 6f4bfe68f3 Export network::constants::Network 2018-10-21 23:28:27 +01:00
Andrew Poelstra 0764673c38
Merge pull request #177 from stevenroose/outpoint-fromstr
Implement FromStr for OutPoint
2018-10-18 23:12:47 +00:00
Steven Roose fefd5d4fe2 Implement FromStr for OutPoint 2018-10-18 12:37:02 +01:00
Andrew Poelstra 11a2783235 add comment expanding on the segwit ambiguity 2018-10-10 02:45:09 +00:00
Andrew Poelstra a181a523c6 remove special case for 0-input 0-output transaction deserialization
This creates two ways to encode an empty transaction; we should use only the
Segwit-enabled one because that's what we do for 0-input non-0-output transactions.
2018-10-10 02:03:08 +00:00
Jeff Barg 1c2564fc08 Added example for creating an address from a public key
Added an example to the address rustdoc (addresses https://github.com/rust-bitcoin/rust-bitcoin/issues/160)
2018-09-29 17:43:28 -04:00
evgeniy.scherbina bc41772f89 added p2wkh, p2sh-p2wkh tests 2018-09-27 18:54:20 +03:00
Andrew Poelstra 98e39b4383 transaction: make 0-input de/serialization always use Segwit 2018-09-27 13:50:35 +00:00
Carl Dong c42252c1da Use default impl for Encoder for Sha256dEncoder 2018-09-25 21:20:24 +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 8e0e4eb55a Move serialize::BitcoinHash to util:#️⃣:BitcoinHash
- Use Sha256dEncoder for calculating merkle root
- Remove BitcoinHash implementation for Vec<u8>
2018-09-25 21:19:10 +08:00
Carl Dong 97937b1b5f Move network::consensus_params to consensus::params 2018-09-25 21:13:34 +08:00
Carl Dong 7e9d393d03 Remove low-level networking support
- Modify VersionMessage constructor to take in parameters directly that
  would have otherwise been extracted from a Socket (now removed)
2018-09-25 21:13:34 +08:00
Carl Dong 7f11766c65 Remove nu_select macro 2018-09-25 21:13:34 +08:00
Thomas Eizinger 50e3a4abf2 Add FromStr for Sha256dHash
The FromStr implementation just delegates to the `from_hex` method for
the actual parsing.
2018-09-20 12:18:45 +10:00
Steven Roose 8edfbec1cb Implement serde serialiation for Address 2018-09-11 18:37:36 +01:00
Andrew Poelstra 849674651f
Merge pull request #157 from rust-bitcoin/2018-08-pub-use
`pub use` a ton of stuff at the top level
2018-08-28 17:13:40 +00:00
Andrew Poelstra 97c1773ec9 `pub use` a ton of stuff at the top level 2018-08-28 15:57:46 +00:00
Andrew Poelstra fe99a88acf
Merge pull request #152 from rust-bitcoin/2018-08-script-ord
impl PartialOrd, Ord for Script
2018-08-26 15:38:43 +00:00
Andrew Poelstra b33aa6fa6c add unit test for script ordering 2018-08-25 22:09:22 +00:00
Andrew Poelstra ef642295c5 encodable: reject non-compact VarInts on Vec and Box<[T]> lengths 2018-08-24 20:31:46 +00:00
Andrew Poelstra f0221fb79b transaction: reject transactions with Segwit byte set but no witnesses 2018-08-24 19:57:58 +00:00
Andrew Poelstra 68413d306d impl PartialOrd, Ord for Script 2018-08-24 02:20:37 +00:00
Andrew Poelstra 08db6fe29f script: let Instructions iterator enforce minimal pushes; remove `IntoIter` impl to force users to choose 2018-08-22 19:55:31 +00:00
Andrew Poelstra dbefaef25c
Merge pull request #142 from jeandudey/2018-08-decimal-fromstr
Implement `FromStr` for `UDecimal`/`Decimal`.
2018-08-22 19:00:02 +00:00
Jean Pierre Dudey 9cdc75a930 Forbid exponents larger than 18.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-22 14:00:30 -04:00
Jean Pierre Dudey 6902bf826c Fix negative symbol bug in `FromStr` display implementation.
The negative symbol wasn't there when `int_part` was equal to zero.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-22 11:26:05 -04:00
Jean Pierre Dudey a915bc194d Fix multiplication logic in decimal parsing functions.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-22 07:22:47 -04:00
Jean Pierre Dudey e48e559740 Fix `UDecimal::parse_udecimal` identation.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-21 21:31:02 -04:00
Jean Pierre Dudey 455bc66d3c Fix parsing for numbers that are too big to fit in a `Decimal`/`UDecimal`.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-21 21:29:07 -04:00
Andrew Poelstra a61ad5d382
Merge pull request #137 from dongcarl/2018-8-better-errors
Fix Error type for SimpleDecoder and SimpleEncoder
2018-08-22 00:55:54 +00:00
Jean Pierre Dudey 07838568f9 Implement `FromStr` for `Decimal`/`UDecimal`.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-21 16:13:58 -04:00
Andrew Poelstra d16fdd63d3
Merge pull request #141 from jeandudey/2018-08-display
Implement `Display` instead of `ToString` for `Address` and `PrivKey`.
2018-08-21 16:41:58 +00: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 d12a861f85 Remove unnecessary network::Error::Detail variant 2018-08-21 01:58:40 -07:00
Carl Dong 95303a1d28 Use full path in macros to to eliminate uses 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 df7f084e96 Implement `Display` instead of `ToString` for `Address` and `PrivKey`.
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-08-20 19:46:56 -04:00
Andrew Poelstra 77e2fe3dda
Merge pull request #144 from jeandudey/2018-08-address-starts-with
trivial: Use `str::starts_with` method to check bech32 address prefixes.
2018-08-20 23:12:03 +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