Sofiane Baltaci
43789b1d5a
Add COMPACT_FILTERS service flag to ServiceFlags fmt::Display impl
2019-12-21 03:06:03 +01:00
Sofiane Baltaci
b40d94641d
Add bip157 NODE_COMPACT_FILTERS Service Flag
2019-12-21 02:39:30 +01:00
Sofiane Baltaci
2605141ada
Fix typo on getcfcheckpt command string
2019-12-20 23:47:40 +01:00
kiminuo
74285738ce
Convert numeric representation of ServiceFlags to bitwise OR of the flag names
...
The changes affect only tests
2019-12-12 00:11:13 +01:00
Steven Roose
0f4f060e8b
Merge pull request #363 from kiminuo/feature/remove-old-todos
...
Remove two old TODO comments [nit]
2019-12-11 16:53:20 +00:00
Steven Roose
024557fe47
Merge pull request #357 from stevenroose/command-str
...
Various optimizations of the network code
2019-12-11 15:38:52 +00:00
kiminuo
269ddb6f07
Remove some old TODO comments
2019-12-11 08:26:04 +01:00
Steven Roose
a8f14af24d
Prevent panic on oversized CommandString's
2019-12-10 20:20:04 +00:00
Steven Roose
617c07d796
Remove encode::Error::ByteOrder
...
Functions from the byteorder crate only return downstream io errors on
io calls.
2019-12-09 14:19:11 +00:00
Steven Roose
5f4555bfac
Remove util::misc::hex_bytes in favor of bitcoin_hashes::hex
2019-12-09 14:19:09 +00:00
Steven Roose
0469453da6
Use psbt::Error in PartiallySignedTransaction::from_unsigned_tx
2019-12-09 14:19:07 +00:00
Steven Roose
1eeaccc92e
Add encode::Error::NonMinimalVarInt variant
2019-12-09 14:19:05 +00:00
Steven Roose
d02318f423
Remove deprecated std::error::Error::description
2019-12-09 14:18:37 +00:00
Steven Roose
5373428510
Drop unused encode::Error::Secp256k1 variant
2019-12-09 14:17:41 +00:00
Steven Roose
725884bab5
Introduce key::Error
2019-12-09 14:17:39 +00:00
Steven Roose
fe3397399e
Add Copy to InvType enum
2019-12-08 20:58:52 +00:00
Steven Roose
671b3173c8
Make internals for CommandString private
...
The From traits and AsRef and Display implementations
let you do all you want.
2019-12-08 20:58:50 +00:00
Steven Roose
83f55b7f1d
Follow Rust std practice for RejectReason enum
2019-12-08 20:58:49 +00:00
Steven Roose
5c84e9671f
Optimize Reject message
2019-12-08 20:58:46 +00:00
Steven Roose
c30d6d12ab
Implement Encodable for Cow<'static, str>
2019-12-08 20:57:46 +00:00
Steven Roose
e37fdb7319
Also have getter for CommandString
2019-12-08 20:57:07 +00:00
Steven Roose
e2eed78964
nit: Reject is implemented
2019-12-08 20:57:05 +00:00
Steven Roose
50a37f415e
Implement From<String> and From<&'static str> for CommandString
2019-12-08 20:57:04 +00:00
Steven Roose
36838b7918
Make network::CommandString a Cow on 'static
2019-12-08 20:57:03 +00:00
Steven Roose
bac3e0308b
Add command method to NetworkMessage
...
Also make the return type an &'static str
2019-12-08 20:57:00 +00:00
Steven Roose
b4c4a9658d
Implement std: #️⃣ :Hash for Inventory
2019-12-08 17:49:11 +00:00
Andrew Poelstra
854718219e
Merge pull request #345 from stevenroose/serviceflags
...
Add ServiceFlags type
2019-12-06 21:31:46 +00:00
Andrew Poelstra
65cb18d583
Merge pull request #341 from ccdle12/txin-impl-default
...
Add default trait implementation for TxIn
2019-12-06 21:21:49 +00:00
Steven Roose
3e1e4f92b7
Merge pull request #337 from TheBlueMatt/2019-10-less-deps
...
Drop hex and byteorder (non-test) deps (and disable useless lints)
2019-12-06 15:38:58 +00:00
Steven Roose
1edc436f8f
Add an extensive Display implementation for ServiceFlags
2019-12-05 20:13:45 +00:00
Matt Corallo
824d52fe87
Disable useless lints
2019-12-05 10:41:00 -05: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
Steven Roose
de18e926c1
Use ServiceFlags type in existing API
2019-12-04 23:28:25 +00:00
Steven Roose
fdf4b2f74e
Add ServiceFlags type
2019-12-04 23:28:23 +00:00
Steven Roose
33ba7eaa36
Nit in VersionMessage documentation
2019-11-19 22:58:49 +00:00
Chris Coverdale
0586ed94c4
Add default trait implementation for TxIn
2019-11-17 16:41:14 +00:00
Matt Corallo
fe917765c0
Drop message decode max length to 4_000_000
...
It has been a long time since Bitcoin's maximum network message
length was 32MB, so we should follow suit. This is also an important
DoS limit, so we should limit it as much as possible.
2019-11-06 16:29:21 -05:00
Carl Dong
242ce14cee
Add reject message ( #323 )
...
Add reject message
2019-09-30 14:52:19 +00:00
Dr. Maxim Orlovsky
4b1d4edc14
Improvements to `StreamReader` ( #318 )
...
* Generalizing StreamReader to support arbitrary data structures
* Using Read trait and adding test cases
2019-09-23 08:31:52 +02:00
practicalswift
0b08978af2
Fix incorrect documentation for is_p2pk(...) ( #331 )
2019-09-21 13:33:44 +02:00
Tamas Blummer
1b0e31c233
fixed typo
2019-09-21 13:31:03 +02:00
Tamas Blummer
960e3da75b
remove #repr on RejectReason
...
and typo fix
2019-09-10 20:11:25 +02:00
Tamas Blummer
c93b1ed8ce
add reverse mapping
2019-09-03 19:59:48 +02:00
Tamas Blummer
3266c192b6
add reject message
2019-08-27 13:42:46 +02:00
Tamas Blummer
38d5ae4e3f
enable serde serialization for block and blockheader
2019-08-24 14:26:18 +02:00
Carl Dong
24361dd2f1
Merge pull request #298 from tamasblummer/upgrade_secp_bitcoinconsensus
...
upgrade to secp256k1 0.15 and bitcoinconsensus 0.17
2019-08-23 14:18:05 -04:00
Tamás Blummer
f01568c85a
use lambda instead of a hash map to find spent outputs ( #319 )
...
* use lambda instead of a hash map to find spent outputs
* check for double use of an input
2019-08-23 18:49:31 +02:00
Tamas Blummer
9f3e355c5c
upgrade to secp256k1 0.15 and bitcoinconsensus 0.17
2019-08-21 19:04:40 +02:00
Elichai Turkel
52ff97cddc
Deny unused imports and remove unneeded
2019-08-19 13:29:43 -04:00
Elichai Turkel
747e9ce75c
Pinned serde version and re-export bech32
2019-08-16 16:08:14 -04:00
Steven Roose
c01172780b
Re-export bitcoin_hashes and secp256k1 dependency
2019-08-16 15:52:58 +01:00
Steven Roose
48f4c1989f
Rename bitcoin_hashes dependency to hashes
2019-08-16 15:52:27 +01:00
Steven Roose
09a65023a2
Add tests for p2shwpkh and p2shwsh
2019-08-15 22:29:09 +01:00
Steven Roose
170abaa82f
Use the new bech32 functions
2019-08-15 22:29:06 +01:00
Steven Roose
3a93f8522c
Format address module
2019-08-15 22:28:46 +01:00
Steven Roose
8de13a3915
Redo the BIP-173 test vectors
...
Before, non-version-zero segwit addresses were not included.
2019-08-15 22:28:27 +01:00
Steven Roose
e469fec839
address: Drop error::Error::description impl
2019-08-15 22:28:25 +01:00
Steven Roose
bfdcfee28e
Add Address::from_script constructor
2019-08-15 22:28:20 +01:00
Steven Roose
33e8ba3c7e
Extract roundtrip method from Address tests
2019-08-13 08:47:17 +01:00
Steven Roose
8804a41f1f
Add AddressType enum
2019-08-13 08:47:15 +01:00
Steven Roose
7e0d997150
Remove unused encode::Error variant
2019-08-13 08:47:13 +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
Andrew Poelstra
cc0f1143dc
Merge pull request #309 from elichai/2019-08-amount-precision
...
Check that the amount precision isn't more than the size of the amount
2019-08-12 17:20:18 +00:00
Riccardo Casatta
7d6687451a
use BTreeMap instead of HashMap to always serialize the same ( #310 )
...
* use BTreeMap instead of HashMap to always serialize the same
* fix rust 1.22 error
* psbt fuzz roundtrip
* psbt fuzz roundtrip on our ser
2019-08-09 17:03:12 +02:00
Tamás Blummer
4ddf6f80b9
Reduce blockfilter memory ( #302 )
...
* use same Error type in all methods of BlockFilter
* reduce Blockfilter memory footprint
* amend the example use
* remove unused constant
2019-08-09 16:58:02 +02:00
Elichai Turkel
a9e65f36d3
Check that the amount precision isn't more than the size of the amount
2019-08-09 10:41:21 -04: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
Andrew Poelstra
db8c8b497b
Merge pull request #303 from practicalswift/typos
...
Fix typos
2019-08-05 15:16:17 +00:00
Aleru
40c5a568fa
add TODOs
2019-08-04 22:27:59 -04:00
practicalswift
8152ed758c
Fix typos
2019-08-04 19:27:36 +00:00
Steven Roose
cc2ede7a80
Use `$crate::` prefix for uses in macros
2019-07-29 11:30:35 +02:00
Steven Roose
2c2d55d90a
bip32: Implement hex serialization for Fingerprint and ChainCode
2019-07-26 15:32:33 +02:00
Steven Roose
4530e403e0
Use collect_str instead of serialize_str in serde macros
2019-07-26 15:30:47 +02:00
Steven Roose
fc6415d652
Add human-readable serde for OutPoint as `<txid>:<vout>`
2019-07-26 15:30:46 +02:00
Steven Roose
3c66418f3a
bip32: Add serde for Extended(Priv|Pub)Key
2019-07-26 15:30:44 +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
b6c1266102
Merge pull request #293 from stevenroose/bip143-script-code
...
bip143: Rename witness_script to script_code
2019-07-24 22:43:58 +00:00
Andrew Poelstra
a041168205
Merge pull request #265 from apoelstra/2019-05-enc-dec-cleanup
...
clean up encoding/decoding traits
2019-07-24 19:30:21 +00:00
Tamas Blummer
ff2f5d9ec2
forbid unsafe
2019-07-23 23:29:45 +02:00
Steven Roose
b312c4de6a
bip143: Rename witness_script to script_code
...
For p2wsh the scriptCode is the witness script, but for p2wpkh, it's the
equivalent legacy p2pkh output script.
The name scriptCode is used in the BIP, so it's less confusing.
2019-07-15 17:33:23 +02:00
Andrew Poelstra
3b9a94a178
eliminate type parameter from the `Decodable` trait
2019-07-11 17:23:01 +00:00
Andrew Poelstra
42960b959f
eliminate type parameter from `Encodable` trait
2019-07-11 17:21:19 +00:00
Andrew Poelstra
87e7ebcf1b
prevent compilation on 16-bit targets so we can use `usize` and assume it is 32 bits
2019-07-11 17:15:33 +00:00
Andrew Poelstra
b734d6488a
make consensus_encode return the encoded length
2019-07-11 17:15:32 +00:00
Andrew Poelstra
abb9210c04
make `VarInt::len` and `Transaction::get_weight` return a usize
2019-07-11 17:14:05 +00:00
Andrew Poelstra
7e6ad7c893
rename Encoder to WriteExt and Decoder to ReadExt
2019-07-11 15:01:38 +00:00
Andrew Poelstra
24ebc29005
fix some recent rustc warnings
2019-07-11 15:01:38 +00:00
John L. Jegutanis
aae2937d11
Add a MerkleBlock construction
...
This is a port of the bitcoin-core CPartialMerkleTree and CMerkleBlock classes.
Here they are called PartialMerkleTree and MerkleBlock.
These are useful for SPV clients that wish to verify that a transaction is
present in a specific block in an authenticated way.
2019-07-05 20:44:31 +02:00
John L. Jegutanis
56f98e00a0
Changed constants from `static` to `const` and added 2 new constants
2019-07-05 15:01:54 +02:00
Andrew Poelstra
1a4bb371a1
Merge pull request #286 from apoelstra/2019-06-builder-ext
...
script: give `Builder` ability to verify-ify opcodes
2019-07-03 21:50:57 +00:00
Andrew Poelstra
cded694381
Merge pull request #277 from jonasnick/rand
...
Remove unused rand dependency
2019-07-03 20:42:44 +00:00
Andrew Poelstra
b2727b6ebe
Merge pull request #250 from stevenroose/no-strason
...
Remove Decimal and replace strason with serde_json
2019-07-03 17:30:21 +00:00
Andrew Poelstra
a11412862c
script: give `Builder` ability to verify-ify opcodes
2019-06-29 21:26:56 +00:00
Steven Roose
560a709faa
Add OutPoint::new() for one-liner construction ( #285 )
2019-06-24 18:49:20 +02:00
Steven Roose
d2923b7cce
Rename OP_NOP2 and OP_NOP3 to OP_CLTV and OP_CSV
2019-06-13 18:56:35 +01: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
Jonas Nick
30f24a39d0
Remove confusing mentions of SPV
2019-06-07 13:12:07 +00:00
Matt Corallo
860e74ecb5
Merge pull request #273 from stevenroose/spv-validate
...
Rename BlockHeader::spv_validate to validate_pow
2019-06-07 08:24:47 -04:00