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
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
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
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
Carl Dong
db76a63669
Fix to_v0_p2wsh docs
2018-07-25 17:11:27 -07:00
Sebastian Geisler
00cca03edd
use bitcoin-bech32 v0.8.0 and adapt internal API usage
2018-07-25 21:09:46 +02: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
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
Roman Zeyde
69ea2a760b
Fix 2 small typos in comments
2018-06-09 22:27:40 +03: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
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
Tamás Blummer
cf4024beb4
Merge branch 'master' into hotfix-network-from-str-err
2018-05-20 11:32:19 +02:00
Andrew Poelstra
ab96df162a
Merge branch 'master' into data-method-in-impl-array-newtype
2018-05-19 17:29:53 +00:00
Aleksey Sidorov
5771841144
Replace serde error with the io error.
2018-05-18 12:08:11 +03:00
Igor Aleksanov
13f1fe1f08
Merge branch 'master' into data-method-in-impl-array-newtype
2018-05-17 19:07:08 +03:00
Andrew Poelstra
cc23f09b10
Merge branch 'master' into improve-network-constant
2018-05-17 15:00:35 +00:00
Igor Aleksanov
582afb1611
Added impl display for uint
2018-05-16 13:13:48 +03:00
Igor Aleksanov
539a74de12
Added test for Sha256dHash::data()
2018-05-16 12:44:30 +03:00
Igor Aleksanov
5df8893ea1
Macro impl_array_newtype now generates method for representing data as array
2018-05-16 12:34:36 +03:00
Aleksei Sidorov
3224cf2b18
Implement `FromStr` for Network constant
2018-05-16 12:22:07 +03:00
Roman Zeyde
44d0ad90e9
block: fix a small typo in comment
2018-04-11 12:23:15 +03:00
Matt Corallo
8aa6253a3b
Correct consensus verify args, fix tests to catch error in travis
2018-04-02 15:38:43 -04:00
Matt Corallo
bfe889904a
Fix whitespace (s/\t/ /g)
2018-04-02 14:58:25 -04:00
Matt Corallo
0e1d927b47
Only provide the required TxIn to bip143 sighash_all.
...
This resolves an very unergonomic API by allowing iteration over a
Transaction being signed's inputs without needing to take a
conflicting reference to the transaction.
The API is still relateively unsafe in that its very easy to
generate bogus sighashes with it, but this is much better than it
was, and its not clear how to fix it further.
2018-04-02 12:42:59 -04:00
Matt Corallo
3793b2859a
Add a Transaction.get_weight() method, check it in fuzzing
2018-04-02 12:23:05 -04:00
Matt Corallo
f859dc8b26
Expose VarInt's encoded length
2018-04-02 12:23:05 -04:00
Matt Corallo
a33f00621b
Move witness inside of TxIn.
...
This is a rather large breaking API change, but is significantly
more sensible. In the "do not allow internal representation to
represent an invalid state" category, this ensures that witness
cannot have an length other than the number of inputs. Further,
it reduces vec propagation, which may help performance in some
cases by reducing allocs. Fianlly, this just makes more sense (tm).
Witness are a per-input field like the scriptSig, placing them
outside of the TxIn is just where they are serialized, not where
they logically belong.
2018-03-26 10:25:33 -04:00
Tamas Blummer
ae708447a2
create Address message with SocketAddr, get SocketAddr from Address message.
2018-03-23 15:12:06 +01:00
Matt Corallo
855b377d51
Fix crash in Address::from_str if input isn't long enough
2018-03-21 18:44:10 -04:00
Matt Corallo
6826d8f35c
Stub out Sha2 calls when fuzzing to mask all but the first byte
2018-03-21 18:44:10 -04:00
Andrew Poelstra
64987e349c
minor nits to get compilation to work on rustc 1.14 (currently shipping Debian version)
2018-03-21 18:49:46 +00:00
Tamas Blummer
1a87244b2b
Implement Segwit addresses
2018-03-20 18:26:51 +01:00
Andrew Poelstra
65d8df08b8
address: implement Bech32 support
2018-03-13 14:48:01 +00:00
Andrew Poelstra
9884bec577
add docs indicating change in Sha256dHash debug output
2018-03-12 21:50:35 +00:00
Andrew Poelstra
8968b081ca
util: add Debug output for Sha256d and Hash160 which don't reverse the bytes
2018-03-12 21:27:09 +00:00
Andrew Poelstra
ee1dfcf4a2
base58: remove Base58 traits, replace with encode/decode functions
2018-03-12 21:27:07 +00:00
Tamas Blummer
755fb454eb
integration with bitcoinconsenus
2018-03-12 17:17:16 +01:00
Andrew Poelstra
21f2baf58e
remove script interpreter
2018-03-09 20:30:11 +00:00
Tamas Blummer
77ce6f18d0
Moved blockchain and patricia_tree to rust-memblocks
2018-03-09 17:22:31 +01:00
Andrew Poelstra
7dcca9157b
Merge branch 'master' into is_on_main_chain_public2
2018-03-09 15:09:21 +00:00
Tamás Blummer
e530aa98c9
Merge branch 'master' into is_on_main_chain_public2
2018-03-09 16:03:06 +01:00
Andrew Poelstra
ab72eabd59
Merge branch 'master' into get_tip_height
2018-03-09 15:01:15 +00:00
Tamas Blummer
5e510366cf
is_on_main_chain is a very useful function upstream, make it public
2018-03-03 18:15:05 +01:00
Tamas Blummer
3351f35583
add documentation
2018-02-28 20:27:52 +01:00
Tamas Blummer
50a9d0f51f
add get_best_tip_height to blokchain
2018-02-28 20:24:35 +01:00
Tamas Blummer
f1503866d7
RawNetworkMessage::command should be public. no harm and useful for debug messages.
2018-02-28 10:42:23 +01:00
Andrew Poelstra
066c49305f
update secp256k1 to latest version with minimized dependencies
2018-02-20 16:19:29 +00:00
Andrew Poelstra
23a2c6bc9a
remove `jsonrpc` dependency by copying the macro we need into the source
2018-02-18 15:28:39 +00:00
Andrew Poelstra
047c0c149d
remove `num` crate dependency
2018-02-18 15:21:13 +00:00
Andrew Poelstra
9562d8afac
Merge pull request #41 from tamasblummer/minimal_alert_message
...
minimal implementation of alert message
2018-02-18 15:00:55 +00:00
Andrew Poelstra
71bce7b067
Merge pull request #44 from tamasblummer/add_difficulty2
...
Add difficulty calculation
2018-02-18 14:59:36 +00:00
Andrew Poelstra
91a786d22c
Merge pull request #42 from tamasblummer/add_low_u64
...
add low_u64 to Uint256 and Uit128 types
2018-02-18 14:57:37 +00:00
Andrew Poelstra
3547d27430
Merge pull request #40 from tamasblummer/unit_debug_fix
...
fixing debug output for Uint256 and Uint128
2018-02-18 14:57:00 +00:00
Andrew Poelstra
7930d14124
Merge pull request #38 from apoelstra/bip143
...
util: add `bip143` module to create BIP143 signature hashes
2018-02-16 22:13:55 +00:00
Andrew Poelstra
9f092a6f31
remove all use of mem::uninitialized and mem::copy_nonoverlapping
2018-02-14 16:53:49 +00:00
Matt Corallo
9052f3b5a2
Fix argument to copy_nonoverlapping in internal_macros
...
This resolves a segfault due to unsafe code.
2018-02-13 19:08:10 -05:00
Tamas Blummer
3efe511cc6
add difficulty calculation
2018-02-11 19:58:26 +01:00
Tamas Blummer
19f96fe62c
add low_u64 to Uint256 and Uit128 types
2018-02-11 14:19:58 +01:00
Tamas Blummer
9fbe941621
minimal implementation of alert message
2018-02-11 14:08:33 +01:00
Tamas Blummer
e05f45beb0
fixing debug output for Uint256 and Uint128
2018-02-11 14:04:35 +01:00
Andrew Poelstra
f233fcac61
util: add `bip143` module to create BIP143 signature hashes
2018-01-15 17:54:32 +00:00
Andrew Poelstra
b3644b7b6d
add constants for OP_CLTV and OP_CSV
2017-12-21 01:10:00 +00:00
Andrew Poelstra
406160a386
transaction: add txid() function that does the right thing for segwit/nonsegwit
...
With Segwit transactions `bitcoin_hash()` is no longer sufficient to get a txid.
2017-12-09 19:52:09 +00:00
Andrew Poelstra
c691d0e382
util: add Sha256dEncoder to allow streaming data into a hash
...
This is needed to for a sane BIP143 implementation. Should be exactly equivalent to
serializing data into a vector then hashing that vector for all types.
2017-12-06 16:50:47 +00:00
Andrew Poelstra
e5f109221e
script: add `to_p2wsh()` and `is_p2swsh()` functions to allow easy segwit output computation
2017-12-06 15:39:37 +00:00
Andrew Poelstra
c341e21dc6
remove unnecessary `mut` that nightly rustc has learned to detect
2017-10-06 19:56:50 +00:00
Andrew Poelstra
46439710d9
script: add `is_p2pkh()` function
2017-10-06 19:15:30 +00:00
Andrew Poelstra
8f7bd858fb
update byteorder to 1.1 from 0.3
2017-07-28 16:19:44 +00:00
Andrew Poelstra
2e7be81ea4
add unit test for overflow panic
2017-06-07 16:09:40 +00:00
Daniel Lockyer
a74efe6f8c
Sanity checks for vector length
2017-06-05 18:06:30 +01:00
Andrew Poelstra
cdb452f79f
Sanity-check vector length when deserializing
2017-04-17 00:54:38 +00:00
Andrew Poelstra
4b73c3223c
Merge pull request #18 from rotwatsb/GetAddr
...
Add GetAddr message
2016-10-12 11:26:48 +00:00
Steve Bradley
f7fed8339d
Add GetAddr message
2016-10-10 11:14:12 -04:00
Andrew Poelstra
02718be82f
Remove unused `num_cpus` dep
2016-10-10 13:09:40 +00:00
Andrew Poelstra
e3c793f702
uint: bugfix in trailing_zeroes()
2016-08-26 16:20:26 +00:00
Andrew Poelstra
af10b153be
segwit: add transaction/block serialization support for BIP141/BIP144; bump to 0.8
...
Do not yet support new sighash type
2016-08-24 16:24:55 +00:00
Demur Rumed
5dda3e2602
Replace time with std::time
2016-07-17 04:02:57 +00:00
Andrew Poelstra
93f103bdb5
script: fix broken push_int in script::Builder
2016-07-14 15:15:34 +00:00
Andrew Poelstra
9d2826d5d1
bip32: error API cleanups
2016-06-24 19:45:42 +00:00
Andrew Poelstra
f7d4ae8265
bip32: add accessor for the tweak used in public key derivation
2016-06-24 19:25:47 +00:00
Andrew Poelstra
14af175a11
Resurrect BIP32 support
2016-06-24 19:15:57 +00:00
Andrew Poelstra
698a23e32d
script: fix Debug impl bugs in Script, PUSHDATA1 not displayed correctly
2016-06-24 00:20:49 +00:00
Andrew Poelstra
1e47019221
cargo-clippy cleanups
2016-06-21 14:35:27 +00:00
Andrew Poelstra
1dbd1c28dc
Implement stdlib Error trait for util::Error type
2016-06-20 01:25:54 +00:00
Andrew Poelstra
50b3e90912
Rename Transaction::scripthash to Transaction::signature_hash
...
Yes, this is a major release because I misspelled the name of a function :)
2016-06-13 21:25:47 +00:00
Andrew Poelstra
38b2cacf35
Add support for computing transaction sighashes, which is needed for signing
2016-06-12 18:25:23 +00:00
Andrew Poelstra
220775015e
[BREAKING CHANGE] [v0.5 -> v0.6] Move nasty script stuff into a feature-gated module
2016-06-12 00:36:46 +00:00
Andrew Poelstra
46681bbcac
contracthash: expose key tweak in new function
...
Needed for applications where the tweak and the secret key material are on different
devices (and the one with the secret material does not want to know how to compute
the tweak itself).
2016-06-10 18:36:15 +00:00
Andrew Poelstra
6ccd157775
Add `into_vec` method to Script
2016-06-02 23:47:29 +00:00
Andrew Poelstra
35832e3da0
Remove some unused trait imports
2016-05-27 18:36:42 +00:00
Andrew Poelstra
30904b67a7
Derive Eq and friends for script::Instruction
2016-05-04 14:03:58 +00:00
Andrew Poelstra
96b4b050fd
Serialize Sha256Hash without allocations
2016-05-03 20:16:30 +00:00
Andrew Poelstra
f906c2fddd
Add `first_push_as_number` function to contracthash templates
...
This is a bit of a hack to let users of the contracthash API to determine
how many sigs are required when signing a multisig contract.
2016-03-29 17:24:34 +00:00
Andrew Poelstra
f18157e774
Minor code changes for new rustc/clippy. No effects. Update minor version number
2016-02-18 19:44:29 +00:00
Andrew Poelstra
5f308887c9
Fix test added for serde transaction roundtrip
2016-02-18 18:02:04 +00:00
Andrew Poelstra
92c3b2459c
script: fix macro for future rustc changes
2016-02-18 17:56:51 +00:00
Andrew Poelstra
b88d04f0bc
Add serde impls for all Transaction types
...
Bump version number; introduce rust-jsonrpc dependency
2016-02-10 03:37:24 +00:00
Andrew Poelstra
56b7e7d3f4
Add ntxid support
2015-12-21 11:07:37 -06:00
Andrew Poelstra
16f5878a03
Add a bunch of Ord/PartialOrd impls for stuff
2015-12-20 15:38:02 -06:00
Andrew Poelstra
e05e6d2215
[BREAKING CHANGE] Drop UtxoSet
...
This code was unmaintained, is unlikely to work on the majority of systems
(since it holds the whole utxoset in RAM, and not in a terribly efficient
manner), and has a dependency on `eventual` which has been broken for a
long time.
The library no longer compiles on nightly because of this, and without any
known usecases for `UtxoSet`, nor good ability to test it, I'm simply
removing the code.
I recommend anyone who cares about this extracts the code from the previous
commit and creates a new crate. It should be more featureful anyway, e.g.
support a backing store.
2015-12-19 20:13:59 -06:00
Andrew Poelstra
45ef239a34
Add unsigned Decimal type
2015-12-19 20:13:59 -06:00
Andrew Poelstra
5c69d44397
Add Hash derived impls for all the transaction types
2015-12-19 20:13:59 -06:00
Andrew Poelstra
52b4263539
Remove comment about refcounted pointers; there are no refcounted pointers
2015-12-19 20:13:59 -06:00
Andrew Poelstra
c1993a12c6
Add TxOutRef type to blockdata::transaction; don't use it anywhere in the library itself
...
This is just a convenience type for the (txid, vout) pairs that get produced
a lot in Bitcoin code. To the best of my knowledge there is nowhere this can
be used in the actual library (in particular, TxOutRef.index is a usize for
convenience while TxIn.prev_index is a u32 for correct consensus encoding,
so there is not redundancy here).
2015-12-19 20:13:59 -06:00
Andrew Poelstra
e393d0ec3b
Add useful Debug/Display for Script
2015-12-19 20:13:59 -06:00
Nicholas Alan Cardin
e72e01dfa3
Fix decoding of Pong message
2015-12-17 23:47:40 -05:00
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
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
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
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
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
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
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
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
Andrew Poelstra
e5a3e84c41
Checkpoint commit (nope, not yet to small commit sizes :))
...
This is mostly fixing compile errors in `cargo test`. We are down
to 3 in `cargo build` and 14 in `cargo test`, at least for this
round.
2015-04-08 17:23:45 -05:00
Andrew Poelstra
08a20f8764
Checkpoint commit
...
Work is stalled on some other library work (to give better lifetime
requirements on `eventual::Future` and avoid some unsafety), so
committing here.
There are only three errors left in this round :)
Also all the indenting is done, so there should be no more massive
rewrite commits. Depending how invasive the lifetime-error fixes
are, I may even be able to do sanely sized commits from here on.
2015-04-07 17:52:58 -05:00
Andrew Poelstra
200e0fe8e3
Checkpoint commit
...
27 files changed, 3944 insertions(+), 3812 deletions(-) :} I've
started doing whitespace changes as well, I want everything to
be 4-space tabs from now on.
2015-04-06 20:51:11 -05:00
Andrew Poelstra
811df8a713
Giant collection of fixes ... we are into lifetime errors now :)
2015-04-05 19:10:37 -05:00
Andrew Poelstra
7b89c15ed5
More changes, incl. dropping DumbHasher in favor of SipHasher
...
only json stuff left in this round of compiler errors :)
2015-04-05 14:43:44 -05:00
Andrew Poelstra
7738722ab5
Checkpoint commit; tons of disorganized changes for rustc
...
BTW after all this is done I'm gonna indent the entire codebase...
so `git blame` is gonna be totally broken anyway, hence my
capricious cadence of commits.
2015-04-05 12:58:49 -05:00
Andrew Poelstra
160f2f9ea6
Drop ThinVec, many other changes toward updating for librustc
2015-04-04 22:13:19 -05:00
Andrew Poelstra
7a2cfe95e7
Minor fixes to namespaces
2015-04-04 13:56:30 -05:00
Andrew Poelstra
a62a7d736c
Several more changes for librustc changes
2015-04-04 13:08:49 -05:00
Andrew Poelstra
467f76a37d
MemReader/MemWriter become Cursor, other rustc changes
2015-04-04 12:56:40 -05:00
Andrew Poelstra
f1aed644c6
More misc cleanup for rustc changes
2015-03-26 14:21:48 -05:00
Andrew Poelstra
0bf5809674
Add time crate
2015-03-26 11:53:49 -05:00
Andrew Poelstra
6db25db975
Bunch of error type changes
2015-03-26 11:52:20 -05:00
Andrew Poelstra
719f616218
Some more renames for librustc changes
2015-03-26 10:44:49 -05:00
Andrew Poelstra
11dbc717c4
Show -> Debug
2015-03-26 10:35:31 -05:00
Andrew Poelstra
df065c143b
fix attributes for compiler changes
2015-03-26 10:31:19 -05:00
Andrew Poelstra
2101e4a56d
Rename bitcoin-secp256k1-rs to secp256k1
2015-03-26 10:08:36 -05:00
Andrew Poelstra
c3377032f8
Many syntax changes for rustc, incomplete
2015-01-18 17:39:51 -06:00
Andrew Poelstra
97bfbe790b
Add a `clone` to script sat-checker to satisfy new soundness rules
...
This was actually a soundness bug waiting to happen fwiw...but I'm
still not so happy about it.
2014-09-11 08:03:36 -05:00
Andrew Poelstra
e0c9844ff2
Make UtxoSet store (height, txo) pairs rather than just the raw txo
...
Will take some experimentation to see if this is what I want the API
to be, if the memory usage is acceptable, etc.
This will force a total reindex for wizards-wallet users.
[breaking-change]
2014-09-10 19:58:58 -05:00
Andrew Poelstra
184721db61
Add wallet balance-checking support
2014-09-10 07:19:12 -05:00
Andrew Poelstra
ef11e8273b
Destroy socket listener on error rather than trying to reconnect; add #derivings
...
Reconnecting an existing socket simply was not working; the Rust socket
did not expose any methods for reconnection, so I simply tried calling
connect() again. As near as I can tell, this was a no-op --- which makes
sense because both the sending and receiving threads had their own copy
of the Socket, and it's not clear what the synchronization behaviour
should have been.
Instead if the connection fails, we relay this information to the main
thread, wait for an acknowledgement, then simply destroy the listening
thread. The caller can then simply call `start()` again.
2014-09-10 07:15:48 -05:00
Andrew Poelstra
1f41a67194
Make Address public
2014-09-06 11:47:18 -05:00
Andrew Poelstra
2aeb373e73
Fix encode/decode of ChildNumber so that hardened keys do not become normal ones
2014-09-06 11:35:36 -05:00
Andrew Poelstra
a240d25611
Wallet support for address creation
2014-09-06 10:30:11 -05:00
Andrew Poelstra
9f56b9c57f
Fix wallet serialization to not use "" as a key anywhere
...
Turns out TOML does not support tables named "", so we instead encode
the accounts list as an array rather than a name-keyed hashmap. This
is fine since the account name is in the account structure itself
anyway.
2014-09-05 11:55:25 -05:00