Sebastian Geisler
e98f14387d
Add function to check RBF-ness of transactions
2021-02-04 22:15:26 +01:00
Nadav Ivgi
a1e98a6796
Implement Ord for ParseLengthError
2021-01-22 00:27:28 +02:00
Nadav Ivgi
55657cbffb
Implement Error and Eq for ParseLengthError
2021-01-16 13:02:22 +02:00
Nadav Ivgi
0df86b4426
Switch to a single-variant error type, implement standard derives
2021-01-14 22:17:18 +02:00
Jeremy Rubin
da21294ac5
Fix Optional Amount Serialization
2021-01-14 10:46:20 -08:00
Nadav Ivgi
4a7cf34eeb
Use efficient serialization for non-human-readable formats
2021-01-14 19:36:36 +02:00
Nadav Ivgi
b70361370b
Make uint types (un)serializable
2021-01-14 19:36:35 +02:00
Nadav Ivgi
67ae602e2a
Implement Uint::from_be_slice()
...
Needed because Rust 1.29 does not easily allow converting from a slice
into an array.
2021-01-14 19:36:30 +02:00
Nadav Ivgi
3761b0d808
Implement Uint::to_be_bytes()
2021-01-14 19:28:02 +02:00
Dr Maxim Orlovsky
246713821d
More derives for key error
2021-01-14 16:03:53 +01:00
Steven Roose
61918dfe81
Change the signature of consensus_encode to return io::Error's
...
This is instead of encode::Errors because the encoders should
not be allowed to return errors that don't originate in the writer
they are writing into.
This is a part of the method definition that has been relied upon for a
while already.
2021-01-12 17:39:41 +00:00
Andrew Poelstra
b48f374c2c
Merge pull request #542 from apoelstra/2021-01--keyread
...
PublicKey: add read_from method to be symmetric with write_into
2021-01-11 19:50:04 +00:00
Andrew Poelstra
f1664db374
Merge pull request #538 from sanket1729/fix_warning
...
Fix service flags warning
2021-01-11 19:26:08 +00:00
Andrew Poelstra
4b58a254c5
encode: add some more generic impls (more tuples, references)
2021-01-08 23:21:55 +00:00
Andrew Poelstra
ffe452ac0b
script: add FromHex and FromStr implementations
2021-01-05 18:45:14 +01:00
Andrew Poelstra
92000bf51b
PublicKey: add read_from method to be symmetric with write_into
2021-01-04 19:07:27 +00:00
Max Giraldo
21b2f929c5
refactor(blockdata/transaction): use nested paths
...
Instead of using a wildcard path for the `hash_types` module,
be explicit about what types we're using by using nested paths.
There are many benefits to this, including not polluting the namespace
and clearly demarcating the types' location.
2021-01-04 00:01:59 +01:00
Max Giraldo
06dc0041c2
docs: fix quotes in Transaction#ntxid description
...
Insert double quotes instead of a combination of single quote
and backtick.
2021-01-01 05:52:23 -08:00
Steven Roose
a8f2faf96d
serde_utils: Only use special serialization for human-readable
...
Non-human-readable serialization (binary) doesn't need hexification.
2020-12-30 16:32:52 +01:00
Steven Roose
5fd92d1c09
psbt: Serialize maps with byte values using hex
2020-12-30 16:32:52 +01:00
Steven Roose
a05f8feec6
serde_util: Rename the btreemap module to btreemap_as_seq
...
So that we can later distinguish other modules over maps.
2020-12-30 16:32:52 +01:00
Steven Roose
a9c13272a0
psbt: Fix serde for maps with non-string keys and binary values
2020-12-30 16:32:52 +01:00
Steven Roose
e5f3bca2b4
Add serde_utils module to fix JSON serialization
2020-12-30 16:32:52 +01:00
Steven Roose
cdedb0a9d5
psbt::raw: Use hex::format_hex to format the raw key bytes
2020-12-30 16:32:52 +01:00
Steven Roose
94b7371424
Replace serde_struct_impl with derive-based impls
2020-12-30 16:32:52 +01:00
Steven Roose
d527a2c2cf
Remove the impl_array_newtype_show macro
...
Instead, implement Debug in impl_bytes_newtype.
2020-12-30 16:32:52 +01:00
Andrew Poelstra
0ab8823984
Merge pull request #536 from 0xB10C/2020-12-add-blockheader-tests
...
Add BlockHeader tests
2020-12-28 16:56:56 +00:00
Andrew Poelstra
1cc466fec6
Merge pull request #498 from LNP-BP/pending/derivation
...
Derivation path improvements, closes #473
2020-12-28 00:53:25 +00:00
0xB10C
b7caf0110f
test: BlockHeader::difficulty()
...
https://github.com/rust-bitcoin/rust-bitcoin/issues/462
2020-12-26 11:33:54 +01:00
0xB10C
4eca40dcc1
test: BlockHeader::validate_pow()
...
https://github.com/rust-bitcoin/rust-bitcoin/issues/462#issuecomment-683916241
2020-12-26 11:33:39 +01:00
0xB10C
d5bf5c88a3
test: BlockHeader::work()
...
https://github.com/rust-bitcoin/rust-bitcoin/issues/462#issuecomment-683916241
2020-12-26 11:33:22 +01:00
sanket1729
62fb1ec7e6
fix service flags warning
2020-12-23 09:59:42 -06:00
Andrew Poelstra
3c1117305f
Merge pull request #471 from LNP-BP/feat/psbt-keytypes
...
PSBT proprietary key system matching BIP 174
2020-12-21 15:41:06 +00:00
Steven Roose
767b14f696
Make Inventory and NetworkMessage enums exhaustive
...
Both by added an `Unknown` variant.
2020-12-21 12:04:26 +00:00
Steven Roose
944371d6a2
Clean up CommandString
...
- Add length invariant.
- Siimplify constructors.
2020-12-21 11:56:51 +00:00
Dr Maxim Orlovsky
7400bccb60
PSBT: proprietary keys type system according to BIP 174
2020-12-21 12:22:35 +01:00
Dr Maxim Orlovsky
c3024c3ebb
PSBT: basic support for proprietary keys
2020-12-21 12:17:07 +01:00
Dr Maxim Orlovsky
44ffddab8c
Impl IntoDerivationPath for string types
2020-12-20 23:39:01 +01:00
Dr Maxim Orlovsky
f9290438cd
DerivationPath improvements
...
Adding IntoDerivationPath trait
DerivationPath is_master function
DerivationPath constructor for empty path + Default impl
2020-12-20 23:39:01 +01:00
Andrew Poelstra
a6264cfca6
Merge pull request #499 from LNP-BP/pending/psbt-global
...
New PSBT global keys
2020-12-20 21:27:57 +00:00
Dr Maxim Orlovsky
7f5c2795d6
PSBT global xpub merging algorithm reworked
2020-12-20 11:41:24 +01:00
Andrew Poelstra
99201676ae
Merge pull request #514 from stevenroose/tosocketaddrs
...
network: Implement net::ToSocketAddrs for address messages
2020-12-16 17:11:35 +00:00
Dr Maxim Orlovsky
b84faa7f5e
PSBT: Improved global keys version and xpub handling
2020-12-16 16:46:28 +01:00
Dr Maxim Orlovsky
21c11e3315
BSPT: Improving global xpub merging algorithm
2020-12-16 16:39:46 +01:00
Andrew Poelstra
c62cd98615
Merge pull request #516 from stevenroose/max-inv-size
...
Add message::MAX_INV_SIZE constant
2020-12-15 23:45:42 +00:00
Alekos Filini
373f355b5a
Flush unrecognized network messages from the read buffer
...
Currently whenever an unrecognized network message is received, it is never
flushed from the read buffer, meaning that unless the stream is closed and
recreated it will keep returning the same error every time `read_next()` is
called.
This commit adds the length of the message to `UnrecognizedNetworkCommand`,
so that the `StreamReader` can flush those bytes before returning the error
to the caller.
2020-12-15 19:54:21 +01:00
Dr Maxim Orlovsky
8b1666295c
Nits in new PSBT global types reviews
2020-12-15 16:04:02 +01:00
Dr Maxim Orlovsky
0235abfac2
Improving PSBT merge with dedicated 1.29 rustc borrow scope
2020-12-15 15:50:18 +01:00
Dr Maxim Orlovsky
df8635c5fe
PSBT: Key pair serialization for new global keys
...
Conflicts:
src/util/psbt/map/global.rs
2020-12-15 15:50:18 +01:00
Dr Maxim Orlovsky
2f838218a8
PSBT: merging new global keys
...
Plus necessary changes to BIP 32 implementations and error type
2020-12-15 15:47:37 +01:00
Dr Maxim Orlovsky
af61d7e7bc
PSBT: adding global types (version, xpub)
2020-12-15 15:47:37 +01:00
Steven Roose
6df16b7ce2
Merge pull request #530 from LNP-BP/psbt/constants
...
PSBT types are now constants
2020-12-15 14:45:52 +00:00
Steven Roose
874ab8eca6
Make signed message prefix a public constant
2020-12-08 17:31:28 +00:00
Dr Maxim Orlovsky
881f4d75dd
PSBT: Making hash preimage constant names match BIP 174
2020-12-07 16:35:28 +01:00
Dr Maxim Orlovsky
214e10baef
PSBT types are now constants
2020-12-07 15:37:16 +01:00
Steven Roose
02c3d8fca5
Merge pull request #401 from dpc/sighhash_u32
...
Improve `sighash_u32` handling
2020-12-07 11:37:26 +00:00
Steven Roose
b4c8e12f36
Merge pull request #259 from stevenroose/taproot
...
Tagged hashes for taproot
2020-12-07 11:34:37 +00:00
Steven Roose
f0ee94f2b2
Merge pull request #513 from LNP-BP/psbt/standard-names
...
PSBT: making input and output field names match spec type names
2020-12-07 11:34:06 +00:00
Dr Maxim Orlovsky
27037e2c72
PSBT: Making RIPEMD160 hash match standard name
2020-12-05 15:46:30 +01:00
Dr Maxim Orlovsky
9b106ee161
PSBT: making BIP32 field name match spec type names
2020-12-05 15:45:20 +01:00
Steven Roose
a56712befc
Create tagged taproot hashes
2020-11-30 20:13:11 +00:00
Dawid Ciężarkiewicz
cf2c12a816
Add ability to pass `SigHashType` directly to `signature_hash`
2020-11-24 22:53:56 -08:00
Dawid Ciężarkiewicz
8773cb4a42
Document `sighash_u32` of `Transaction::signature_hash`
2020-11-24 22:50:06 -08:00
Steven Roose
ee192eb61d
Merge pull request #470 from LNP-BP/feat/bip32-bin
...
BIP 32 binary encoding functions are extracted from base58
2020-11-23 21:33:54 +00:00
Elichai Turkel
7c05673b86
Merge pull request #487 from RCasatta/map_with_u128
...
use u128 in map_to_range
2020-11-15 15:42:00 +02:00
Steven Roose
f1b0f263ce
Implement PartialOrd and Ord for Inventory
2020-11-10 19:54:07 +00:00
Dr Maxim Orlovsky
fa4ecb4a6a
Making ExtendedPubKey decode aligned with ExtendedPrivKey variant
2020-11-10 09:30:33 +01:00
Steven Roose
1ec3ed3fec
Add message::MAX_INV_SIZE constant
2020-11-09 22:22:59 +00:00
Steven Roose
ab1e9cbb9e
network: Implement net::ToSocketAddrs for address messages
2020-11-09 20:13:00 +00:00
Dr Maxim Orlovsky
a802ca88ef
Using base58::check_encode_slice_to_fmt for BIP32 encodings
2020-11-08 18:29:30 +01:00
Steven Roose
4c70397a85
network: Add socket_addr method to AddrV2Message
2020-11-08 13:48:42 +00:00
Steven Roose
c7ec4f171f
network: Move AddrV2Message definition down
...
So that it is grouped together with the impls.
2020-11-08 13:43:55 +00:00
Dr Maxim Orlovsky
d802872310
Improvements to extended keys encoding logic end errors
2020-11-08 13:03:32 +01:00
Dr Maxim Orlovsky
259259eabf
BIP 32 binary encoding functions are extracted from base58
2020-11-08 13:03:32 +01:00
Dr Maxim Orlovsky
b5f0e9e144
Fixing serde impl for PSBT inputs
2020-11-06 17:01:34 +01:00
Andrew Poelstra
d3210b39fb
Merge pull request #507 from stevenroose/pubkey-write-result
...
Change PublicKey::write_into to return Result
2020-11-05 19:21:39 +00:00
Andrew Poelstra
35d729d9f0
Merge pull request #478 from sanket1729/psbt_again
...
Psbt hash preimages (again)
2020-11-05 17:49:58 +00:00
Andrew Poelstra
8295885e8e
Merge pull request #454 from jrawsthorne/improved-bip158-types
...
Implement new FilterHeader type to differentiate from FilterHash
2020-11-05 16:46:50 +00:00
Jake Rawsthorne
921f64699c
`addrv2` and `sendaddrv2` network message
2020-10-26 21:49:06 +00:00
Jake Rawsthorne
cf8e290c99
AddrV2 structures
2020-10-26 21:46:10 +00:00
Andrew Poelstra
c16053a265
Merge pull request #446 from jrawsthorne/bip339
...
BIP339: Add wtxidrelay message and WTx inv type
2020-10-26 20:03:36 +00:00
Andrew Poelstra
93df7cbd3e
Merge pull request #291 from kallewoof/2019-07-signet
...
add signet support
2020-10-26 19:46:10 +00:00
Steven Roose
aed4e02e38
Add #![deny(unused_must_use)] to avoid not checking Errs
2020-10-23 21:31:32 +01:00
Steven Roose
9699c622fc
Return Result<(), io::Error> from PublicKey::write_into
2020-10-23 21:31:12 +01:00
Steven Roose
90e1125eff
Remove debug_assert in PublicKey::write_into
2020-10-23 21:28:46 +01:00
Steven Roose
545965d9e3
Change consensus::encode::serialize assert to debug_assert
...
This is just a sanity check on our own serialization code.
2020-10-23 21:28:17 +01:00
Steven Roose
ab9514983b
Add explanation to witness program version assertion
2020-10-23 21:28:16 +01:00
Steven Roose
cc095a4ba7
Remove assert in Uint256::from_i64 and return None instead
2020-10-23 21:28:15 +01:00
Steven Roose
5c04a059d5
Change some static assertions to debug_assert
2020-10-23 21:28:13 +01:00
Andrew Poelstra
e7980ac8a5
Merge pull request #413 from stevenroose/message-signature
...
Add MessageSignature type for dealing with signed messages
2020-10-14 16:30:15 +00:00
Steven Roose
3f65fb1aed
Don't support signed messages with p2wpkh addresses
2020-10-14 16:54:58 +02:00
Dr Maxim Orlovsky
8e0b9921ae
No space- and case insensitivity for SigHashType string serialization
2020-10-14 16:46:48 +02:00
Dr Maxim Orlovsky
00c3466363
Serde implementation for PSBT
2020-10-14 16:31:24 +02:00
Dr Maxim Orlovsky
a4a7035a94
String and serde de/serialization for SigHashType
2020-10-14 16:31:24 +02:00
sanket1729
57b63d4b52
Add tests for psbt hash serde
2020-10-11 21:51:03 -05:00
sanket1729
48151ef204
Added Hash preimages to psbt
...
Added hash preimages to psbt as per updated bip174
2020-10-11 21:51:02 -05:00
Steven Roose
f7422fb8d1
Add MessageSignature type for dealing with signed messages
2020-10-11 22:44:00 +02:00
Alexis Sellier
210ff9edc7
Derive useful traits on `BlockFilter`
2020-10-11 22:31:32 +02:00
Jake Rawsthorne
eeb14c4b08
Implement new FilterHeader type to differentiate from FilterHash
2020-10-10 20:38:10 +01:00
Steven Roose
e60bfe2f61
Revert the sighash method signatures
...
Hash engines don't product I/O errors, so encoding into them
shouldn't produce errors either.
2020-10-09 16:27:38 +02:00
Andrew Poelstra
3618d7a41d
Merge pull request #485 from ipaljak-tbtl/expose-tx-signature-data
...
Expose serialized data for transaction signatures
2020-10-09 13:24:51 +00:00
Andrew Poelstra
fc60a7fc25
Merge pull request #492 from RCasatta/fix_bench_names
...
fix bench fn names
2020-10-09 13:12:39 +00:00
Riccardo Casatta
9a5291c717
fix bench names
2020-10-08 18:21:30 +02:00
Ivan Paljak
e66caab956
Improve error handling, fix forgotten early return
2020-10-08 16:40:30 +02:00
Elichai Turkel
eda47c31c9
Remove redundant code / configurations
2020-10-08 17:11:18 +03:00
Elichai Turkel
2d70623356
Remove deprecated Error::description impl
2020-10-08 17:11:18 +03:00
Elichai Turkel
023fae1f65
Add the dyn keyword where appropriate
2020-10-08 17:11:16 +03:00
Elichai Turkel
efe1a55819
Use new inclusive range syntax
2020-10-08 17:08:51 +03:00
Elichai Turkel
ad0064db14
Remove hex as a dev-dependency
2020-10-08 17:08:48 +03:00
Andrew Poelstra
7c47c9a341
Merge pull request #356 from elichai/2019-12-macros
...
Simplifying macros
2020-10-08 14:05:23 +00:00
Elichai Turkel
46f4f8cf35
Add benchmarks for tx serialization and size
2020-10-08 16:29:26 +03:00
Elichai Turkel
609b9523b8
Add benchmarks for block serialization
2020-10-08 16:28:17 +03:00
Elichai Turkel
fdd6f4f196
Derive macros instead of implementing via macro_rules
2020-10-08 16:17:14 +03:00
Riccardo Casatta
8ac3af68a4
use u128 in map_to_range
2020-10-08 08:57:59 +02:00
Ivan Paljak
c21dabb824
Expose serialized data for transaction signatures
2020-10-08 01:21:10 +02:00
Andrew Poelstra
8c82129442
Merge pull request #480 from LNP-BP/feat/keysource
...
Introducing `bip32::KeySource`: wrapper for `(Fingerprint, DerivationPath)`
2020-10-07 22:23:39 +00:00
Andrew Poelstra
3748e8faf5
Merge pull request #459 from sgeisler/2020-08-extend-derivation-path
...
Allow easy concatenation of bip32 derivation paths
2020-10-07 21:34:17 +00:00
Steven Roose
d92ca87c69
Merge pull request #488 from sgeisler/2020-10-bip32-doc-fix
...
Bip32 documentation fix
2020-10-07 21:15:14 +02:00
Jake Rawsthorne
c7987d8fcd
Add wtxidrelay message and WTx inv type, document PROTOCOL_VERSION
2020-10-07 20:03:15 +01:00
Steven Roose
9c90b39ebd
Add Block::coinbase and Block::bip34_block_height
2020-10-07 18:54:12 +02:00
Steven Roose
29a74a14ab
Move around impls in block module
...
So that an impl always succeeds the struct type definition.
2020-10-07 18:48:24 +02:00
Sebastian Geisler
b8c7bc8dcb
Bip32 documentation fix
2020-10-07 16:50:27 +02:00
Karl-Johan Alm
a3d9899cb1
add signet support
2020-09-18 16:32:33 +09:00
Dr Maxim Orlovsky
c098dfa7f2
BIP32 KeySource refactored to type aliace
2020-09-14 00:37:29 +02:00
Dr Maxim Orlovsky
aa67f10162
Introducing `bip32::KeySource`: wrapper for `(Fingerprint, DerivationPath)`
2020-09-13 22:49:52 +02:00
Dr Maxim Orlovsky
ff1b4a8dbd
WPubkeyHash constructor failing on uncompressed PublicKey
2020-09-11 15:43:05 +02:00
Dr Maxim Orlovsky
1342d73734
Script hash functions with non-allocating serialization
2020-09-11 15:10:57 +02:00
Dr Maxim Orlovsky
8363c76f5c
Script hash functions (normal and witness)
2020-09-11 15:10:57 +02:00
Dr Maxim Orlovsky
1d9f531581
Pubkey hash functions (normal and witness)
2020-09-11 15:04:26 +02:00
Andrew Poelstra
c94295c3a9
Revert "Added hash Preimages to psbt"
2020-09-11 11:31:10 +00:00
Andrew Poelstra
3f33bd74e4
Merge pull request #465 from sanket1729/psbt_updates
...
Added hash Preimages to psbt
2020-09-11 11:30:27 +00:00
Andrew Poelstra
49e97cca65
Merge pull request #387 from pandoracore/builder-p2wildcard
...
Refactoring script generating functions into a single place
2020-09-11 11:29:09 +00:00
sanket1729
c1eafff9ef
Added Sighash calculation for psbt
2020-09-11 01:01:33 -05:00
Andrew Poelstra
bcf2c5981d
Merge pull request #475 from apoelstra/2020-09--0.24.0
...
Increase version to 0.24
2020-09-10 19:58:03 +00:00
Andrew Poelstra
440005b16e
Merge pull request #464 from TheBlueMatt/2020-08-pow-clarification
...
Set Params::pow_limit to an attainable value not a theoretical one
2020-09-10 16:46:40 +00:00
Andrew Poelstra
05f3451b10
un-deperate contracthash during testing
...
Avoids a rust test runner bug, see https://github.com/rust-lang/rust/issues/47238
2020-09-10 16:40:31 +00:00
Matt Corallo
cf45a61070
Set Params::pow_limit to an attainable value not a theoretical one
...
`cloudhead` on IRC was asking how to properly use
`BlockHeader::validate_pow()` on genesis (or similar) when the
pow_limit field isn't expressible as a compact target (and, thus,
does not actually represent the PoW limit/genesis target). We
swap it for the actual PoW limit by truncating the way a compact
encoding round-trip would.
Note that, in Bitcoin Core, the original value is only ever used
once in its original form:
```
if (bnNew > bnPowLimit) // Note: bnPowLimit is params.powLimit
bnNew = bnPowLimit;
return bnNew.GetCompact();
```
Thus, even if Core adopted our change, as long as there exist no
256-bit integer x which satisfies
`x <= powLimit && x > encoding_roundtrip_truncated(powLimit)` and
`enoding_roundtrip_truncated(x) != powLimit`, the change would have
no impact on consensus.
It is trivial to show that there are no values which are between
the new value
(0x00000000ffff0000000000000000000000000000000000000000000000000000)
and the original value
(0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
which can be encoded in compact form, but it is also critically, no
such values will encode to a compact form of anything different than
the new value as the encoding always truncates the low bits, never
rounding up.
2020-09-10 12:03:51 -04:00
Andrew Poelstra
4e737f708a
Merge pull request #461 from TheBlueMatt/2020-08-mut-sighash
...
Expose the witnesses of the tx being hashed in SigHashCache
2020-09-10 13:04:51 +00:00
Dr Maxim Orlovsky
38a412c4d5
Fixing review comments for script generators refactoring
2020-09-10 14:44:44 +02:00
Dr Maxim Orlovsky
e33cdcca14
OP_RETURN script initializer
2020-09-10 12:09:04 +02:00
Dr Maxim Orlovsky
9143fd3888
All script generation functionality moved to standalone methods in Script
2020-09-10 12:09:04 +02:00
Sebastian Geisler
202a946fc3
Allow easy concatenation of bip32 derivation paths
...
Currently one has to convert the path into a Vec<ChildNumber>, extend it and finally convert it back again.
2020-09-09 21:42:27 +02:00
sanket1729
e97dda0ffe
Add tests for psbt serde
2020-09-09 12:53:09 -05:00
Andrew Poelstra
addb54ffc7
Merge pull request #458 from braydonf/version
...
Transaction and header version is signed int
2020-09-09 17:06:31 +00:00
Andrew Poelstra
5fd91ca2d8
Merge pull request #451 from stevenroose/deprecate-contracthash
...
Deprecate the util::contracthash module
2020-09-09 17:02:19 +00:00
Andrew Poelstra
c8633b5bce
Merge pull request #436 from LNP-BP/feat-u256u8
...
Big integers (Uint*) from byte slice array with `from_be_bytes`
2020-09-09 16:42:32 +00:00
Andrew Poelstra
45da3add10
Merge pull request #428 from stevenroose/no-witness-uncompressed
...
Don't allow uncompressed pks in witness addresses
2020-09-09 16:37:06 +00:00
Elichai Turkel
a44ba2d878
Merge pull request #397 from stevenroose/script-iter
...
Improve the Instructions iterator for scripts
2020-09-09 19:06:05 +03:00
Dr. Maxim Orlovsky
42bf893d8b
Update big int from_be_bytes with iterators
...
Co-authored-by: Sebastian <geisler.sebastian@googlemail.com>
2020-09-03 16:42:00 +02:00
sanket1729
c5204c001f
Added Hash Preimages to psbt
...
Added hash preimages to psbt as per updated bip174
2020-08-31 17:22:40 -05:00
Alexis Sellier
5017b33326
Add `Clone` instance to `RawNetworkMessage`
2020-08-31 19:21:29 +02:00
Matt Corallo
3d80a0c962
Expose the witnesses of the tx being hashed in SigHashCache
...
See docuemntation of the new method for more, but this allows
certain use patterns which were broken with the introduction of
SigHashCache.
2020-08-26 11:18:14 -04:00
Braydon Fuller
945db009b2
Add test for transaction and block version serialization
2020-08-19 14:12:03 -07:00
Braydon Fuller
e9f1f11c2c
Transaction and header version is signed int
2020-08-17 10:28:51 -07:00
Dr Maxim Orlovsky
2fd353d5ab
Big integers (Uint*) from byte slice array with `from_be_bytes`
2020-08-09 18:00:00 +02:00
Elichai Turkel
e8bcde4d38
Merge pull request #403 from LNP-BP/fix-macro-ns
...
Hygiene/single code style for all existing macros
2020-08-09 18:16:36 +03:00
Steven Roose
c03d2d59c6
Merge pull request #445 from elichai/2020-07-divmod
...
Use the remainder from div_rem instead of recomputing it
2020-08-09 16:59:39 +02:00
Roman Zeyde
0a25d87f2e
Remove empty code block
2020-08-07 14:48:46 +02:00
Steven Roose
1ffdce99ed
Deprecate the util::contracthash module
2020-08-06 12:24:08 +02:00
Jake Rawsthorne
e47fcae435
feefilter message
2020-07-30 17:25:21 +01:00
Elichai Turkel
478e091af6
Merge pull request #443 from sgeisler/2020-06-bip32-derive-more
...
Derive more traits to use for bip32 Types
2020-07-23 11:24:50 +03:00
Elichai Turkel
c20d356d7e
Use the remainder from div_rem instead of recomputing it
2020-07-22 12:39:32 +03:00
Dr Maxim Orlovsky
257ca8e504
Using :: for std namespaces in macro
2020-07-21 22:28:05 +02:00
Dr Maxim Orlovsky
f6aa8853a0
Namespace hygiene for macros.rs
2020-07-21 22:28:05 +02:00
Dr Maxim Orlovsky
3a5e8d8504
Namespace hygiene for internal macros
2020-07-21 22:25:59 +02:00
Dr Maxim Orlovsky
7588b211ff
Adding Rem op (%) to Uint128 & Uint256 types
2020-07-21 14:37:21 +02:00
Sebastian Geisler
a3bb03eeb9
Derive more traits to use DerivationPath in rust-miniscript
2020-07-20 16:52:18 +02:00
Alexis Sellier
9cb5d2e711
Link type in rustdoc
2020-07-09 21:17:02 +02:00
Alexis Sellier
e8cecfe1d3
Add `BlockHeader::u256_from_compact_target` function
...
This implements the counterparty to BlockHeader::compact_target_from_u256,
to convert a compact u32 to a Uint256.
2020-07-09 21:17:02 +02:00
Tao Wei
ed76e0823b
Remove duplicate code
...
Duplicated with L38
2020-06-03 17:17:13 +08:00
Elichai Turkel
f4e26caa94
Merge pull request #415 from shesek/merkleblock-txids
...
Allow to construct MerkleBlock using the header and txids
2020-05-24 16:32:17 +03:00
Steven Roose
ed9bf41ff5
Don't allow uncompressed pks in witness addresses
2020-05-23 23:20:46 +01:00
Steven Roose
59b5a73a55
Fix typo and minor formatting in address::Error
2020-05-23 23:20:19 +01:00
Andrew Poelstra
7efde3ae47
Merge pull request #419 from elichai/2020-03-description
...
Deprecate Error::description
2020-05-23 17:26:38 +00:00
Elichai Turkel
1c88be4df5
Merge pull request #422 from rust-bitcoin/2020-04-remove-alloc
...
Remove some needless allocations
2020-05-19 13:20:34 +03:00
Elichai Turkel
af31017eb1
Remove the cursor overhead, write is implemented on vec these days
2020-05-19 12:57:39 +03:00
Andrew Poelstra
c44bad87b2
Merge pull request #424 from jrawsthorne/wtxid-inv
...
Fix: Change WitnessTransaction inv type to use txid
2020-05-14 13:51:16 +00:00
Steven Roose
a9173d61d3
Merge pull request #375 from canndrew/fix-serde-struct-macros
...
Fix serde struct macros deserialization impls
2020-04-19 19:56:27 +01:00
Jake Rawsthorne
81c061a68c
Change WitnessTransaction inv type to use txid
2020-04-14 14:11:44 +01:00
Elichai Turkel
654232a3dc
Deprecate Error::description
2020-04-13 02:15:28 +03:00
Elichai Turkel
25cb3d3539
Remove alloc when hashing for Bitcoin message signing format
2020-04-12 19:04:13 +03:00
Elichai Turkel
41e4471721
Remove alloc when hashing sighash
2020-04-12 19:04:12 +03:00
Steven Roose
fea09a0a94
Improve the Instructions iterator for scripts
...
- Rename the `iter` method to `instructions`.
- Add `instructions_minimal` for minimal-enforced iteration.
- Iterator has `Result<Instruction, Error>` as items.
2020-04-11 23:52:26 +01:00
Andrew Poelstra
c3a7d1b27c
Merge pull request #417 from shesek/202003-block-size-weight
...
Add Block::get_size() and Block::get_weight()
2020-04-07 14:12:15 +00:00
Andrew Poelstra
8d859cf54c
Merge pull request #308 from elichai/2019-08-clippy
...
Cargo clippy changes
2020-04-05 16:26:07 +00:00
Elichai Turkel
a627457032
Merge pull request #412 from stevenroose/export-denom
...
Export the util::amount::Denomination type
2020-04-05 10:56:57 +03:00
Elichai Turkel
2cc88a99aa
Removed PartialEq,PartialOrd impls, shouldn't be manually impl when Hash is derived
2020-03-29 17:15:15 +03:00
Elichai Turkel
a473d01b17
Made some idiomatic changes
2020-03-29 17:15:15 +03:00
Elichai Turkel
3f2d428706
Remove needless references
2020-03-29 17:15:14 +03:00
Elichai Turkel
16eb81e1f7
Replaced slow vec initialization, and dual calls to hashmap
2020-03-29 17:10:27 +03:00
Nadav Ivgi
94032f6817
Add Block::get_size() and Block::get_weight()
2020-03-27 21:54:46 +03:00
Nadav Ivgi
f3b5a7187c
Add Transaction::get_size()
2020-03-23 19:48:41 +02:00
Nadav Ivgi
65efc5cd37
Allow to construct MerkleBlock using the header and txids
...
Co-Authored-By: Elichai Turkel <elichai.turkel@gmail.com>
2020-03-21 18:23:08 +02:00
Steven Roose
6186ee6269
Change Amount Debug impl to BTC with 8 decimals
2020-03-07 19:52:16 +00:00
Steven Roose
826b2e0e2a
Export the util::amount::Denomination type
2020-02-28 11:51:44 +00:00
Elichai Turkel
07b30c7fac
Mutation testing: amount: Added tests to fix mutation misses
2020-02-23 15:59:26 +02:00
Elichai Turkel
ab6e20c87e
Fix an overflow bug in SignedAmount to_string/fmt
2020-02-23 15:59:26 +02:00
Elichai Turkel
abc70781e7
Fix a logic problem in base58 (isn't a real bug)
2020-02-23 15:59:26 +02:00
Elichai Turkel
1d01262d5c
Mutation testing: base58: Added tests to "fix" mutation misses
2020-02-23 15:59:26 +02:00
Elichai Turkel
5d276caf95
Mutation testing: encode: Added tests to "fix" mutation misses
2020-02-23 15:59:26 +02:00
Elichai Turkel
eb7369b1db
Simlify consensus_encode vectors
2020-02-23 15:59:23 +02:00
Andrew Poelstra
a2bfcb5a89
Merge pull request #395 from pandoracore/fix-construct_uint
...
Improving `construct_uint` macro
2020-01-24 19:39:32 +00:00
Andrew Poelstra
659f2edb3b
Merge pull request #381 from elichai/2020-01-hex
...
Remove the hex dependency
2020-01-24 19:14:20 +00:00
Dr Maxim Orlovsky
9c0f4b1a60
Fixing namespaces in `impl_hashencode`
2020-01-22 13:23:09 +01:00
Steven Roose
930a6ca1dc
Merge pull request #390 from instagibbs/bip143_sighash_notall
...
Add bip143 sighash support for other flags
2020-01-21 23:26:17 +00:00
Gregory Sanders
d1c5c7b08d
Deprecate SigHashComponents
2020-01-21 09:50:41 -05:00
Gregory Sanders
908aff50bc
Add bip143 sighash support for other flags
2020-01-21 09:50:41 -05:00
Dr Maxim Orlovsky
f3e762b555
Improving `construct_uint` macro
2020-01-21 13:16:34 +01:00
Elichai Turkel
c19b736566
Remove the hex dependency
2020-01-20 18:50:02 +02:00
Elichai Turkel
5452260884
Merge pull request #392 from instagibbs/wit_scale
...
Add, use WITNESS_SCALE_FACTOR constant
2020-01-20 18:02:59 +02:00
Gregory Sanders
2916685ca6
small Transaction test cleanup
2020-01-14 11:14:23 -05:00
Gregory Sanders
3624ee82c8
Use witness scaling constant in get_weight
2020-01-14 11:14:23 -05:00
Gregory Sanders
09c0e7fbde
Add WITNESS_SCALE_FACTOR constant
2020-01-14 11:14:23 -05:00
Steven Roose
8e52b8ce4d
Remove the BitcoinHash trait
...
Replaced by a `block_hash` method on both `Block` and `BlockHeader`.
2020-01-10 11:34:16 +00:00
kiminuo
9e223988fa
Improve fmt::Debug for network/Address
...
Original output:
"Address {services: ServiceFlags(9), address: [0, 0, 0, 0, 0, 65535, 2560, 1], port: 8333}"
New output:
* for IPv4: "Address {services: ServiceFlags(NETWORK|WITNESS), address: 10.0.0.1, port: 8333}"
* for IPv6: "Address {services: ServiceFlags(NETWORK_LIMITED), address: fd87:d87e:eb43::ffff:a00:1, port: 8333}"
2020-01-07 12:30:47 +01:00
Andrew Cann
d156c65778
Fix serde struct macros deserialization impls
...
The Deserialize impls generated by serde_struct_impl and
serde_struct_human_string_impl need to be able to handle serialization
formats which serialize structs as sequences (such as bincode).
This commit adds visit_seq methods to the Visitor types defined by these
macros, in addition to the existing visit_map methods. The
implementation is taken directly from the serde docs:
https://serde.rs/deserialize-struct.html
2020-01-07 13:19:22 +08: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
Dr Maxim Orlovsky
0abe15b1f6
Moving from BitcoinHash to Wtxid for Transactions
2020-01-01 13:52:20 +01:00
Dr Maxim Orlovsky
f5a8087105
New hash types: MerkleRoot/Branch, WitnessCommit, SigHash, FilterHash
2020-01-01 13:50:17 +01:00
Dr Maxim Orlovsky
4746ccb88e
Final work on Txid and other hashes
...
Fixing issue with external dependency and hash_newtype macro implementation
Reverting back to the bitcoin_hashes crate after new version release
2020-01-01 13:48:28 +01:00
Dr Maxim Orlovsky
d20ab1dbc4
Switching to XpubIdentifier
2020-01-01 13:46:44 +01:00
Dr Maxim Orlovsky
5f4f629bb1
Replaced all hash160, sha256 and sha256d with the new hash types throughout the code
...
Embedding Txid's in the doc exaples
2020-01-01 13:44:34 +01:00
Dr Maxim Orlovsky
5ef39e34fa
Implementing (W)Pubkey/ScriptHash and BlockHash
2020-01-01 13:42:22 +01:00
Dr Maxim Orlovsky
ec92a05682
New HashTypes defined according to #284 (WIP), Txid is completed
2020-01-01 13:41:42 +01:00
Steven Roose
e2caebc42e
Merge pull request #370 from elichai/2019-12-rawmessage
...
Add a full round test for RawNetworkMessage
2019-12-23 12:30:11 +01:00
Andrew Poelstra
efd2168364
Merge pull request #368 from mauzmorose/bip157-service-flag
...
bip157: Add NODE_COMPACT_FILTERS Service Flag
2019-12-22 16:48:16 +00:00
Elichai Turkel
bc2ba5bb12
Add a full round test for RawNetworkMessage
2019-12-22 14:01:12 +02:00
Sofiane Baltaci
8617de51c8
Adapt service_flags_test to reflect changes
2019-12-21 03:36:47 +01:00
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