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
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