Commit Graph

2028 Commits

Author SHA1 Message Date
Tobin C. Harding 110b5d8963 Bump version to v0.29.0
Add changelog notes and bump the version number to v0.29.0.
2022-08-05 11:14:41 +10:00
sanket1729 9bac1a0b8b
Merge rust-bitcoin/rust-bitcoin#1165: Update bitcoinconsensus dependency
7f554774a3 Update bitcoinconsensus dependency (Tobin C. Harding)

Pull request description:

  We recently released a couple of new versions of
  `rust-bitcoinconsensus`, the first was mainly to move to git subtree,
  included in this release was a bump of the patch version of bitcoin
  core. The next release updated bitcoin core major version to 0.20.2

  Update our bitcoinconsensus dependency to `0.20.2-0.5.0`.

ACKs for top commit:
  apoelstra:
    ACK 7f554774a3
  sanket1729:
    utACK 7f554774a3

Tree-SHA512: e30857846e6dcf237e6c87ea5cce81f091104772ce3293c8b7193f253aab3176627466ca41fc3764c949edb4f6c4ae5dc00968d71a4492e19a8a1a1e9dba7013
2022-08-04 16:26:14 -07:00
Tobin C. Harding 7f554774a3 Update bitcoinconsensus dependency
We recently released a couple of new versions of
`rust-bitcoinconsensus`, the first was mainly to move to git subtree,
included in this release was a bump of the patch version of bitcoin
core. The next release updated bitcoin core major version to 0.20.2

Update our bitcoinconsensus dependency to `0.20.2-0.5.0`.
2022-08-04 08:21:41 +10:00
Andrew Poelstra 5d44b2dda6
Merge rust-bitcoin/rust-bitcoin#1161: Fix public API clippy warnings
5cef2f1a8f Remove stutter for error variants (Tobin C. Harding)
08c4a2204a Allow wrong_self_convention for non-Copy type (Tobin C. Harding)
0786d92a5c Take self by value (Tobin C. Harding)

