Commit Graph

3067 Commits

Author SHA1 Message Date
Tobin C. Harding 154552e334
docs: Do not link to std::option::Option
This link breaks when building docs using no-std. Just use code ticks,
everyone knows what `Option` is, no need for a link.
2023-07-08 11:29:11 +10:00
Tobin C. Harding 24843468c3
Remove rustdocs links to serde
These links are broken just use code ticks instead since `serde` is
feature gated and these docs are private anyways.
2023-07-08 11:29:11 +10:00
Tobin C. Harding d45dbef3e7
Manually implement Debug on Witness
The current derived debug implementation on `Witness` prints the content
field as an array of integers. We can do better than this by manually
implementing `Debug`.

With this applied `Witness` is printed as follows: (first line is `{:?}`
and the next is `{:#?}`):

Using `{:?}`:
```
Witness: { indices: 3, indices_start: 8, witnesses: [[0x00], [0x02, 0x03], [0x04, 0x05]] }
```

Using `{:#?}`:
```
Witness: {
    indices: 3,
    indices_start: 8,
    witnesses: [
        [0x00],
        [0x02, 0x03],
        [0x04, 0x05],
     ],
}
```
2023-07-08 11:28:04 +10:00
Tobin C. Harding 9787ba6c96
Rename Script::empty to Script::new
The `empty` constructor is mis-named for the following reasons:

- Non-uniform with `ScriptBuf::new`
- Non-standard with respect to stdlib which uses `Path::new` and
  `PathBuf::new` (on which we based the `Scritp`/`ScriptBuf`)

Rename the function to `new`, put it at the top of the impl block while
we are at it.
2023-07-08 11:26:30 +10:00
Andrew Poelstra 1318ff88e5
Merge rust-bitcoin/rust-bitcoin#1927: update proc-macro to 1.0.56 to 1.0.63
c958112824 update proc-macro to 1.0.56 to 1.0.63 (Andrew Poelstra)

Pull request description:

  1.0.56 does not compile on Rust nightly anymore.

ACKs for top commit:
  yancyribbens:
    ACK c958112824
  tcharding:
    But ACK c958112824
  adoerr:
    ACK c958112824
  sanket1729:
    ACK c958112824

Tree-SHA512: bdab34d9a7ba74e18489f0cacd9aa5c65cd1f09d269fdba92dfa2ad16e19bd2de346e7378be23e79a893a10b71db1fb465edd74fb73f6e28e476415826226ea8
2023-07-07 17:02:04 +00:00
Andrew Poelstra c958112824
update proc-macro to 1.0.56 to 1.0.63
1.0.56 does not compile on Rust nightly anymore.
2023-06-29 12:36:08 +00:00
Andrew Poelstra 83cf389a02
Merge rust-bitcoin/rust-bitcoin#1926: Refactor transaction weight
f5591d8dee Use weight instead of checked_weight (yancy)
80a4d692c4 Change weight to call predict_weight (yancy)

Pull request description:

  Followup from https://github.com/rust-bitcoin/rust-bitcoin/pull/1835.  Call `predict_weight` from `weight` instead of `scaled_size()` https://github.com/rust-bitcoin/rust-bitcoin/pull/1835#issuecomment-1543687210.  I think we could also deprecate `scaled_size()` and `strippedsize()` in a future refactor.

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

Tree-SHA512: 73d719a98bd0e7e1b9b667d4a613db86a97cb16c70201ad039094bd8025e16984e74ea5110a02eedd10604663461682b7fd527023a0b0c7c94989e6f79603997
2023-06-29 01:46:46 +00:00
yancy f5591d8dee Use weight instead of checked_weight 2023-06-26 12:44:27 +02:00
yancy 80a4d692c4 Change weight to call predict_weight 2023-06-26 12:35:59 +02:00
Andrew Poelstra 51cc18ef8c
Merge rust-bitcoin/rust-bitcoin#1776: Added examples for signature verification
fc167097aa Added examples for sighash computations (Alec Matusis)

Pull request description:

  So far computed sighashes and verified signatures for:
   - P2WPKH
   - P2MS 2of3
   - P2SH 2of2 multisig
   - P2SH 2of3 multisig
   - P2WSH 2of2 multisig.

  TODOs:
    - Add P2TR script-path multisig and key-path examples
    - Are there mutisig transactions where flags are different for diff signatures within an input?
    - Maybe switch to  segwit_signature_hash()?
    - Consider also verifying script hash if we go for full P2(W)SH transactions verifications?

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

