Add initial support for Bitcoin Core v31#598
Conversation
|
Props to @xyzconstant and @0xB10C for pushing me to do this. I believe we can release this and then chip away at fixing the methods that were changed. Would that fix your use case lads? |
1eaa872 to
d10ec71
Compare
|
I reset the author of final patch to remove you @xyzconstant, I did use the shasums from you PR but that is all. Is that ok or do you want |
d10ec71 to
bc93a1e
Compare
|
If this is good can you push up a release tracking PR @jamillambert for |
The version features are weird in this crate, later Core versions enable earlier ones. So we can simplify the 'all-features' feature gating to just check for the earlies `0_17_2` with no change of functionality.
The features on this crate are non-typical. Improve the docs and put the `latest` feature right below `default`.
This is buggy, I couldn't come up with a way to catch this in case we do it again another time when we add a later Core version.
A few problems being fixed here: - We once committed to supporting all point releases for the latest 3 versions of Core. During 88ddaf1 it looks like this was changed to 4 and I missed this in review (or I don't remember it). - We want to add support for the latest version of Core (v31) Cut back early point releases to only be for the latest 2 versions, then when we add support for v31 it will be back to 3. Leave docs/comments saying 'three'.
The wallet migration bug was present in both v30.0 and v30.1 but we continue to have a `30_0` feature - this is wrong, remove it.
`v30_and_below` is currently all versions, this feature gate is incorrect - remove it.
Props to xyzconstant and 0xB10C for pushing me to do this. Add initial support for Bitcoin Core v31 We include types for the three new methods but they are untested. All failing tests, typically caused by changed fields, are feature gated out and marked as `TODO`. These can be tackled at a later date because downstream is waiting for this and don't need full support immediately.
bc93a1e to
1fdcf93
Compare
|
Rebaesed on master after merge of #591 |
There was a problem hiding this comment.
Reviewed 1fdcf93
Let's do v31!
client/src/client_sync/mod.rsis missing the re-exportpub mod v31, otherwise downstream can't use it.- In
contrib/templates/bitcoind_aliasesthere is an alias mentioned 30_0 andCargo.tomlmentioned30_0still.
| macro_rules! impl_client_v31__get_private_broadcast_info { | ||
| () => { | ||
| impl Client { | ||
| pub fn get_private_broadcast_info(&self) -> Result<GetPrivateBroadcastInfor> { |
There was a problem hiding this comment.
| pub fn get_private_broadcast_info(&self) -> Result<GetPrivateBroadcastInfor> { | |
| pub fn get_private_broadcast_info(&self) -> Result<GetPrivateBroadcastInfo> { |
| ), | ||
| Method::new_modelled("getdifficulty", "GetDifficulty", "get_difficulty"), | ||
| Method::new_modelled("getmempoolancestors", "GetMempoolAncestors", "get_mempool_ancestors"), | ||
| Method::new_modelled("getmempoolcluster", "GetMempoolClusted", "get_mempool_cluster"), |
There was a problem hiding this comment.
| Method::new_modelled("getmempoolcluster", "GetMempoolClusted", "get_mempool_cluster"), | |
| Method::new_modelled("getmempoolcluster", "GetMempoolCluster", "get_mempool_cluster"), |
| @@ -0,0 +1,35 @@ | |||
| // SPDX-License-Identifier: CC0-1.0 | |||
|
|
|||
| //! The JSON-RPC API for Bitcoin Core `v31` - blockchain.b | |||
There was a problem hiding this comment.
| //! The JSON-RPC API for Bitcoin Core `v31` - blockchain.b | |
| //! The JSON-RPC API for Bitcoin Core `v31` - blockchain. |
| #[cfg_attr(feature = "serde-deny-unknown-fields", serde(deny_unknown_fields))] | ||
| pub struct GetMempoolCluster { | ||
| /// Total sigops-adjusted weight (as defined in BIP 141 and modified by `-bytespersigop`). | ||
| pub cluster_weight: u64, |
There was a problem hiding this comment.
| pub cluster_weight: u64, | |
| #[serde(rename = "clusterweight")] | |
| pub cluster_weight: u64, |
| /// Total sigops-adjusted weight (as defined in BIP 141 and modified by `-bytespersigop`). | ||
| pub cluster_weight: u64, | ||
| /// Number of transactions. | ||
| pub tx_count: u64, |
There was a problem hiding this comment.
| pub tx_count: u64, | |
| #[serde(rename = "txcount")] | |
| pub tx_count: u64, |
| #[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] | ||
| pub struct Chunk { | ||
| /// Fees of the transactions in this chunk. | ||
| pub chunk_fee: u64, |
There was a problem hiding this comment.
Its a float.
| pub chunk_fee: u64, | |
| #[serde(rename = "chunkfee")] | |
| pub chunk_fee: f64, |
| /// Fees of the transactions in this chunk. | ||
| pub chunk_fee: u64, | ||
| /// Sigops-adjusted weight of all transactions in this chunk. | ||
| pub chunk_weight: u64, |
There was a problem hiding this comment.
| pub chunk_weight: u64, | |
| #[serde(rename = "chunkweight")] | |
| pub chunk_weight: u64, |
| //! We ignore option arguments unless they effect the shape of the returned JSON data. | ||
|
|
||
| pub mod blockchain; | ||
|
|
There was a problem hiding this comment.
| pub mod raw_transactions; | |
| let txs = | ||
| chunk.txs.iter().map(|txid| txid.parse::<Txid>()).collect::<Result<Vec<_>, _>>()?; | ||
| chunks.push(model::Chunk { | ||
| chunk_fee: Amount::from_sat(chunk.chunk_fee), |
There was a problem hiding this comment.
| chunk_fee: Amount::from_sat(chunk.chunk_fee), | |
| chunk_fee: Amount::from_btc(chunk.chunk_fee), |
First do a bunch of cleanups. Then add initial support.
We include types for the three new methods but they are untested. All failing tests, typically caused by changed fields, are feature gated out and marked as
TODO. These can be tackled at a later date because downstream is waiting for this and don't need full support immediately.ref: #599