-
Notifications
You must be signed in to change notification settings - Fork 31
Add support for bitcoin core 29.0 #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
//! Macros for implementing JSON-RPC methods on a client. | ||
//! | ||
//! Specifically this is methods found under the `== Blockchain ==` section of the | ||
//! API docs of Bitcoin Core `v29`. | ||
//! | ||
//! All macros require `Client` to be in scope. | ||
//! | ||
//! See or use the `define_jsonrpc_minreq_client!` macro to define a `Client`. | ||
|
||
/// Implements Bitcoin Core JSON-RPC API method `getdescriptoractivity` | ||
#[macro_export] | ||
macro_rules! impl_client_v29__getdescriptoractivity { | ||
() => { | ||
impl Client { | ||
pub fn get_descriptor_activity(&self) -> Result<GetDescriptorActivity> { | ||
let block_hashes: &[BlockHash] = &[]; | ||
let scan_objects: &[&str] = &[]; | ||
// FIXME: Core errors if we don't pass empty arrays? | ||
let params = vec![json!(block_hashes), json!(scan_objects)]; | ||
self.call("getdescriptoractivity", ¶ms) | ||
} | ||
} | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
// SPDX-License-Identifier: CC0-1.0 | ||
|
||
//! A JSON-RPC client for testing against Bitcoin Core `v29`. | ||
//! | ||
//! We ignore option arguments unless they effect the shape of the returned JSON data. | ||
|
||
pub mod blockchain; | ||
|
||
use std::collections::BTreeMap; | ||
use std::path::Path; | ||
|
||
use bitcoin::address::{Address, NetworkChecked}; | ||
use bitcoin::{sign_message, Amount, Block, BlockHash, PublicKey, Txid}; | ||
use serde::{Deserialize, Serialize}; | ||
use serde_json::json; | ||
|
||
use crate::client_sync::into_json; | ||
use crate::types::v29::*; | ||
|
||
#[rustfmt::skip] // Keep public re-exports separate. | ||
pub use crate::client_sync::{ | ||
v17::{Input, Output, WalletCreateFundedPsbtInput}, | ||
v23::AddressType, | ||
}; | ||
|
||
crate::define_jsonrpc_minreq_client!("v29"); | ||
crate::impl_client_check_expected_server_version!({ [290000] }); | ||
|
||
// == Blockchain == | ||
crate::impl_client_v17__getbestblockhash!(); | ||
crate::impl_client_v17__getblock!(); | ||
crate::impl_client_v17__getblockchaininfo!(); | ||
crate::impl_client_v17__getblockcount!(); | ||
crate::impl_client_v19__getblockfilter!(); | ||
crate::impl_client_v17__getblockhash!(); | ||
crate::impl_client_v17__getblockheader!(); | ||
crate::impl_client_v17__getblockstats!(); | ||
crate::impl_client_v17__getchaintips!(); | ||
crate::impl_client_v17__getchaintxstats!(); | ||
crate::impl_client_v29__getdescriptoractivity!(); | ||
crate::impl_client_v17__getdifficulty!(); | ||
crate::impl_client_v17__getmempoolancestors!(); | ||
crate::impl_client_v17__getmempooldescendants!(); | ||
crate::impl_client_v17__getmempoolentry!(); | ||
crate::impl_client_v17__getmempoolinfo!(); | ||
crate::impl_client_v17__getrawmempool!(); | ||
crate::impl_client_v17__gettxout!(); | ||
crate::impl_client_v17__gettxoutproof!(); | ||
crate::impl_client_v26__gettxoutsetinfo!(); | ||
crate::impl_client_v17__preciousblock!(); | ||
crate::impl_client_v17__pruneblockchain!(); | ||
crate::impl_client_v23__savemempool!(); | ||
crate::impl_client_v17__verifychain!(); | ||
crate::impl_client_v17__verifytxoutproof!(); | ||
|
||
// == Control == | ||
crate::impl_client_v17__getmemoryinfo!(); | ||
crate::impl_client_v18__getrpcinfo!(); | ||
crate::impl_client_v17__help!(); | ||
crate::impl_client_v17__logging!(); | ||
crate::impl_client_v17__stop!(); | ||
crate::impl_client_v17__uptime!(); | ||
|
||
// == Generating == | ||
crate::impl_client_v17__generatetoaddress!(); | ||
crate::impl_client_v17__invalidateblock!(); | ||
|
||
// == Mining == | ||
crate::impl_client_v17__getblocktemplate!(); | ||
crate::impl_client_v17__getmininginfo!(); | ||
crate::impl_client_v17__getnetworkhashps!(); | ||
crate::impl_client_v26__get_prioritised_transactions!(); | ||
crate::impl_client_v17__prioritisetransaction!(); | ||
crate::impl_client_v17__submitblock!(); | ||
|
||
// == Network == | ||
crate::impl_client_v17__getaddednodeinfo!(); | ||
crate::impl_client_v17__getnettotals!(); | ||
crate::impl_client_v17__getnetworkinfo!(); | ||
crate::impl_client_v18__getnodeaddresses!(); | ||
crate::impl_client_v17__getpeerinfo!(); | ||
|
||
// == Rawtransactions == | ||
crate::impl_client_v18__analyzepsbt!(); | ||
crate::impl_client_v17__combinepsbt!(); | ||
crate::impl_client_v17__combinerawtransaction!(); | ||
crate::impl_client_v17__converttopsbt!(); | ||
crate::impl_client_v17__createpsbt!(); | ||
crate::impl_client_v17__createrawtransaction!(); | ||
crate::impl_client_v17__decodepsbt!(); | ||
crate::impl_client_v17__decoderawtransaction!(); | ||
crate::impl_client_v17__decodescript!(); | ||
crate::impl_client_v17__finalizepsbt!(); | ||
crate::impl_client_v17__fundrawtransaction!(); | ||
crate::impl_client_v17__getrawtransaction!(); | ||
crate::impl_client_v18__joinpsbts!(); | ||
crate::impl_client_v17__sendrawtransaction!(); | ||
crate::impl_client_v17__signrawtransaction!(); | ||
crate::impl_client_v17__signrawtransactionwithkey!(); | ||
crate::impl_client_v28__submitpackage!(); | ||
crate::impl_client_v17__testmempoolaccept!(); | ||
crate::impl_client_v18__utxoupdatepsbt!(); | ||
|
||
// == Util == | ||
crate::impl_client_v17__createmultisig!(); | ||
crate::impl_client_v17__estimatesmartfee!(); | ||
crate::impl_client_v17__signmessagewithprivkey!(); | ||
crate::impl_client_v17__validateaddress!(); | ||
crate::impl_client_v17__verifymessage!(); | ||
|
||
// == Wallet == | ||
crate::impl_client_v17__addmultisigaddress!(); | ||
crate::impl_client_v17__bumpfee!(); | ||
crate::impl_client_v23__createwallet!(); | ||
crate::impl_client_v17__dumpprivkey!(); | ||
crate::impl_client_v17__dumpwallet!(); | ||
crate::impl_client_v17__getaddressesbylabel!(); | ||
crate::impl_client_v17__getaddressinfo!(); | ||
crate::impl_client_v17__getbalance!(); | ||
crate::impl_client_v19__getbalances!(); | ||
crate::impl_client_v17__getnewaddress!(); | ||
crate::impl_client_v17__getrawchangeaddress!(); | ||
crate::impl_client_v17__getreceivedbyaddress!(); | ||
crate::impl_client_v17__gettransaction!(); | ||
crate::impl_client_v17__getunconfirmedbalance!(); | ||
crate::impl_client_v17__getwalletinfo!(); | ||
crate::impl_client_v17__listaddressgroupings!(); | ||
crate::impl_client_v17__listlabels!(); | ||
crate::impl_client_v17__listlockunspent!(); | ||
crate::impl_client_v17__listreceivedbyaddress!(); | ||
crate::impl_client_v17__listsinceblock!(); | ||
crate::impl_client_v17__listtransactions!(); | ||
crate::impl_client_v17__listunspent!(); | ||
crate::impl_client_v17__listwallets!(); | ||
crate::impl_client_v22__loadwallet!(); | ||
crate::impl_client_v17__rescanblockchain!(); | ||
crate::impl_client_v17__sendmany!(); | ||
crate::impl_client_v17__sendtoaddress!(); | ||
crate::impl_client_v17__signmessage!(); | ||
crate::impl_client_v17__signrawtransactionwithwallet!(); | ||
crate::impl_client_v21__unloadwallet!(); | ||
crate::impl_client_v17__walletcreatefundedpsbt!(); | ||
crate::impl_client_v17__walletprocesspsbt!(); | ||
|
||
/// Arg for the `getblocktemplate` method. (v29+). | ||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Default)] | ||
pub struct TemplateRequest { | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub mode: Option<String>, | ||
#[serde(default, skip_serializing_if = "Vec::is_empty")] | ||
pub capabilities: Vec<String>, | ||
#[serde(default, skip_serializing_if = "Vec::is_empty")] | ||
pub rules: Vec<TemplateRules>, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub longpollid: Option<String>, | ||
#[serde(skip_serializing_if = "Option::is_none")] | ||
pub data: Option<String>, | ||
} | ||
|
||
/// Client side supported softfork deployment. | ||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Deserialize, Serialize)] | ||
#[serde(rename_all = "lowercase")] | ||
pub enum TemplateRules { | ||
/// SegWit v0 supported. | ||
Segwit, | ||
/// Signet supported. | ||
Signet, | ||
/// CSV supported. | ||
Csv, | ||
/// Taproot supported. | ||
Taproot, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.