Pull request description:

  [Turns out](https://github.com/rust-lang/rust-clippy/issues/9248) by default clippy does not lint certain parts of the public API.

  Specifically, by setting `avoid-breaking-exported-api = false` we can get clippy to lint the public API for various things including
  `wrong_self_convention`.

  This means the saga of to/into/as continues ... we have used the wrong from for many of our `to_*` methods, they should consme `self`. Patch 1 fixes them. Patch 2 adds an `allow`. Patch 3 fixes a few error enum variant identifiers (removes `Error` suffix).

ACKs for top commit:
  Kixunil:
    ACK 5cef2f1a8f
  sanket1729:
    code review ACK 5cef2f1a8f
  apoelstra:
    ACK 5cef2f1a8f

Tree-SHA512: f1cdb94764a132a7c58f3e97a208f3f8d618e4f2620753d0394590b19d3dab0df7669e187f6e0a3d0aa358a7d8aee5495f78008f244b6eedb33715ff1df151b1
2022-08-02 14:37:58 +00:00
Tobin C. Harding 5cef2f1a8f Remove stutter for error variants
Error variants should not end with the same identifier as the enum,
i.e., they should not stutter.

Found by clippy after setting:

  avoid-breaking-exported-api = false
2022-08-02 08:55:00 +10:00
Tobin C. Harding 08c4a2204a Allow wrong_self_convention for non-Copy type
Clippy gives a warning about `wrong_self_convention` because we consume
self in a method called `is_*`. We have to consume self because the
object has a generic `E` (error type) that does not implement `Copy`.
2022-08-02 08:54:54 +10:00
Tobin C. Harding 0786d92a5c Take self by value
Turns out by default clippy does not lint certain parts of the public
API. Specifically, by setting

  avoid-breaking-exported-api = false

we can get clippy to lint the public API for various things including
`wrong_self_convention`.

Clippy emits:

 warning: methods with the following characteristics: (`to_*` and `self`
 type is `Copy`) usually take `self` by value

As suggested, take `self` by value for methods named `to_*`.
2022-08-02 08:54:53 +10:00
Andrew Poelstra ef5014f3e8
Merge rust-bitcoin/rust-bitcoin#1144: Remove deprecated `StreamReader`
0c9c14128b Remove deprecated `StreamReader` (Martin Habovstiak)

Pull request description:

  `StreamReader` was deprecated for a while, yet we needlessly maintain it
  and it eats our testing time. This change removes it completely.

  Closes #1123

ACKs for top commit:
  tcharding:
    ACK 0c9c14128b (with the function rename).
  sanket1729:
    utACK 0c9c14128b.
  apoelstra:
    ACK 0c9c14128b

Tree-SHA512: 3f10c48081f92c02bc5a9f3187df1d9279451a79eb2776b10b3e4c4dc5370a9816b3eb5f04b6e1ede61dfe13c1844d606ba00b00a2bfc6a56aefda900cd9ccc2
2022-08-01 19:20:19 +00:00
sanket1729 bb4396266a
Merge rust-bitcoin/rust-bitcoin#1151: Update finalize API
870ad59a5e Rename is_finalized to is_finalizable (sanket1729)
aaadd25ddc Add breaking test that allowed incomplete builders to be created (sanket1729)
0b88051318 Update TaprootBuilder::finalize (sanket1729)
5813ec7ac0 Return EmptyTree instead of OverCompleteTree when there are no scripts to add (sanket1729)

Pull request description:

  Found while reviewing https://github.com/rust-bitcoin/rust-miniscript/pull/450/ . There is also a BUG fix in the second commit that would have let users spendinfo from incomplete trees.

  The bug was introduced in #936 which I am responsible for ACKing

ACKs for top commit:
  apoelstra:
    ACK 870ad59a5e
  Kixunil:
    ACK 870ad59a5e
  tcharding:
    ACK 870ad59a5e

Tree-SHA512: 61442bd95df6912865cbecdc207f330b241e7fbb88b5e915243b2b48a756bea9eb29cb28d8c8249647a0a2ac514df4737bddab695f63075bd55284be5be228ff
2022-08-01 00:51:35 -07:00
Martin Habovstiak 0c9c14128b Remove deprecated `StreamReader`
`StreamReader` was deprecated for a while, yet we needlessly maintain it
and it eats our testing time. This change removes it completely.

Closes #1123
2022-07-30 14:59:42 +02:00
sanket1729 870ad59a5e Rename is_finalized to is_finalizable
I really liked the is_complete naming, but that was changed earlier in b0f3992db1
Was also suggested by Andrew https://github.com/rust-bitcoin/rust-bitcoin/pull/929#discussion_r850631207
2022-07-29 13:04:37 -07:00
sanket1729 aaadd25ddc Add breaking test that allowed incomplete builders to be created 2022-07-29 13:04:37 -07:00
sanket1729 0b88051318 Update TaprootBuilder::finalize
This commit does two things:
1) BUG FIX: We should have checked that the length of the branch is 1
before computing the spend_info on it. This was introduced in #936, but
slipped past my review :(
2) Update the return type to return the consumed `self` value. This
function can only error when there the tree building is not complete.
Returning TaprootBuilderError causes issues in downstream projects that
need to deal with error cases which cannot happen in this function
2022-07-29 13:04:37 -07:00
Andrew Poelstra f54fe69c8d
Merge rust-bitcoin/rust-bitcoin#1137: Impl string conversion traits for `CommandString`
405be52f5c Impl string conversion traits for `CommandString` (Martin Habovstiak)

Pull request description:

  After MSRV bump `try_from` usually refers to `TryFrom` method but
  `CommandString` used inherent one making it confusing and non-idiomatic.

  This implements `FromStr` and `TryFrom<{stringly type}>` for
  `CommandString` and deprecates the inherent method in favor of those.
  To keep the code using `&'static str` efficient it provides
  `try_from_static` inherent method that only converts from
  `&'static str`.

  Closes #1135

ACKs for top commit:
  sanket1729:
    utACK 405be52f5c
  tcharding:
    ACK 405be52f5c

Tree-SHA512: 754fc960a4bc5c096cccf47b85a620e33fcf863f3c57ea113eae91cd34006168113dd1efc47231e79e6e237e2fc412890cc9e8a72d4cfc633bfebbecdc4610e6
2022-07-29 14:03:00 +00:00
Andrew Poelstra 0b02e43da9
Merge rust-bitcoin/rust-bitcoin#1146: Remove needless allocation from BIP-158 encoding
1003ca08e1 Remove needless allocation from BIP-158 encoding (Martin Habovstiak)

