Sebastian
d7eb15c6f1
Merge pull request #584 from darosior/max_tx_weight_const
...
Introduce some policy constants from Bitcoin Core
2021-05-29 02:49:46 +02:00
Andrew Poelstra
052aaf1d80
Merge pull request #559 from LNP-BP/fix/error-derives-2
...
Fix/error derives 2
2021-05-19 15:02:10 +00:00
Antoine Poinsot
2e9d62a9c7
blockdata/script: use policy's constant in dust computation
...
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2021-05-18 14:52:58 +02:00
Antoine Poinsot
2b777485fa
policy: introduce p2p constants from the reference implementation
...
This introduces some constants defined by Bitcoin Core which as a
consequence define some network rules in a new 'policy' module.
Only some were picked, which are very unlikely to change. Nonetheless a
Warning has been put in the module documentation.
Script-level constants are left into rust-miniscript where they are
already defined (src/miniscript/limits.rs).
2021-05-18 14:52:56 +02:00
Andrew Poelstra
4620c640a9
Merge pull request #579 from TheBlueMatt/master
...
Fix Script::dust_value()'s calculation for non-P2*PKH script_pubkeys
2021-05-06 16:01:36 +00:00
Andrew Poelstra
3fd88d317f
Merge pull request #598 from RCasatta/verify_flags
...
Add verify_with_flags to Script and Transaction
2021-05-05 22:33:47 +00:00
Matt Corallo
fc6f23fb9b
Drop not-very-useful output dust threshold constants
...
It doesn't really make sense to have a constant for every common
script type's dust limit, instead we should just use the
`Script::dust_value()` function to have users calculate it.
2021-05-05 14:53:26 +00:00
Dr Maxim Orlovsky
c0b7defc86
More non-API breaking error derives depending on upstream PRs
2021-05-04 03:58:56 +02:00
Riccardo Casatta
c96f7ec71c
use markdown autolink syntax for urls with no text
2021-05-03 13:46:10 +02:00
Riccardo Casatta
ef471ccca7
Fix documentation, in particular link to code elements
2021-05-03 11:43:11 +02:00
Matt Corallo
15981c945a
Fix Script::dust_value()'s calculation for non-P2*PKH script_pubkeys
...
The dust calculations added were only valid for P2WPKH and P2PKH
outputs, and somehow this fact was missed in review, despite the
upstream Core code being linked to and looked at by two reviewers
and the author (me).
Someday I will grow eyeballs, but that day is not today.
2021-05-01 17:47:45 +00:00
Dr. Maxim Orlovsky
68096242d3
Merge pull request #594 from RCasatta/capped
...
Count bytes read in encoding
2021-05-01 16:28:57 +02:00
Riccardo Casatta
69117a1f63
Use Amount for verify_with_flags
2021-05-01 10:22:35 +02:00
Riccardo Casatta
d1f4c0a5c8
Remove Copy for flags parameter
2021-05-01 10:19:54 +02:00
Riccardo Casatta
3aaa5d6846
Add verify with flags
2021-04-30 18:56:35 +02:00
Andrew Poelstra
4db4e604cb
Merge pull request #589 from LNP-BP/taproot/key-1
...
Non-API breaking introduction of Schnorr keys
2021-04-29 20:30:54 +00:00
Riccardo Casatta
f692c4a938
Limit bytes read with Take
2021-04-28 09:33:37 +02:00
Andrew Poelstra
8231e25292
Merge pull request #586 from sanket1729/warn
...
fix warnings for sighashtype
2021-04-21 15:52:44 +00:00
Andrew Poelstra
da477f1041
Merge pull request #558 from LNP-BP/fix/error-derives-1
...
Non-API breaking derives for error & transaction types
2021-04-21 14:24:27 +00:00
Dr Maxim Orlovsky
b17d7fc31c
Moving keys under `util::ecdsa`, re-exporting them at `util::key`
...
This is the first step in introducing Schnorr key support as per #588
2021-04-12 14:17:42 +02:00
sanket1729
3545580bd9
fix warnings for sighashtype
2021-04-06 11:52:14 -07:00
Dr Maxim Orlovsky
7fe3c4a605
Non-API breaking derives for error types
2021-04-06 14:44:50 +02:00
Collins Muriuki
c4cfdbbd6a
doc: correct Transaction struct encode_signing_data_to doc comment
2021-04-03 23:52:09 +03:00
Steven Roose
851a3a15c0
Make Script::fmt_asm a static method and add Script::str_asm
...
This makes it convenient to print/construct the script assembly on
byte slices withoout having to clone them to copy them to create a
Script struct.
2021-03-13 22:16:20 +00:00
Steven Roose
96fa4b7d9b
Implement AsRef<[u8]> for Script
2021-03-13 22:13:39 +00:00
Andrew Poelstra
2414c5b0a9
Merge pull request #573 from darosior/standard_sighash
...
SigHashType: add a method to error on non-standard hashtypes
2021-02-21 15:34:58 +00: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
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
Matt Corallo
6622de4041
Add Script:dust_value() to get minimum output value for a spk
2021-02-05 15:26:56 -05:00
Sebastian Geisler
e98f14387d
Add function to check RBF-ness of transactions
2021-02-04 22:15:26 +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
ffe452ac0b
script: add FromHex and FromStr implementations
2021-01-05 18:45:14 +01: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
94b7371424
Replace serde_struct_impl with derive-based impls
2020-12-30 16:32:52 +01: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
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
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
ab9514983b
Add explanation to witness program version assertion
2020-10-23 21:28:16 +01: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
a4a7035a94
String and serde de/serialization for SigHashType
2020-10-14 16:31:24 +02: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