Commit Graph

3873 Commits

Author SHA1 Message Date
Andrew Poelstra a7c2dc6bb6 Add some accessors to the `Privkey` structure 2015-12-02 10:58:18 -06:00
Andrew Poelstra 1bbd492da6 Add nonnegative() utility function to Decimal 2015-11-30 14:23:15 -06:00
Andrew Poelstra 2962eb9d44 Add Display impl for Decimal 2015-11-30 14:08:45 -06:00
Andrew Poelstra a9cd31ccba Add addition and subtraction impls to Decimal 2015-11-30 14:03:57 -06:00
Andrew Poelstra 21ccd713ba Add helper from_hex() function for Sha256dHash 2015-11-30 11:03:04 -06:00
Andrew Poelstra 950e756316 Add formatters for Sha256dHash 2015-11-30 09:19:53 -06:00
Andrew Poelstra 76729f33ca Fix `Decimal` serialization of negative numbers 2015-11-30 09:13:48 -06:00
Andrew Poelstra a8ffce4904 Fix Script de/serialization (version -> 0.4.4) 2015-11-30 07:11:24 -06:00
Andrew Poelstra 322f4740f1 Merge pull request #8 from schnupperboy/mempool-support
Added support for mempool messages
2015-11-24 11:27:00 -06:00
Julius Naperkowski 51f389e0b2 Bump minor version to 0.4.3 2015-11-23 18:31:50 +01:00
Julius Naperkowski 8c707c5bef Added support for mempool messages 2015-11-23 00:58:09 +01:00
Andrew Poelstra e58f536c31 Add `Decimal` type for de/serializing values 2015-11-22 10:51:19 -06:00
Andrew Poelstra c3c6983789 Replace serde_json with strason in tests 2015-11-22 09:46:05 -06:00
Andrew Poelstra fa59c35e9a Upgrade libsecp 2015-11-15 17:14:36 -06:00
Andrew Poelstra f9fc368ad9 Merge pull request #7 from laanwj/2015_10_plug_leak
Fix data leak in CommandString::consensus_encode
2015-11-07 21:04:42 -06:00
Wladimir J. van der Laan 404176a5ee Fix data leak in CommandString::consensus_encode
A fixed buffer of 12 bytes was unsafely copied from the bytes of a
string - if the string was shorter than that, memory from outside would
leak into the packet.

Replace the unsafe copy by a safe loop. Also add a panic if
an attempt is made to use a command string longer than 12 bytes.
2015-11-08 01:14:10 +01:00
Andrew Poelstra 66eb08aab5 [BREAKING CHANGE] Make `script::Builder` implement the actual Builder pattern
Rather than having methods taking &mut self, have them consume self
and return another Builder, so that methods can be chained.