Pull request description:

  The BIP-158 finalize code was serializing value to `Vec` only to
  serialize it to writer right away. Thus the intermediary `Vec` was not
  needed.

  Even more, the code used `write` which, while correct in case of `Vec`,
  could trigger code analysis tools or reviewers.

ACKs for top commit:
  tcharding:
    ACK 1003ca08e1
  sanket1729:
    ACK 1003ca08e1
  apoelstra:
    ACK 1003ca08e1

Tree-SHA512: 01e198726f45ef1b0e4bbe80154674d9db12350281e682531259d1d6467881bc7503cfed30d3837813437c3081a35ba7893c3ae4490d07daf20f1b75dbc62d52
2022-07-29 13:29:34 +00:00
sanket1729 5813ec7ac0 Return EmptyTree instead of OverCompleteTree when there are no scripts
to add
2022-07-28 17:19:10 -07:00
Martin Habovstiak 1003ca08e1 Remove needless allocation from BIP-158 encoding
The BIP-158 finalize code was serializing value to `Vec` only to
serialize it to writer right away. Thus the intermediary `Vec` was not
needed.

Even more, the code used `write` which, while correct in case of `Vec`,
could trigger code analysis tools or reviewers.
2022-07-28 23:02:06 +02:00
Martin Habovstiak 405be52f5c Impl string conversion traits for `CommandString`
After MSRV bump `try_from` usually refers to `TryFrom` method but
`CommandString` used inherent one making it confusing and non-idiomatic.

This implements `FromStr` and `TryFrom<{stringly type}>` for
`CommandString` and deprecates the inherent method in favor of those.
To keep the code using `&'static str` efficient it provides
`try_from_static` inherent method that only converts from
`&'static str`.

Closes #1135
2022-07-28 15:24:49 +02:00
Andrew Poelstra ed3fb45c9a
Merge rust-bitcoin/rust-bitcoin#1129: Parse int error
071a1c02b7 Implement string parsing for `Sequence` (Martin Habovstiak)
c39bc3909d Extend `ParseIntError` to carry more context (Martin Habovstiak)

Pull request description:

  When debugging parsing errors it's very useful to know some context:
  what the input was and what integer type was parsed. `ParseIntError`
  from `core` doesn't contain this information.

  In this commit a custom `ParseIntError` type is crated that carries the
  one from `core` as well as additional information. Its `Display`
  implementation displays this additional information as a well-formed
  English sentence to aid users with understanding the problem. A helper
  function parses any integer type from common string types returning the
  new `ParseIntError` type on error.

  To clean up the error code a bit some new macros are added and used.
  New modules are added to organize the types, functions and macros.

  Closes #1113

  Depends on #994

ACKs for top commit:
  apoelstra:
    ACK 071a1c02b7
  tcharding:
    ACK 071a1c02b7

Tree-SHA512: 31cb84b9e4d5fe3bdeb1cd48b85da2cbe9b9d17d93d029c2f95e0eed5b8842d7a553afafcf8b4a87c075aa53cf0274776e893bed6dca37e7dbc2e1ee1d602b8e
2022-07-28 13:04:13 +00:00
Andrew Poelstra a550fa8fbf
Merge rust-bitcoin/rust-bitcoin#1131: Upgrade bech32 to version 0.9.0
c67f74bb81 Upgrade bech32 to version 0.9.0 (Tobin C. Harding)

Pull request description:

  Recently `rust-bech32` v0.9.0 was released, this release included
  updating the MSRV to 1.41.1.

ACKs for top commit:
  apoelstra:
    ACK c67f74bb81
  Kixunil:
    ACK c67f74bb81

