Commit Graph

1490 Commits

Author SHA1 Message Date
Matt Corallo c4f339f9fc
Merge pull request #572 from jkczyz/2021-02-validate-pow-block-hash
Return BlockHash from BlockHeader::validate_pow
2021-02-19 15:23:45 -08:00
Antoine Poinsot e36f3a38e4
transaction: deprecate SigHashType::from_u32 in favor of from_u32_consensus
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2021-02-19 11:36:44 +01:00
Antoine Poinsot bf98d9fd60
transaction: add a method to err on non-standard types to SigHashType
Right now, any sighash type could be parsed without error, which matches
consensus rules. However most of them would be invalid by standardness,
so it's a bit footgun-y (even more so for pre-signed transactions
protocols for which standardness is critical).

This adds `from_u32_standard()`, which takes care to error if we are
passed an invalid-by-current-policy-rules SIGHASH type.

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2021-02-19 11:12:02 +01:00
Antoine Poinsot 466f161e0b
transaction: document why we mask sighash types with 0x9f
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
Co-Authored-by: sanket1729 <sanket1729@gmail.com>
2021-02-19 00:27:02 +01:00
Antoine Poinsot 7f73d5f7db
doc: correct SigHashType doc comment
Super nit, but a hashtype is not specific to a transaction but a
signature.

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2021-02-18 19:48:39 +01:00
Jeffrey Czyz ade2bcee8e
Return BlockHash from BlockHeader::validate_pow
Validating a block's proof-of-work involves computing the block hash.
Returning it from BlockHeader::validate_pow avoids having callers
recompute the block hash if it is needed.
2021-02-17 17:40:17 -08:00
Dr Maxim Orlovsky 017cd71ca7
Improving bip32 ChildNumber display implementation 2021-02-11 23:06:24 +01:00
Sebastian 5bd61967b2
Merge pull request #566 from TheBlueMatt/2021-02-dust-value
Add Script:dust_value() to get minimum output value for a spk
2021-02-07 11:45:17 +01:00
Sebastian 80b47f1f5b
Merge pull request #565 from sgeisler/2021-02-rbf
Add function to check RBF-ness of transactions
2021-02-06 16:39:53 +01:00
Matt Corallo 6622de4041 Add Script:dust_value() to get minimum output value for a spk 2021-02-05 15:26:56 -05:00
Sebastian 90f3529589
Merge pull request #511 from shesek/202011-uint-serde
Make uint types (un)serializable
2021-02-05 17:47:54 +01:00
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
Andrew Poelstra c9c2e452e2
Merge pull request #533 from apoelstra/2020-12--0.26.0
bump version to 0.26
2021-01-14 17:11:46 +00:00
Dr Maxim Orlovsky 246713821d
More derives for key error 2021-01-14 16:03:53 +01:00
Andrew Poelstra 010068ba32 bump version to 0.26 2021-01-12 23:26:10 +00:00
Elichai Turkel d2344d3d61
Merge pull request #494 from stevenroose/encode-io-err
Change the signature of consensus_encode to return io::Error's
2021-01-12 21:21:00 +02: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
Sebastian 026f2dd4d9
Merge pull request #545 from thomaseizinger/update-secp
Bump to secp256k1 0.20 and don't enable `recovery` of `secp256k1` in the dependency declaration
2021-01-12 11:42:52 +01: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 4132e71b08
Merge pull request #546 from sgeisler/2021-01-ci-badge
Switch CI badge to GH actions
2021-01-11 19:49:51 +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 fd41157746
Merge pull request #548 from apoelstra/2021-01--more-encodable
encode: add some more generic impls (more tuples, references)
2021-01-09 23:55:26 +00:00
Andrew Poelstra ef116ffbed Add byteorder pinning for 1.29.0 compatibility
They broke their MSRV in a minor release.

Co-authored-by: Sebastian Geisler <sebastian@blockstream.io>
2021-01-09 16:43:18 +00:00
Andrew Poelstra 4b58a254c5 encode: add some more generic impls (more tuples, references) 2021-01-08 23:21:55 +00:00
Thomas Eizinger e52e48eebb
Don't enable `recovery` of `secp256k1` in the dependency declaration
Enabling this feature in the dependency declaration defeats the point
of exposing a feature in rust-bitcoin that enables this because
cargo currently does not provide a way to disable a once activated feature.
2021-01-06 12:23:51 +11: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
Sebastian Geisler bd55fa3eb1 Switch CI badge to GH actions 2021-01-04 14:53:37 +01:00
Thomas Eizinger 68840b65f5
Bump to secp256k1 0.20
This version removes the fuzztarget and endomorphism features.
2021-01-04 15:25:45 +11: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
Andrew Poelstra 0bbecb28e0
Merge pull request #539 from maxgiraldo/2021-01-transaction-ntxid-doc-fix
docs: fix quotes in Transaction#ntxid description
2021-01-03 22:45:11 +00:00
Andrew Poelstra 8730b8cf75
Merge pull request #544 from rust-bitcoin/2021-01--gh-actions
switch to github actions
2021-01-03 21:10:25 +00:00
Sebastian Geisler 9457e85069 move fuzzing from stable to nightly 2021-01-03 18:55:04 +01:00
Sebastian Geisler a1e96c398f Migrate CI to GitHub actions 2021-01-01 22:34:51 +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
Andrew Poelstra ed9856f800 ci: pin serde and serde-derive for Rust 1.29.0 2020-12-30 16:32:52 +01: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