Andrew Poelstra
bee5e8a090
Merge pull request #567 from LNP-BP/bip32/child-number-display
...
Improving bip32 ChildNumber display implementation
2021-03-12 21:01:56 +00:00
Jeremy Rubin
a0c7f530ba
Localize breaking changes of fixing the Amount serialization to only the
...
broken Option<SerdeAmount> serializer.
2021-02-28 09:13:52 -08:00
Dr Maxim Orlovsky
7b7b73f6d2
Improving PSBT FromStr error type
2021-02-22 12:46:22 +01:00
Dr Maxim Orlovsky
79f2729b20
Improving PSBT error tests
2021-02-22 12:46:22 +01:00
Dr Maxim Orlovsky
94102fa597
PSBT Base64 serialization test cases
2021-02-22 12:46:22 +01:00
Dr Maxim Orlovsky
072e1d1b86
PSBT Display & FromStr using Base64 serialization
2021-02-22 12:46:22 +01: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
Andrew Poelstra
81c56dec60
Merge pull request #551 from LNP-BP/feat/key-error-derives
...
More derives for key::Error
2021-02-21 14:14:54 +00:00
Sebastian
3ecab20c17
Merge pull request #414 from stevenroose/amount-debug
...
Change Amount Debug impl to BTC with 8 decimals
2021-02-21 15:14:40 +01: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 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