Tree-SHA512: 67750b614592391d8252fc270be8676f8aef61eb842c49816386396e7afaa472921c21df40d13291ee80e653f3a0ec367f7b941920f1777f086815bf222e8e62
2023-06-23 16:23:06 +00:00
Andrew Poelstra f7673d9ddb
Merge rust-bitcoin/rust-bitcoin#1911: Add a verify function to PublicKey
e04ac1e743 Add a verify function to PublicKey (Tobin C. Harding)

Pull request description:

  Expose signature verification functionality for ECDSA signatures on the `PublicKey` type.

  We should have an identical function on `XOnlyPublicKey` but this will have to be done in `secp2561`: https://github.com/rust-bitcoin/rust-secp256k1/pull/618

  Idea from Kixunil: https://github.com/rust-bitcoin/rust-bitcoin/pull/1744#issuecomment-1534200841

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

Tree-SHA512: f26c223a1e5cc89e5c5fc12b22e621b9e8c395b8f91d7a58c6c938d45bc531e6682b178990b5a049718dbea66fff6d19d6fbcf926f142c781ad5213708ee7afa
2023-06-23 15:33:25 +00:00
Andrew Poelstra 4a267598a9
Merge rust-bitcoin/rust-bitcoin#1910: Make sha512::HashEngine fields private
96784b9cfa Make sha512::HashEngine fields private (Tobin C. Harding)

Pull request description:

  Recently we made the hash engine fields pub crate so that `sha512_256` could construct a hash engine with different constants. We can make the code slightly cleaner by adding a pub crate constructor and making the fields private again.

  Idea from Kixunil:

    https://github.com/rust-bitcoin/rust-bitcoin/pull/1413#pullrequestreview-1197207593

  This is a follow up to #1413, cc kcalvinalvin as the author of that one.

ACKs for top commit:
  apoelstra:
    ACK 96784b9cfa
  Kixunil:
    ACK 96784b9cfa

Tree-SHA512: 40faa969b2227e46ea66a4ce887f17d9a48a0bc18846fb6bb1a51dd117a4e49cc031196846e913e03c39597cacd30a61a55bd1ccde600be72583965d2faf090a
2023-06-23 14:15:09 +00:00
Andrew Poelstra fcc0e693bd
Merge rust-bitcoin/rust-bitcoin#1915: Fix incorrect comment in ci script
6881080f8e Fix incorrect comment in ci script (Tobin C. Harding)

Pull request description:

  MSRV build breaks because of edition _2021_ not 2018.

ACKs for top commit:
  yancyribbens:
    I feel like this comment isn't very helpful and worth maintaining.  However ACK 6881080f8e to correct it.
  Kixunil:
    ACK 6881080f8e
  apoelstra:
    ACK 6881080f8e

Tree-SHA512: c909e986fa96e68211177fa4eed4e9645fb4c918c062d3be40df8f3615f877b0a89932fd39bf95475c2ee4a1557174c09c3a5b4e9853680ed74d9116a48703c9
2023-06-23 12:51:50 +00:00
Alec Matusis fc167097aa Added examples for sighash computations
So far computed sighashes for:
 - P2WPKH
 - P2MS
 - P2SH multisig
 - P2WSH multisig.

TODOs:
  - Add P2TR script-path multisig and key-path examples
2023-06-20 02:07:21 -07:00
Tobin C. Harding 6881080f8e
Fix incorrect comment in ci script
MSRV build breaks because of edition _2021_ not 2018.
2023-06-20 13:34:38 +10:00
Tobin C. Harding 96784b9cfa
Make sha512::HashEngine fields private
Recently we made the hash engine fields pub crate so that `sha512_256`
could construct a hash engine with different constants. We can make the
code slightly cleaner by adding a pub crate constructor and making the
fields private again.

Idea from Kixunil:

  https://github.com/rust-bitcoin/rust-bitcoin/pull/1413#pullrequestreview-1197207593
2023-06-20 10:11:11 +10:00
Tobin C. Harding e04ac1e743
Add a verify function to PublicKey
Expose signature verification functionality for ECDSA signatures on the
`PublicKey` type.