Tree-SHA512: 59aac2f40e0bc8c63a7549a988ff7cdc114ca7768421c7926cc6badbaa1d4f9de0c5cf41d987e4f5124a5c9042650e722cf5fbd892e91d0232ac175122eb042d
2022-07-27 21:28:38 +00:00
Martin Habovstiak 071a1c02b7 Implement string parsing for `Sequence`
`Sequence` didn't have `FromStr` nor `TryFrom<{stringly type}>`
implemented by accident. This moves a macro for implementing them from
`locktime` module to the `parse` module, renames it for clarity and uses
it to implement parsing for `Sequence`.
2022-07-27 20:46:37 +02:00
Martin Habovstiak c39bc3909d Extend `ParseIntError` to carry more context
When debugging parsing errors it's very useful to know some context:
what the input was and what integer type was parsed. `ParseIntError`
from `core` doesn't contain this information.

In this commit a custom `ParseIntError` type is crated that carries the
one from `core` as well as additional information. Its `Display`
implementation displays this additional information as a well-formed
English sentence to aid users with understanding the problem. A helper
function parses any integer type from common string types returning the
new `ParseIntError` type on error.

To clean up the error code a bit some new macros are added and used.
New modules are added to organize the types, functions and macros.

Closes #1113
2022-07-27 18:51:53 +02:00
Andrew Poelstra 57fff47408
Merge rust-bitcoin/rust-bitcoin#994: Add a `LockTime` type
0ed78e543b Add lock time types (Tobin C. Harding)
1390ee12ec Add a max scriptnum constant (Tobin C. Harding)

Pull request description:

  Implement a `LockTime` type that adds support for lock time values based on nLockTime and OP_CHECKLOCKTIMEVERIFY.

  For example usage in `rust-miniscript` please see https://github.com/rust-bitcoin/rust-miniscript/pull/408.

  ### Notes:

  I probably should have opened a new PR, this is a total re-write and very different from what is being discussed below, sorry, my bad.

  This is just half of the 'timelock' story, its the easier half. The reason I switched terminology from timelock to locktime is that we have to compare two u32s so it does not make sense to call them _both_ timelocks.

  If I have missed, or apparently ignored, anything you said reviewers please accept my apology in advance, it was not intentional. The thread of discussion is long and this topic is complex. Please do restate your views liberally :)

  Here is a useful blog post I used while touching up on timelock specifics: https://medium.com/summa-technology/bitcoins-time-locks-27e0c362d7a1. It links to all the relevant bips too.

ACKs for top commit:
  Kixunil:
    ACK 0ed78e543b
  apoelstra:
    ACK 0ed78e543b

Tree-SHA512: 486fcce859b38fa1e8e6b11cd2f494462d6d7d1d9030d096ce6b260f6c9d0342b8952afe35152bdf3afe323a234a8165ac3d6c946304afcc13406d7a0489d75a
2022-07-27 16:15:01 +00:00
Tobin C. Harding c67f74bb81 Upgrade bech32 to version 0.9.0
Recently `rust-bech32` v0.9.0 was released, this release included
updating the MSRV to 1.41.1.
2022-07-27 12:03:48 +10:00
Tobin C. Harding 0ed78e543b Add lock time types
Add a `LockTime` type to hold the nLockTime `u32` value. Use it in
`Transaction` for `lock_time` instead of a `u32`. Make it public so this
new type can be used by rust-miniscript and other downstream projects.

Add a `PackedLockTime` type that wraps a raw `u32` and derives `Ord`,
this type is for wrapping a consensus lock time value for nesting in
types that would like to derive `Ord`.
2022-07-27 08:39:19 +10:00
Tobin C. Harding 1390ee12ec Add a max scriptnum constant
Integers within Script can have a maximum value of 2^31 (i.e., they are
signed) but we (miniscript) often uses unsigned ints, to facilitate
checking the unsigned type is the correct size to fit in a signed int
add a const `MAX_SCRIPTNUM_VALUE`.
2022-07-27 08:36:14 +10:00
Andrew Poelstra 7a346970d0
Merge rust-bitcoin/rust-bitcoin#1126: Remove stale MSRV docs
fe840f0b42 Fix stale toolchain docs (Tobin C. Harding)
73b506e149 Remove stale MSRV docs (Tobin C. Harding)

Pull request description:

  We have stale docs referring to the old MSRV. We do not need MSRV docs
  in `CONTRIBUTING` because we have them in the README already.

  Fix stale docs by doing:
  - Remove the MSRV docs from readme in favour of `CONTRIBUTING.md`.
  - Add a sentence to the redame pointing readers towards `CONTRIBUTING.md`.
  - Point readers towards `RUSTUP_TOOLCHAIN`

