Commit Graph

144 Commits

Author SHA1 Message Date
Steven Roose 2326dd6a82
Update secp256k1's rand feature to rand-std 2020-01-09 11:11:49 +00:00
Steven Roose 2f89c943e1
Release v0.23.0 2020-01-07 19:27:05 +00:00
Steven Roose 448b45a3ba
Bump version to v0.22.0 2020-01-06 22:36:15 +00:00
Dr Maxim Orlovsky 5fc24dea33 Multiple fixes for hash types and their computing
Unit test for wtxid and SegWit transactions
2020-01-01 13:54:23 +01:00
Matt Corallo acb43af981 Drop byteorder dependency
Taking an external dependency just to convert ints to byte arrays
is somewhat of a waste, especially when Rust isn't very aggressive
about doing cross-crate LTO.

Note that the latest LLVM pattern-matches this, and while I haven't
tested it, that should mean this means no loss of optimization.
2019-12-05 10:41:00 -05:00
Matt Corallo f1f7718b6c Drop (non-test/serde) hex dep in favor of bitcoin_hashes' fn's 2019-12-05 10:40:59 -05:00
Thomas Eizinger 7be4ac0403
Include secp256k1 'serde' feature flag in 'use-serde' feature 2019-11-21 12:06:06 +11:00
Thomas Eizinger 24bb6590d6
Expose secp256k1 'rand' feature flag
By exposing this, we can use the 'rand' dependency of secp256k1
in a project that only depends on rust-bitcoin without having to
add a separate dependency in order to activate the feature flag.
2019-11-21 12:05:46 +11:00
Andrew Poelstra fb6f50b0ea bump version to 0.21.0 2019-10-02 15:42:58 +00:00
Tamas Blummer 78a4f09861 nit 2019-08-22 16:21:16 +02:00
Tamas Blummer 14e61df578 move rand feature of secp256k1 into dev-dependencies 2019-08-22 08:58:58 +02:00
Tamas Blummer 76ec4ad820 single line dependencies. setting cargo version to 0.20.0 2019-08-21 20:13:53 +02:00
Tamas Blummer 9f3e355c5c upgrade to secp256k1 0.15 and bitcoinconsensus 0.17 2019-08-21 19:04:40 +02:00
Elichai Turkel 837030b04f
Bump version to 0.19.2 2019-08-20 13:28:58 -04:00
Elichai Turkel df1a5fd6b5
Remove serde-derive as a dependency 2019-08-19 13:29:38 -04:00
Elichai Turkel 0153061647
Bump version to 0.19.1 2019-08-16 16:08:36 -04:00
Elichai Turkel 747e9ce75c
Pinned serde version and re-export bech32 2019-08-16 16:08:14 -04:00
Andrew Poelstra fbc85105b3
Merge pull request #314 from stevenroose/release-0.19.0
Release v0.19.0
2019-08-16 19:29:03 +00:00
Elichai Turkel 3bab3e7ea2
make secp256k1/rand a dev-dependency 2019-08-16 13:18:15 -04:00
Steven Roose a472039301
Release v0.19.0 2019-08-16 16:41:08 +01:00
Steven Roose 385a657974
Refactor Address
- use AddressError instead of encode::Error
- replace using bech32-bitcoin with Payload::WitnessProgram variant
2019-08-13 08:47:10 +01:00
Elichai Turkel 4a1830c423 Replaced Read trait with a generic over Read (#307)
Removed tempfile usage from stream_reader
2019-08-07 17:35:22 +02:00
Tamás Blummer c93a70487f
Add client side block filter (BIP158) (#281)
* add client side block filters with code from murmel. use siphash from bitcoin_hashes pass Bitcoin Core tests upgrade to bitcoin_hashes 0.7

* add filter.filter_id() test use BlockFilter directly

* fixed edge cases of matching empty query sets or or using empty filter
2019-07-26 09:36:25 +02:00
Andrew Poelstra cded694381
Merge pull request #277 from jonasnick/rand
Remove unused rand dependency
2019-07-03 20:42:44 +00:00
Steven Roose 30201f3924
Remove Decimal and replace strason with serde_json 2019-06-13 18:29:16 +01:00
Jonas Nick 94fba3aa88 Remove unused rand dependency 2019-06-10 13:59:31 +00:00
Steven Roose 688d95b463
Add Amount and SignedAmount types 2019-05-31 10:18:59 +01:00
Andrew Poelstra 01a3a9263c contracthash: use `PublicKey` and `PrivateKey` types; minor cleanups 2019-03-21 21:27:26 +00:00
Andrew Poelstra 9daf7fa9dc util::key add serde de/serialization 2019-03-21 18:27:42 +00:00
Steven Roose 750da89992
Bump bitcoin-bech32 dependency
This makes the Address::Payload::WitnessProgram inner type compatible
with rust-lightning-invoice's Fallback::SegWitProgram's inner type.
This allows specifying fallbacks from addresses.
2019-03-04 21:15:28 +00:00
Andrew Poelstra d5c1200590 bump version to 0.17.1 2019-03-04 17:51:38 +00:00
Andrew Poelstra c342bf3731 bump version to 0.17.0 2019-02-28 22:02:45 +00:00
Dr. Maxim Orlovsky 3c21e301aa Better RawNewtorkMessage deserealization from IO stream (#231)
Follow-up to https://github.com/rust-bitcoin/rust-bitcoin/pull/229

While working with remote peers over the network it is required to deserealize RawNetworkMessage from `TCPStream` to read the incoming messages. These messages can be partial – or one TCP packet can contain few of them. To make the library usable for such use cases, I have implemented the required functionality and covered it with unit tests.

Sample usage:
```rust
fn run() -> Result<(), Error> {
    // Opening stream to the remote bitcoind peer
    let mut stream = TcpStream::connect(SocketAddr::from(([37, 187, 0, 47], 8333));
    let start = SystemTime::now();

    // Constructing and sending `version` message to get some messages back from the remote peer
    let since_the_epoch = start.duration_since(UNIX_EPOCH)
        .expect("Time went backwards");
    let version_msg = message::RawNetworkMessage {
        magic: constants::Network::Bitcoin.magic(),
        payload: message::NetworkMessage::Version(message_network::VersionMessage::new(
            0,
            since_the_epoch.as_secs() as i64,
            address::Address::new(receiver, 0),
            address::Address::new(receiver, 0),
            0,
            String::from("macx0r"),
            0
        ))
    };
    stream.write(encode::serialize(&version_msg).as_slice())?;

    // Receiving incoming messages
    let mut buffer = vec![];
    loop {
        let result = StreamReader::new(&mut stream, None).read_messages();
        if let Err(err) = result {
            stream.shutdown(Shutdown::Both)?;
            return Err(Error::DataError(err))
        }
        for msg in result.unwrap() {
            println!("Received message: {:?}", msg.payload);
        }
    }
}
```

Sample output is the following:
```
Received message: Version(VersionMessage { version: 70015, services: 1037, timestamp: 1548637162, receiver: Address {services: 0, address: [0, 0, 0, 0, 0, 65535, 23536, 35968], port: 33716}, sender: Address {services: 1037, address: [0, 0, 0, 0, 0, 0, 0, 0], port: 0}, nonce: 1370726880972892633, user_agent: "/Satoshi:0.17.99/", start_height: 560412, relay: true })
Received message: Verack
Received message: Alert([1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 127, 0, 0, 0, 0, 255, 255, 255, 127, 254, 255, 255, 127, 1, 255, 255, 255, 127, 0, 0, 0, 0, 255, 255, 255, 127, 0, 255, 255, 255, 127, 0, 47, 85, 82, 71, 69, 78, 84, 58, 32, 65, 108, 101, 114, 116, 32, 107, 101, 121, 32, 99, 111, 109, 112, 114, 111, 109, 105, 115, 101, 100, 44, 32, 117, 112, 103, 114, 97, 100, 101, 32, 114, 101, 113, 117, 105, 114, 101, 100, 0])
```

Working sample code can be found here: https://github.com/dr-orlovsky/bitcoinbigdata-netlistener
2019-02-27 16:41:28 -05:00
Carl Dong ca72a04dd4 Remove rust-crypto dependency
We no longer need rust-crypto after integrating bitcoin_hashes.
2019-01-24 16:27:52 -05:00
Carl Dong b88f00c698 Add bitcoin_hashes dependency, rename some features
Because features and dependencies share the same namespace, and we want
to pass down the optional dependence on serde to bitcoin_hashes, we need
to rename the feature to something other than serde. Right now only
features can be passed down to dependencies.

Note that we could have also renamed the dependency to something like
serde-dep and kept the same feature name, however, dependency renaming
has only been available since cargo 0.27.0

Features that represent optional dependencies have been prefixed with
'use-'. The travis file has also been modified to conform to this
change.
2019-01-24 11:31:07 -05:00
Andrew Poelstra 21bd59cb17
Merge pull request #214 from apoelstra/2019-01-0.16
bump version to 0.16
2019-01-15 21:01:10 +00:00
Andrew Poelstra b5d5ac5ffb bump version to 0.16 2019-01-15 19:07:53 +00:00
Matt Corallo 2ed4b1f246
Merge pull request #208 from sgeisler/hex_bytes
Use more performant hex_bytes function
2019-01-15 14:06:00 -05:00
Carl Dong ff5c4a1806 Bump secp to 0.12 2019-01-15 12:58:54 -05:00
Sebastian Geisler 4c29fc0e8d Add feature gated hex decode benchmark 2019-01-07 17:49:55 -08:00
Tamas Blummer bc5f78c170 upgrade byteorder to 1.2 2018-12-08 14:53:23 -08:00
Andrew Poelstra 05a00e31e1 update version to 0.15.1 2018-11-08 15:05:13 +00:00
Andrew Poelstra 1a3d3a3eef bump version to 0.15 2018-11-03 15:42:20 +00:00
Andrew Poelstra 625eac636b bump version to 0.14.2 2018-09-11 18:04:02 +00:00
Andrew Poelstra b7c84a6571 increase version to 0.14.1 2018-08-28 17:15:37 +00:00
Andrew Poelstra 6d7a5f02c1 pin hex to 0.3.2 rather than a git commit 2018-08-22 22:11:46 +00:00
Andrew Poelstra 598afd94ca bump version to 0.14.0 2018-08-22 21:18:39 +00:00
Andrew Poelstra 41ebf5468c update rust-secp dependency to 0.11 2018-08-22 19:37:32 +00: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 94f3d4b0f9 update to secp256k1 0.10.0 2018-08-20 15:28:43 +00:00