We should have an identical function on `XOnlyPublicKey` but this will
have to be done in `secp2561`.
2023-06-20 05:08:07 +10:00
sanket1729 12e014e288
Merge rust-bitcoin/rust-bitcoin#1878: ci: Remove stal DO_ALLOC_TESTS variable
aa7b3a7d0c ci: Remove stal DO_ALLOC_TESTS variable (Tobin C. Harding)

Pull request description:

  We never enable the `DO_ALLOC_TESTS` variable, and hence never test the "alloc" feature in `hashes`.

  Remove the `DO_ALLOC_TESTS` variable and add "alloc" to the `FEATURES` array.

ACKs for top commit:
  yancyribbens:
    ACK aa7b3a7d0c
  apoelstra:
    ACK aa7b3a7d0c
  sanket1729:
    utACK aa7b3a7d0c

Tree-SHA512: 461735242ec94786624a3653c3ea108d1a8712d5a77943f2ce54b44298624f6d4a43c98a0079782211e9a4b61ac87fbadd9c98608ca0ad82574c4a63b921776f
2023-06-14 17:54:31 -07:00
sanket1729 de7fe5e4ec
Merge rust-bitcoin/rust-bitcoin#1739: Mutate mul_u64 with mutagen
7cdc90565f Mutate mul_u64 with mutagen (Tobin C. Harding)

Pull request description:

  Add the `mutate` attribute to mutate `mul_u64`. Add non-doc comments listing the two false positives. These are identical but we list them twice so when devs grep for `mutagen false pos` the same number of lines for each function is displayed as is displayed by the `mutagen` run. This coding false positives thing is also introduced in PR #1655.

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

Tree-SHA512: d066beb2f9ba198f5af36258ba15cfbd2c7c9ce7596f6340ed1fe2f62a2b0b5296eeb2cb4be30146d019671f1858521c29db917936895b5b3fd36bdb0bd07e57
2023-06-14 17:53:39 -07:00
sanket1729 39dae44d7b
Merge rust-bitcoin/rust-bitcoin#1877: hashes: Remove stale status badge
4dfaec952c hashes: Remove stale status badge (Tobin C. Harding)

Pull request description:

  We do not use travis in our CI pipeline anymore, remove the stale badge.

ACKs for top commit:
  yancyribbens:
    ACK 4dfaec952c
  apoelstra:
    ACK 4dfaec952c
  sanket1729:
    utACK 4dfaec952c

Tree-SHA512: 6865c8cc51f90161ea643922df3bbf890811777e3dcbff9e464d6092f0d79a6ae2798d593f6a27e7f18b05ba66a765c871d4d01086e18b8480916573288afc0e
2023-06-14 17:22:33 -07:00
Andrew Poelstra b1078febc2
Merge rust-bitcoin/rust-bitcoin#1870: Add from_int_btc method to Amount
9f7449b572 Use from_int_btc function for const context (yancy)
f93e67977a Add from_int_btc function to Amount (yancy)

Pull request description:

  Followup PR from https://github.com/rust-bitcoin/rust-bitcoin/pull/1811

  Added a `const` associated function `from_int_btc()` for Amount.  `panic()` in const context is only available after 1.57+ so a work around is provided.

ACKs for top commit:
  tcharding:
    ACK 9f7449b572
  apoelstra:
    ACK 9f7449b572

Tree-SHA512: 7755234f2e573577d754f0224083cb7acc059e58833790fe344b0d9bad0acd89b0f74054d9efcba2133576222c7e9ab8dc3d81ddc10fbdcd4f83638d697118c4
2023-06-14 01:17:59 +00:00
yancy 9f7449b572 Use from_int_btc function for const context 2023-06-13 11:32:58 +02:00
yancy f93e67977a Add from_int_btc function to Amount 2023-06-13 11:32:51 +02:00
Andrew Poelstra 79bd294476
Merge rust-bitcoin/rust-bitcoin#1901: key: Implement From<PublicKey> for XOnlyPublicKey
445aa84f8c cargo fmt (Andrew Poelstra)
d990084481 key: Implement From<PublicKey> for XOnlyPublicKey (Steven Roose)

Pull request description:

ACKs for top commit:
  tcharding:
    ACK 445aa84f8c
  apoelstra:
    ACK 445aa84f8c