ACKs for top commit:
  apoelstra:
    ACK fe840f0b42
  Kixunil:
    ACK fe840f0b42

Tree-SHA512: 6d3006db7a460e5d7146b73ff4b99dc322d396e65da39f5ea47c4904aa387c8a36e4a8ae707653dbab90096e692bf69918e6c19c4d3d989c85b22dba4dcba904
2022-07-26 14:18:35 +00:00
Andrew Poelstra 92b6211696
Merge rust-bitcoin/rust-bitcoin#1079: Run clippy from the test script
74f3a5aeda Run clippy from the test script (Tobin C. Harding)
aa8109a791 Use struct field short form (Tobin C. Harding)
d1a05401f4 Remove redundant calls to clone (Tobin C. Harding)
196492554d Use assert instead of assert_eq (Tobin C. Harding)
3173ef9dbb Remove unnecessary explicit reference (Tobin C. Harding)

Pull request description:

  Currently we run clippy in CI using a github action. The invocation has a couple of shortcomings

  1. it does not lint the tests (this requires `--all-targets`)
  2. it does not lint the examples

  I could not find a way to lint the examples without explicitly linting each example by name.

  **This PR does the following:**

  - Fix clippy issues (patch 1-4)
  - Move the clippy control to `test.sh`
  - Add an env var `DO_LINT` to control it
  - Remove the separate CI job
  - Run the linter during the `Test` job using the stable toolchain.
  - Run clippy with ` --all-features` AND `--all-targets` (only recently made possible).
  - Run each example explicitly

  Thanks to dunxen for noticing all the errors in my psbt example on review and prompting me to work out why clippy was not running :)

ACKs for top commit:
  apoelstra:
    ACK 74f3a5aeda
  Kixunil:
    ACK 74f3a5aeda

Tree-SHA512: 56dc6262144f4caa5efa6fdc46aeecf7bddc050ef134a639b31a34d4c5e01abcdeda18a00f4ded443866bbdfc982b4e5b67b0089639e0c253e207f0b54777f57
2022-07-26 14:04:36 +00:00
Tobin C. Harding fe840f0b42 Fix stale toolchain docs
We have docs that use an env var `BITCOIN_MSRV` that no longer exists.
Point readers towards `RUSTUP_TOOLCHAIN`.

(Note that we still use `TOOLCHAIN` in the script but it is being phased
out, `RUSTUP_TOOLCHAIN` works today.)
2022-07-26 11:09:47 +10:00
Tobin C. Harding 73b506e149 Remove stale MSRV docs
We have stale docs referring to the old MSRV. We do not need MSRV docs
in `CONTRIBUTING` because we have them in the README already.

Fix stale docs by doing:
- Remove the MSRV docs from readme in favour of `CONTRIBUTING.md`.
- Add a sentence to the redame pointing readers towards `CONTRIBUTING.md`.
2022-07-26 11:04:45 +10:00
Tobin C. Harding 74f3a5aeda Run clippy from the test script
Currently we run clippy in CI using a github action. The invocation has
a couple of shortcomings

1. it does not lint the tests (this requires `--all-targets`)
2. it does not lint the examples

I could not find a way to lint the examples without explicitly linting
each example by name.

Move the clippy control to `test.sh` and add an env var `DO_LINT` to
control it. Remove the explicit CI job and run the linter during the
`Test` job using the stable toolchain.
2022-07-26 08:48:15 +10:00
Tobin C. Harding aa8109a791 Use struct field short form
Clippy emits two warnings of form:

  warning: redundant field names in struct initialization

Remove the redundant field names and use struct short initialization
form.
2022-07-26 08:48:09 +10:00
Tobin C. Harding d1a05401f4 Remove redundant calls to clone
Clippy emits various warnings of form:

  warning: redundant clone

As suggested, remove the redundant calls to `clone`.
2022-07-26 08:47:53 +10:00
Tobin C. Harding 196492554d Use assert instead of assert_eq
Clippy emits:

  warning: used `assert_eq!` with a literal bool

