Commit Graph

66 Commits

Author SHA1 Message Date
Matt Corallo
deac430f17 Update crate versions to 0.0.108/invoice 0.16 2022-06-10 14:53:23 +00:00
Jeffrey Czyz
b2e635f619
Bump crate versions to 0.0.107/invoice 0.15 2022-06-08 18:16:48 -05:00
Devrandom
28d33ff9e0 bitcoin crate 0.28.1 2022-05-05 18:04:42 +02:00
Matt Corallo
d629a7edb7 Expand chain::Listen trivially to accept filtered block data
The `chain::Listen` interface provides a block-connection-based
alternative to the `chain::Confirm` interface, which supports
providing transaction data at a time separate from the block
connection time.

For users who are downloading the full headers tree (e.g. from a
node over the Bitcoin P2P protocol) but who are not downloading
full blocks (e.g. because they're using BIP 157/158 filtering)
there is no API that matches exactly their event stream -
`chain::Listen` requries full blocks for each block,
`chain::Confirm` requires breaking each connection event into two
calls.

Given its incredibly trivial to take a `TransactionData` in
addition to a `Block` in `chain::Listen` we do so here, adding a
default-implementation `block_connected` which simply creates the
`TransactionData`, which ultimately all of the `chain::Listen`
implementations currently do anyway.

Closes #1128.
2022-04-26 19:14:19 +00:00
Jeffrey Czyz
b902cc7c49
Remove unnecessary lifetime bound 2022-04-15 11:41:34 -05:00
Jeffrey Czyz
8967d20b29
Remove mut in lightning-block-sync tests 2022-04-15 11:41:33 -05:00
Jeffrey Czyz
b10217590b
Allow &dyn BlockSource in lightning-block-sync
Update lightning-block-sync's init and poll modules to support &dyn
BlockSource such that the BlockSource can be determined at runtime.
2022-04-15 11:38:48 -05:00
Jeffrey Czyz
3cdbbf56e4
Immutable BlockSource interface
Querying a BlockSource is a logically immutable operation. Use non-mut
references in its interface to reflect this, which allows for users to
hold multiple references if desired.
2022-04-03 20:59:11 -05:00
Jeffrey Czyz
de8bb8d261
Bump crate versions to 0.0.106/invoice 0.14 2022-04-03 08:05:08 -05:00
Matt Corallo
84a08dbf8a Make lightning-block-sync's init module slightly more generic
Users who want to use lightning-block-sync's init module would
be reasonable in wanting to use it in a multithreaded environment,
however because it takes a list of listeners as dyn chain::Listen
without any Send or Sync bound they fail in doing so.

Here we make the type bounds on `chain::Listen` generic across
`chain::Listen + ?Sized`, which the existing bound of `&dyn
chain::Listen` satisfies. Thus, this is strictly less restrictive
and allows for the use of `&dyn chain::Listen + Send + Sync`.
2022-03-09 18:20:43 +00:00
Matt Corallo
def0628332 Bump crate versions to 0.0.105/invoice 0.13 2022-03-01 00:43:24 +00:00
Jeffrey Czyz
62b1e01ad9
Generate docs with features for docs.rs
Enable generating docs using --all-features or --features="std" where
applicable. Additionally, use doc_auto_cfg to tag items requiring a
feature.

https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#doc_auto_cfg-automatically-generate-doccfg

This requires building with nightly, which is what is used by docs.rs.

https://docs.rs/about/builds

To test locally, use:

RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc ...
2022-02-18 15:38:31 -06:00
Jeffrey Czyz
6fb6994101
Fix cargo doc warning in lightning-block-sync 2022-02-18 15:34:07 -06:00
Matt Corallo
aca5b6934a Restrict tokio to 1.14 as a dev-dependency
This maintains our MSRV for simple `cargo test` runs, but doesn't
restrict users to any specific 1.X tokio version.
2022-02-17 17:47:13 +00:00
Jeffrey Czyz
494fe6dad9
Remove unnecessary mut from reference
chain::Listen's interface is defined in terms of non-mutable references,
so there's no need to use mutable references in lightning-block-sync.
2022-02-13 09:22:55 -06:00
hackerrdave
d46c2a20e1 update repo name to use lightningdevkit 2021-12-26 22:53:16 -05:00
Matt Corallo
ec86e2a1a7 Bump versions to 0.0.104/invoice 0.12 2021-12-17 21:34:19 +00:00
Matt Corallo
2b837bb272 Bump crate versions to 0.0.103/invoice 0.11 2021-11-03 02:20:51 +00:00
Matt Corallo
f2e47e0db2 Bump crate versions to 0.0.102 and lightning-invoice 0.10 2021-10-18 18:32:36 +00:00
Matt Corallo
0dfb24e661 Move Persist trait to chainmonitor as that's the only reference 2021-10-14 00:16:50 +00:00
Matt Corallo
43fe3d55f1 Bump Crate versions to 0.0.101 (and invoice to 0.9) 2021-09-23 18:22:59 +00:00
Matt Corallo
ed3a6eeefd
Merge pull request #1061 from sr-gi/add-transaction-convert
Adds Transaction to lighting-block-sync::convert
2021-09-21 22:04:15 +00:00
Sergi Delgado Segura
5718e43b65
Adds Transaction to lighting-block-sync::convert
Includes disclaimer in docs, see https://github.com/rust-bitcoin/rust-lightning/pull/1061#issuecomment-911960862
2021-09-21 22:59:50 +02:00
Matt Corallo
0021320e7b Bump HTTP read timeout to match reality of Bitcoin Core blocking 2021-09-21 19:14:29 +00:00
Giles Cope
b74ab25b61
Not needed now. We refer to std::futures. 2021-09-11 20:11:10 +01:00
Matt Corallo
d523b6e42b
Merge pull request #1037 from sr-gi/add-txid-convert
Adds Txid to lighting-block-sync::convert
2021-08-24 18:57:51 +00:00
Sergi Delgado Segura
f65d05c23d
Adds Txid to lighting-block-sync::convert 2021-08-24 10:52:22 +02:00
Matt Corallo
11f78798d3 Update versions to 0.0.100 and lightning-invoice to 0.8 2021-08-17 18:55:07 +00:00
Matt Corallo
84909447e9 Check IO errors in test using raw_os_error() instead of kind()
std::io::ErrorKind is a `#[non_exhaustive]` enum as more specific
error types are to be added in the future. It was unclear in the
docs until very recently, however, that this is to be done by
re-defining `ErrorKind::Other` errors to new enum variants. Thus,
our tests which check explicitly for `ErrorKind::Other` as a
result of trying to access a directory as a file were incorrect.
Sadly, these generated no meaningful feedback from rustc at all,
except that they're suddenly failing in rustc beta!

After some back-and-forth, it seems rustc is moving forward
breaking existing code in future versions, so we move to the
"correct" check here, which is to check the raw IO error.

See rust-lang/rust#86442 and rust-lang/rust#85746 for more info.
2021-08-02 18:50:00 +00:00
Matt Corallo
3f229052ea Bump dependencies to bitcoin 0.27 and bech32 0.8 2021-07-31 18:29:07 +00:00
Matt Corallo
c9a8b26d58 Bump most crate versions to 0.0.99 and lightning-invoice to 0.7.0 2021-07-09 16:34:46 +00:00
Jeffrey Czyz
7302c8c38a
Remove unnecessary spaces 2021-06-18 00:26:36 -05:00
Jeffrey Czyz
8cc026b406
Increase poll::Validate visibility to pub
Previously, poll::Validate was pub(crate) to force external implementors
of Poll to define their implementation in terms of ChainPoller. This was
because ChainPoller::look_up_previous_header checks for consistency
between headers and any errors would be checked at that level rather
than by the caller. Otherwise, if performed by the caller, a Poll
implementation would not be aware if the underlying BlockSource was
providing bad data and therefore couldn't react accordingly.

Widening the visibility to pub relaxes this requirement, although it's
still encourage to use ChainPoller to implement Poll. This permits
either copying or moving lightning-block-sync's test utilities to a
separate crate since they use poll::Validate.
2021-06-18 00:26:33 -05:00
Matt Corallo
9c9081dfcb Bump versions to 0.0.98, lightning-invoice to 0.6.0 2021-06-08 21:08:29 +00:00
Jeffrey Czyz
4a12d7656e
Cache socket address in HttpClient for reconnect
If the HttpClient attempts to reconnect to bitcoind that is no longer
running, the client fails to get the address from the stream. Cache the
address when connecting to prevent this.
2021-05-27 08:53:14 -07:00
Jeffrey Czyz
b2f16ad821
Parse RPC errors as JSON content
Bitcoin Core's JSON RPC server returns errors as HTTP error responses
with JSON content in the body. Parse this content as JSON to give a more
meaningful error. Otherwise, "binary" is given because the content
contains ASCII control characters.
2021-05-26 10:57:39 -07:00
Jeffrey Czyz
61648fc804
Define an HttpError for returning error contents
Return an HTTP error response as a status code and contents. This allows
clients to interpret the response as desired (e.g., the contents as a
JSON-formatted error).
2021-05-26 10:51:16 -07:00
Matt Corallo
f0084e12e2 Don't return ASCII control characters in HTTP error messages 2021-05-13 21:58:01 +00:00
Valentine Wallace
4f880c6b75
Return more error details on http's read_response
Otherwise helpful error information gets swallowed
2021-05-13 13:18:26 -04:00
Matt Corallo
4ade6bcb69 Increase the timeout for RPC responses from Bitcoin Core
Early sample testing showed multiple users hitting
EWOULDBLOCK/EAGAIN waiting for an initial response from Bitcoin
Core while it was doing some long operation (eg UTXO cache
flushing). Instead of only waiting 5 seconds for each attempt, we
now wait a full two minutes, but only for the first header
response, not each byte.
2021-05-10 16:55:09 +00:00
Matt Corallo
b465318e12 Allow retrying HTTP requests if we hit a socket timeout 2021-05-10 16:55:09 +00:00
Matt Corallo
f551d5946b Bump versions to 0.0.14, lightning-invoice 0.5 2021-05-01 00:43:15 +00:00
Devrandom
ec35fe62a1 Remove Send and Sync from core crate 2021-04-29 21:07:28 +02:00
Valentine Wallace
85106c9768
Expose AsyncBlockSourceResult and BlockSourceResult as pub
Useful for writing objects that implement BlockSource trait.
2021-03-26 14:54:19 -04:00
Matt Corallo
836985a5e5 Drop all HTML-relative links since rustdoc now supports resolution 2021-03-18 11:28:23 -04:00
Matt Corallo
2c7c1a6a7a Enforce no missing docs in all crates (+ add docs that were missing) 2021-03-18 11:28:23 -04:00
Matt Corallo
18a0967758 Enforce doc link correctness during cargo doc runs and in CI 2021-03-18 11:28:23 -04:00
Matt Corallo
98c6566b01 Clean up some doc links in lightning_block_sync.
Relative HTML doc paths in doc links works locally, but breaks on
crates.io. Luckily, we can now use explicit full paths and rustdoc
will resolve them for us.
2021-03-18 11:28:23 -04:00
Matt Corallo
eeec6fac5c Update licenses and add missing fields in Cargo.toml files 2021-03-09 16:53:03 -05:00
Matt Corallo
d65d7e7257 Bump versions to 0.0.13 across the board
We also skip having different versions for different subcrates,
since that is confusing.
2021-03-09 14:11:11 -05:00