Tree-SHA512: c27b23dcf66139720011dc8bee379a8e4be642f8f60e8982c643013e163ad1610d355c6f5de04efc57d0dc11ba4ff0e893d3f760d5662d8f0c7eaba87f0a89a0
2023-06-12 23:49:45 +00:00
Andrew Poelstra 089b4e255f
Merge rust-bitcoin/rust-bitcoin#1904: This library is not solely dependent on Rust
654f58da17 This library is not solely dependent on Rust (roy9495)

Pull request description:

  Fix: #1867

   Docs claim this library is pure rust but it depends on libsecp256k1 (and optionally libbitcoinconsensus)
  So, I changed the lib.rs file accordingly.

ACKs for top commit:
  Kixunil:
    ACK 654f58da17
  apoelstra:
    ACK 654f58da17

Tree-SHA512: 139a921ead8e96472adb8019a0b43bcde728578699092c69322459d865be0de69ca48d073cc4c16739257627f2b6dea4e77332f2d32894812ae5b91935257782
2023-06-12 17:54:48 +00:00
Andrew Poelstra 445aa84f8c
cargo fmt 2023-06-12 13:01:12 +00:00
roy9495 654f58da17
This library is not solely dependent on Rust 2023-06-08 20:03:17 +00:00
Andrew Poelstra 0750168c4f
Merge rust-bitcoin/rust-bitcoin#1297: `alloc`-free parse errors
2b6bcf085c Implement support for `alloc`-free parse errors (Martin Habovstiak)
783e1e81dc Move `impl_std_error` to `bitcoin-internals` (Martin Habovstiak)

Pull request description:

  This implements various helpers for parse errors that will not require `alloc`. This PR is useless while all of the crates require `alloc` and is thus a draft so that you can look at the design.

ACKs for top commit:
  tcharding:
    ACK 2b6bcf085c
  apoelstra:
    ACK 2b6bcf085c

Tree-SHA512: 776838a754b2c17263cf167c8cf8a3e69e51d8de45eb08d072ef930cbd1149360da2cb5fc430ce58f31c2b07dbf06c9f8384c567358873a3440e85632fcc2af8
2023-06-07 18:45:54 +00:00
Andrew Poelstra 12dc0b013b
Merge rust-bitcoin/rust-bitcoin#1863: Removed only available in 1.46.0 line
6a18997e3c Removed only available in 1.46.0 line (TATHAGATA ROY)

Pull request description:

  Fix: #1850

  Removed "*Important: only available in Rust 1.46+*" on the file  transaction.rs from lines 1288 and 1407 respectively.

ACKs for top commit:
  Kixunil:
    ACK 6a18997e3c
  apoelstra:
    ACK 6a18997e3c
  tcharding:
    ACK 6a18997e3c
  sanket1729:
    ACK 6a18997e3c

Tree-SHA512: 1395384ffe301b628687cc6d154e191b6a4415acd33eb4209065c5bf94115c3210ea1d28f7d7186e41665b39b5bebae849c3fa5394786ce24bdcd57b765cdbd3
2023-06-07 15:22:48 +00:00
Andrew Poelstra be252f131c
Merge rust-bitcoin/rust-bitcoin#1900: network: Implement Default on ServiceFlags
4c18ba779c network: Implement Default on ServiceFlags (Steven Roose)

Pull request description:

  I think the NONE/empty service flags are a reasonable default value, no?

ACKs for top commit:
  apoelstra:
    ACK 4c18ba779c
  tcharding:
    ACK 4c18ba779c

Tree-SHA512: 14433f695edcbc19eb58f03b6b1b9dfe0cf0825df5521a7d15667733bf0a4b07a921ba9bc780acbf16cbee232177ecd4638a474a1ab046c9371ce4df16292569
2023-06-06 20:25:35 +00:00
Steven Roose d990084481
key: Implement From<PublicKey> for XOnlyPublicKey 2023-06-06 20:24:28 +01:00
Steven Roose 4c18ba779c
network: Implement Default on ServiceFlags 2023-06-06 00:06:28 +01:00
Andrew Poelstra 0266e762bd
Merge rust-bitcoin/rust-bitcoin#1898: Fix comments for #1890
d961b9c4ee Fix minor comments on count_sigops PR (junderw)

Pull request description:

  Fixing some comments that were left on #1890