As suggested, use `assert` instead of `assert_eq`.
2022-07-26 08:47:45 +10:00
Tobin C. Harding 3173ef9dbb Remove unnecessary explicit reference
Clippy emits various warnings of type:

  warning: this expression creates a reference which is immediately
  dereferenced by the compiler

As suggested, remove the unnecessary explicit reference.
2022-07-26 08:46:59 +10:00
Andrew Poelstra 5b707069e5
Merge rust-bitcoin/rust-bitcoin#1088: Add BIP152 (Compact Blocks) structures
ee29910911 BIP152: Test net msg ser/der and diff encoding (0xb10c)
cd1aaaf344 BIP152: Add Compact Block unit test based on Elements (Steven Roose)
d4d92a838e BIP152: Add Compact Blocks network messages (Steven Roose)
f2fcdc86e6 BIP152: Add basic Compact Block structures (Steven Roose)
a9a39c4b08 blockdata: Derive PartialOrd, Ord and Hash for BlockHeader (Steven Roose)

Pull request description:

  > Adds the basic structures for BIP152 and a method to create a compact block from a full block.

  This is a rebase of #249 by stevenroose (see https://github.com/rust-bitcoin/rust-bitcoin/pull/249#issuecomment-1170562141) with a milestone for 29.0. I've added deserialization and serialization tests for the network messages and fixed an off-by-one bug in the deserialization of the differentially encoded varints in the `getblocktxn` message (see https://github.com/rust-bitcoin/rust-bitcoin/pull/249#discussion_r914989521).

  Closes #249.

ACKs for top commit:
  tcharding:
    ACK ee29910911
  apoelstra:
    ACK ee29910911

Tree-SHA512: 462a91576281f5a2ffdc2610769ea93970b60dac75a150c827966c48daec7cf93f526f9f202e7ba1dbb1410b49148579880260a3c3df298b98330c0d891a4cca
2022-07-25 17:35:09 +00:00
Andrew Poelstra cf8c5819c2
Merge rust-bitcoin/rust-bitcoin#1120: Use `u16::to_be_bytes`
3c2869465b Use to_be_bytes (Tobin C. Harding)

Pull request description:

  Now that MSRV is > 1.32 we can use `u16::to_be_bytes` to ensure network byte order when encoding the port number of a `AddrV2Message`.

  Remove the TODO and use `to_be_bytes` as suggested.

ACKs for top commit:
  Kixunil:
    ACK 3c2869465b
  apoelstra:
    ACK 3c2869465b

Tree-SHA512: b5dd9b0f43257f84defb9e9ecf9d02469f1959669367c5ad02cfb43003b780cf07ea344579b52a75c424fd85f8fa02dee3713b967c9b3a33eec6b7aa914763cd
2022-07-25 15:26:10 +00:00
Andrew Poelstra 7953764d78
Merge rust-bitcoin/rust-bitcoin#1122: Add docs re Rust 1.51.1
7f498ee2a2 Add docs re Rust 1.51.1 (Tobin C. Harding)