Bump major version number.
2015-11-04 11:04:54 -06:00
Andrew Poelstra 5e03adc9aa Changes for cargo-clippy warnings 2015-10-28 11:27:23 -05:00
Andrew Poelstra 8daf06cc1d Update for latest libsecp: normalize signatures and use "lax DER" parsing 2015-10-26 14:39:25 -05:00
Andrew Poelstra 67c0b8fba7 More Error implementations 2015-10-25 12:55:48 -05:00
Andrew Poelstra a69ae2c7ad Bump minor version no 2015-10-25 10:17:23 -05:00
Andrew Poelstra 34edf48b93 Implement Error for base58 error type 2015-10-25 10:16:05 -05:00
Andrew Poelstra 3491c5057e Make contracthashtool check that the number of keys matches the template's requirement
This is easy to satisfy given that the template-to-script code takes a
slice of keys. Just do &keys[..n_keys] if you have too many keys. (If
you have too few you're SOL no matter what.) This way we can catch
likely configuration errors without putting much of a burden on users
who legitimately have more keys than the template requires.

Also add a method required_keys() to Template so that users can check
how many keys they ought to have.
2015-10-25 08:37:32 -05:00
Andrew Poelstra 125dde4cb0 Update README for recent changes 2015-10-24 15:26:01 -05:00
Andrew Poelstra 8defba2fb3 Expose ability to tweak secret keys for contract hash 2015-10-14 22:50:06 -05:00
Andrew Poelstra fdc854edd9 Remove Script() from LowerHex impl of Script
This is easy for downstream to add, not easy for them to remove. Plus scripts
have a pretty recognizable form and are usually obvious from context anyway.
2015-10-14 22:31:12 -05:00
Andrew Poelstra 38d2ef5d73 Add `from_script` method to Address for generating P2SH addresses 2015-10-14 22:24:09 -05:00
Andrew Poelstra ed34bb30f1 Add support for deserializing a script into a contracthash template
This is something Matt's contracthashtool does, so to copy its functionality
I need to support it. And it also seems generally useful.
2015-10-14 22:01:26 -05:00
Andrew Poelstra c1f81ea3c3 Add support for WIF private keys as well as addresses 2015-10-14 19:25:43 -05:00
Andrew Poelstra 16e2a3519b Implement basic contract-hash support
Does not do stuff like validating the form of contracts, since this seems like
more of an application thing. Does not even distinguish a "nonce", just assumes
the contract has whatever uniqueness is needed baked in.
2015-10-14 15:29:19 -05:00
Andrew Poelstra dba71d9253 [BREAKING CHANGE] Minor library updates
Breaking changes are:
    opcode::All::from_u8 is now From<u8>
    script::Builder::from_vec is now From<Vec<u8>>
    script::Script::from_vec is now From<Vec<u8>>
2015-10-14 09:14:09 -05:00
Andrew Poelstra eeb4655886 More updates for RFC 1214 2015-09-20 16:44:05 -05:00
Andrew Poelstra edb6d7b17b Bump version to 0.2 for all the changes of the last two days 2015-09-20 16:40:46 -05:00
Andrew Poelstra c67608a435 Remove `Sized` requirement from ConsensusEncodable 2015-09-20 15:34:13 -05:00
Andrew Poelstra 14db7ee902 Fix for rustc RFC 1214; also add missing docs 2015-09-20 15:30:18 -05:00
Andrew Poelstra 00421970a1 Fix for serde changes 2015-09-20 13:10:20 -05:00
Andrew Poelstra 835c8befae Fix versions in Cargo.toml to try and fix Travis builds 2015-09-20 12:37:47 -05:00
Andrew Poelstra 72e10265bb Add Travis status to README 2015-09-20 12:28:13 -05:00
Andrew Poelstra 99a4845719 Get library building on stable 2015-09-20 12:22:39 -05:00
Andrew Poelstra 2320f099c1 Remove broken wallet components
This was a fairly small change and gets all unit tests to pass.
2015-09-19 13:39:39 -05:00
Andrew Poelstra 0389eb1c52 Move secp256k1 lib from sipa's (long expired) repo to the bitcoin one 2015-05-20 13:14:21 -05:00
Andrew Poelstra adaf50a408 *** ALL TESTS PASS WITH RUSTC HEAD ***
There is still a lot of work to do modernizing the library, but the code
compiles cleanly with all unit tests passing now. Probably not much can
be done now until wizards-wallet is in better shape and the library is
actually in use.
2015-05-10 14:32:26 -05:00
Andrew Poelstra 4b1b1c4a74 Fix endianness problems with new librustc ipv6 addresses 2015-05-10 13:08:38 -05:00
Andrew Poelstra 2975c91e37 Remove pile of undefined (and bitrotted) code 2015-05-10 11:12:37 -05:00
Andrew Poelstra b21acd440e Get compiling for secp256k1 changes 2015-04-13 22:40:32 -05:00
Andrew Poelstra 17e27ec09f *** IT COMPILES ON RUSTC NIGHTLY ***
Many unit test failures, but this is progress.
2015-04-10 20:55:59 -05:00
Andrew Poelstra 3117f95b62 Checkpoint commit: into warnings! 2015-04-10 18:15:57 -05:00
Andrew Poelstra 1d78dccb9e Checkpoint commit -- we're onto move errors :D 2015-04-10 13:34:31 -05:00
Andrew Poelstra e658ffaeea Rename ScriptBuilder to Builder as per rustc rfc PR 1036 2015-04-09 23:23:56 -05:00
Andrew Poelstra 5350207ff3 Remove hamcrest; add rust-serde (not compiling right now) 2015-04-09 23:23:53 -05:00