ACKs for top commit:
  yancyribbens:
    ACK d961b9c4ee
  apoelstra:
    ACK d961b9c4ee
  tcharding:
    ACK d961b9c4ee

Tree-SHA512: caa04428eb7c09915964e4a7bae2d1fca2426317f3620d16e73e992269a99d7adb3d360affb954a173835661a9960cf760d29ae9861816b1a898c01428b0f2d6
2023-06-05 18:16:42 +00:00
junderw d961b9c4ee
Fix minor comments on count_sigops PR 2023-06-04 15:17:36 -07:00
Andrew Poelstra 7eeb3e6a4a
Merge rust-bitcoin/rust-bitcoin#1895: Improve `crytpo::taproot` error type
202d1cd581 Rename taproot::Error to SigFromSliceError (Tobin C. Harding)
29678cb82b Correctly document InvalidSighashType variant (Tobin C. Harding)
13d5c0536b Remove explicit error conversion (Tobin C. Harding)
d86517ae4f taproot: Use error variants locally (Tobin C. Harding)

Pull request description:

  First three patches are preparatory cleanup, last patch renames `crypto::taproot::Error` to `SigFromSliceError`. See commit log for justification of the `Sig` prefix.

  Done as part of the great error cleanup.

ACKs for top commit:
  apoelstra:
    ACK 202d1cd581
  Kixunil:
    ACK 202d1cd581

Tree-SHA512: 87aef07d2a3518c68c070e348d2331a9fbf1dc5cd36fd4d966607ddb0531eca9dc6be08f1923f941d33973f173b915490de9ef0cad724cce7bf108cdc8a82af0
2023-06-04 21:22:21 +00:00
Andrew Poelstra 1a1fe0e313
Merge rust-bitcoin/rust-bitcoin#1890: [script] Add method get_sigop_count
638445f8a9 Feature: Add opcodes::All::decode_pushnum and Script::count_sigops (junderw)

Pull request description:

  Planning to also add methods for the various parts of Transaction etc. to eventually allow for easier sigops calculation.

  Bare multisig is making a comeback, which is causing a large amount of transactions' effective vSizes (for fee calculation) to be dependent on the sigop count.

  This is a first step at making those transactions easier to estimate fees for / template blocks for etc.

ACKs for top commit:
  Kixunil:
    ACK 638445f8a9
  tcharding:
    ACK 638445f8a9

Tree-SHA512: 5e87d0f5ab58ed22ed50e43eac392b9b84ebccab5086553a6234d825766842057ab89bd0753f3c9de50d9ab17536182b8f64a57e8d5632a55494180f2cc26bbd
2023-06-04 19:59:44 +00:00
Martin Habovstiak 2b6bcf085c Implement support for `alloc`-free parse errors
This implements basic facilities to conditionally carry string inputs in
parse errors. This includes:

* `InputString` type that may carry the input and format it
* `parse_error_type!` macro creating a special type for parse errors
* `impl_parse` implementing parsing for various types as well as its
  `serde`-supporting alternative
2023-06-04 21:15:37 +02:00
Andrew Poelstra 15f2cb6694
Merge rust-bitcoin/rust-bitcoin#1897: Rename `TaprootSpendInfo::as_script_map` to `script_map`
ccb6e3eeba Rename TaprootSpendInfo::as_script_map to script_map (Tobin C. Harding)

Pull request description:

  The `as_script_map` is a getter not a conversion function (to/into/as), as such it should not include the prefix `as_`.

  Deprecate `as_script_map` in favour of `script_map`.

ACKs for top commit:
  yancyribbens:
    ACK ccb6e3eeba
  Kixunil:
    ACK ccb6e3eeba
  apoelstra:
    ACK ccb6e3eeba

Tree-SHA512: 4e14fbfff413ee1d1a396597be6c0d65d1294406291e09c06ad69836c495e6556f2c4ca1bbeca869607f1757b01de85321a8857c9e5157ae25c57f709e572178
2023-06-04 18:25:44 +00:00
junderw 638445f8a9
Feature: Add opcodes::All::decode_pushnum and Script::count_sigops 2023-06-02 08:46:46 -07:00
Tobin C. Harding ccb6e3eeba
Rename TaprootSpendInfo::as_script_map to script_map
The `as_script_map` is a getter not a conversion function (to/into/as),
as such it should not include the prefix `as_`.