Pull request description:

  After auditing the code base for 'msrv' the only remaining mention (excl. md files) is on `unsigned_abs`.

  Add docs to save the next guy looking up what version of Rust introduced `unsigned_abs`. (I also added an item to the [msrv tracking issue](https://github.com/rust-bitcoin/rust-bitcoin/issues/1060).)

ACKs for top commit:
  Kixunil:
    ACK 7f498ee2a2
  apoelstra:
    ACK 7f498ee2a2

Tree-SHA512: 9b4bdca09d3f7ac1c0584f4eb5207983a064cfe81ed26952d00396b2e0019ef40eee192b7f09d36c68b8c4e1f8de9cac2d1f3ee0946626bae089b46fe38704ab
2022-07-25 13:41:33 +00:00
Tobin C. Harding 3c2869465b Use to_be_bytes
Now that MSRV is > 1.32 we can use `u16::to_be_bytes` to ensure network
byte order when encoding the port number of a `AddrV2Message`.

Remove the TODO and use `to_be_bytes` as suggested.
2022-07-25 13:40:04 +10:00
Andrew Poelstra 9f0ff6f0a4
Merge rust-bitcoin/rust-bitcoin#1121: Use `u8::try_from`
517059e148 Use u8::try_from (Tobin C. Harding)

Pull request description:

  Currently we use a cast to get the `u8` depth, as suggested by the TODO in the code we can now use `TryFrom` since we bumped the MSRV.

  Use `u8::try_from.expect("")` since depth (node count) is guarded by `TAPROOT_CONTROL_MAX_NODE_COUNT`.

ACKs for top commit:
  Kixunil:
    ACK 517059e148
  apoelstra:
    ACK 517059e148

Tree-SHA512: 98e58617247a05025ec13ad3d00a464cb2351c98c6d871be43b252d3982e291b7187e25780e7fe367f5a3a64fa20f3b328876a8901af4da09e675f50727a26cf
2022-07-24 22:30:02 +00:00
0xb10c ee29910911
BIP152: Test net msg ser/der and diff encoding
This adds tests for serialization of BIP152 network messages and
tests specifically for the differential encoding of the transaction
indicies of 'getblocktx'. Previously, this code contained an
off-by-one error.
2022-07-24 13:21:14 +02:00
Steven Roose cd1aaaf344
BIP152: Add Compact Block unit test based on Elements 2022-07-24 13:21:12 +02:00
Steven Roose d4d92a838e
BIP152: Add Compact Blocks network messages 2022-07-24 13:21:11 +02:00
Steven Roose f2fcdc86e6
BIP152: Add basic Compact Block structures 2022-07-24 13:21:08 +02:00
Steven Roose a9a39c4b08
blockdata: Derive PartialOrd, Ord and Hash for BlockHeader 2022-07-24 10:32:53 +02:00
Tobin C. Harding 517059e148 Use u8::try_from
Currently we use a cast to get the `u8` depth, as suggested by the TODO
in the code we can now use `TryFrom` since we bumped the MSRV.

Use `u8::try_from.expect("")` since, assuming the code comment is
correct, the depth is guaranteed to be less that 127.
2022-07-24 06:41:30 +10:00
Tobin C. Harding 7f498ee2a2 Add docs re Rust 1.51.1 2022-07-24 05:53:41 +10:00
Andrew Poelstra c7b8d4cae8
Merge rust-bitcoin/rust-bitcoin#1114: Add ci check for duplicate dependencies
cda097dda8 Add ci check for duplicate dependencies (Tobin C. Harding)

Pull request description:

  Add a call to `cargo tree --duplicates` in the ci script to ensure that we do not have any duplicated dependencies.

  Kudos to Kixunil  for the idea (over in: https://github.com/rust-bitcoin/rust-bitcoin/pull/1104)

ACKs for top commit:
  apoelstra:
    ACK cda097dda8
  Kixunil:
    ACK cda097dda8

Tree-SHA512: 77f07dd5c6794b5a59293bd62bda0fe61384a30cf8258e79aca9ce32090f869f0a13929b6a7a4c35e10fc653968b12ddd4c291df9ecd0962632017f59c81d025
2022-07-22 20:45:11 +00:00
Andrew Poelstra 0469838648
Merge rust-bitcoin/rust-bitcoin#1119: Use `listener.accept()`
b1faf63e82 Use listener.accept() (Tobin C. Harding)

Pull request description:

  During test network simulation we only accept a single connection, we can simplify the code by using `accept`.

  Done as a follow up to review suggestion:

  https://github.com/rust-bitcoin/rust-bitcoin/pull/1042#discussion_r898013799

ACKs for top commit:
  Kixunil:
    ACK b1faf63e82
  apoelstra:
    ACK b1faf63e82

Tree-SHA512: b2ead15d3108db3e01d9faab5e3521403dad6a0f4c3cf505f88fefd020110c520a89b9406484c10b04c9a34073c8abc465941577b17b5a193b54502c23b14c61
2022-07-22 20:35:41 +00:00
Tobin C. Harding b1faf63e82 Use listener.accept()
During test network simulation we only accept a single connection, we
can simplify the code by using `accept`.

Done as a follow up to review suggestion:

https://github.com/rust-bitcoin/rust-bitcoin/pull/1042#discussion_r898013799
2022-07-22 13:29:05 +10:00