Deprecate `as_script_map` in favour of `script_map`.
2023-06-02 16:59:08 +10:00
Tobin C. Harding 202d1cd581
Rename taproot::Error to SigFromSliceError
This error type is only used in the `from_slice` function. Use prefix
`Sig` because `taproot::FromSliceError` does not fully express how the
error came about.

Use specific identifier for the error, this aids usage but also prevents
us later adding "random" other variants into this error and using it in
other functions.
2023-06-02 15:48:45 +10:00
Tobin C. Harding 29678cb82b
Correctly document InvalidSighashType variant
The rustdoc on the `taproot::Error::InvalidSighashType` is wrong, fix
it.
2023-06-02 15:05:41 +10:00
Tobin C. Harding 13d5c0536b
Remove explicit error conversion
We provide a `From<secp255k1::Error>` impl so we do not need to
explicitly convert the error return, just use `?`.
2023-06-02 15:05:38 +10:00
Tobin C. Harding d86517ae4f
taproot: Use error variants locally
Add 'use Error::*' locally to make the code more terse.
2023-06-02 14:48:22 +10:00
Andrew Poelstra 6a04ca12e0
Merge rust-bitcoin/rust-bitcoin#1887: Remove doc(hidden) from error conversion functions
042dcaa4b7 Remove doc(hidden) from error conversion functions (Tobin C. Harding)

Pull request description:

  Give people access to the error type conversion docs, its no harm and it may be useful when the compiler does not give enough information.

  Done based on discussion here: https://github.com/rust-bitcoin/rust-bitcoin/pull/1846#discussion_r1209583520

ACKs for top commit:
  Kixunil:
    ACK 042dcaa4b7
  apoelstra:
    ACK 042dcaa4b7

Tree-SHA512: 9d975845ba84213b203062282b68f06f6790d03dbc88d66dce82e9bedff4696fc01da6216920de9e9e4130f6469b32ff9c168d0800d057ec0bae51702d4a139e
2023-05-30 16:37:58 +00:00
Martin Habovstiak 783e1e81dc Move `impl_std_error` to `bitcoin-internals`
The macro is useful for all other crates thus it is moved to the
internals crate in this commit.
2023-05-30 18:04:54 +02:00
Tobin C. Harding 042dcaa4b7
Remove doc(hidden) from error conversion functions
Give people access to the error type conversion docs, its no harm and it
may be useful when the compiler does not give enough information.
2023-05-30 15:54:40 +10:00
Steven Roose 7bf0a106dd
Merge pull request #1872 from tcharding/05-24-rm-prevouts-export
psbt: Remove reexport of Prevouts
2023-05-30 02:48:34 +01:00
Andrew Poelstra 80efdb065a
Merge rust-bitcoin/rust-bitcoin#1873: Improve `hashes::Error`
06afd52a12 Improve hashes::Error (Tobin C. Harding)

Pull request description:

  We are trying to make error types stable on the way to v1.0

  The current `hashes::Error` is a "general" enum error type with a single variant, better to use a struct and make the error usecase specific.

  Improve the `hashes::Error` by doing:

  - Make it a struct
  - Rename to `FromSliceError`
  - Move it to the crate root (remove `error` module)

  Includes usage in `bitcoin`.

ACKs for top commit:
  apoelstra:
    ACK 06afd52a12
  Kixunil:
    ACK 06afd52a12

Tree-SHA512: 20a517daaf3e9e09744e2a65cde6e238c8f2d1224899a6c04142a3a4e635d54112b0a2e846d25256071bb27cb70f7482380f98e9a535a5498aa4c7dc0d52cc54
2023-05-29 22:58:17 +00:00
Andrew Poelstra ca17257884
Merge rust-bitcoin/rust-bitcoin#1882: made ckd_priv function private and impl AsRef for ChildNumber
4be019180b correcting formatting (startup-dreamer)

Pull request description:

  closes #1866

ACKs for top commit:
  Kixunil:
    ACK 4be019180b
  junderw:
    ACK 4be019180b
  apoelstra:
    ACK 4be019180b

Tree-SHA512: 9539c987a9636f3c50dde2d4448ca0c30c239f5a8e852e7bf560cc27a2681777fa1a91ace21bdf1fd67b1f60679dfb8eecef45b81506618285536599ad741f7e
2023-05-29 12:19:09 +00:00