Skip to content

Commit 37510f9

Browse files
committed
Merge #231: Implement abandontransaction and test
5d6b977 Implement abandontransaction and test (GideonBature) Pull request description: The JSON-RPC method `abandontransaction` does return null. We want to test this to catch any changes in behavior in future Core versions. This PR adds a client function that errors if the return value is anything other than `null`, along with an integration test that calls this function. Ref: [#116](#116) ACKs for top commit: jamillambert: ACK 5d6b977 tcharding: ACK 5d6b977 Tree-SHA512: 4801603b099f0fd04fd234dced71318e619cb201a22cb801140010cc88ce4ed316e372718c8c475b52e4caed8ce7cf8676b5197838953ee35e6c5482920b49ca
2 parents 042becf + 5d6b977 commit 37510f9

File tree

15 files changed

+54
-0
lines changed

15 files changed

+54
-0
lines changed

client/src/client_sync/v17/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ crate::impl_client_v17__validate_address!();
108108
crate::impl_client_v17__verify_message!();
109109

110110
// == Wallet ==
111+
crate::impl_client_v17__abandon_transaction!();
111112
crate::impl_client_v17__add_multisig_address!();
112113
crate::impl_client_v17__bump_fee!();
113114
crate::impl_client_v17__create_wallet!();

client/src/client_sync/v17/wallet.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@
99
//!
1010
//! See or use the `define_jsonrpc_minreq_client!` macro to define a `Client`.
1111
12+
/// Implements Bitcoin Core JSON-RPC API method `abandontransaction`.
13+
#[macro_export]
14+
macro_rules! impl_client_v17__abandon_transaction {
15+
() => {
16+
impl Client {
17+
pub fn abandon_transaction(&self, txid: Txid) -> Result<()> {
18+
match self.call("abandontransaction", &[into_json(txid)?]) {
19+
Ok(serde_json::Value::Null) => Ok(()),
20+
Ok(res) => Err(Error::Returned(res.to_string())),
21+
Err(err) => Err(err.into()),
22+
}
23+
}
24+
}
25+
};
26+
}
27+
1228
/// Implements Bitcoin Core JSON-RPC API method `addmultisigaddress`.
1329
#[macro_export]
1430
macro_rules! impl_client_v17__add_multisig_address {

client/src/client_sync/v18/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ crate::impl_client_v17__validate_address!();
116116
crate::impl_client_v17__verify_message!();
117117

118118
// == Wallet ==
119+
crate::impl_client_v17__abandon_transaction!();
119120
crate::impl_client_v17__add_multisig_address!();
120121
crate::impl_client_v17__bump_fee!();
121122
crate::impl_client_v17__create_wallet!();

client/src/client_sync/v19/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ crate::impl_client_v17__validate_address!();
114114
crate::impl_client_v17__verify_message!();
115115

116116
// == Wallet ==
117+
crate::impl_client_v17__abandon_transaction!();
117118
crate::impl_client_v17__add_multisig_address!();
118119
crate::impl_client_v17__bump_fee!();
119120
crate::impl_client_v17__create_wallet!();

client/src/client_sync/v20/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ crate::impl_client_v17__validate_address!();
111111
crate::impl_client_v17__verify_message!();
112112

113113
// == Wallet ==
114+
crate::impl_client_v17__abandon_transaction!();
114115
crate::impl_client_v17__add_multisig_address!();
115116
crate::impl_client_v17__bump_fee!();
116117
crate::impl_client_v17__create_wallet!();

client/src/client_sync/v21/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ crate::impl_client_v17__validate_address!();
113113
crate::impl_client_v17__verify_message!();
114114

115115
// == Wallet ==
116+
crate::impl_client_v17__abandon_transaction!();
116117
crate::impl_client_v17__add_multisig_address!();
117118
crate::impl_client_v17__bump_fee!();
118119
crate::impl_client_v17__create_wallet!();

client/src/client_sync/v22/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ crate::impl_client_v17__validate_address!();
113113
crate::impl_client_v17__verify_message!();
114114

115115
// == Wallet ==
116+
crate::impl_client_v17__abandon_transaction!();
116117
crate::impl_client_v17__add_multisig_address!();
117118
crate::impl_client_v17__bump_fee!();
118119
crate::impl_client_v17__create_wallet!();

client/src/client_sync/v23/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ crate::impl_client_v17__validate_address!();
115115
crate::impl_client_v17__verify_message!();
116116

117117
// == Wallet ==
118+
crate::impl_client_v17__abandon_transaction!();
118119
crate::impl_client_v17__add_multisig_address!();
119120
crate::impl_client_v17__bump_fee!();
120121
crate::impl_client_v23__create_wallet!();

client/src/client_sync/v24/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ crate::impl_client_v17__validate_address!();
112112
crate::impl_client_v17__verify_message!();
113113

114114
// == Wallet ==
115+
crate::impl_client_v17__abandon_transaction!();
115116
crate::impl_client_v17__add_multisig_address!();
116117
crate::impl_client_v17__bump_fee!();
117118
crate::impl_client_v23__create_wallet!();

client/src/client_sync/v25/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ crate::impl_client_v17__validate_address!();
112112
crate::impl_client_v17__verify_message!();
113113

114114
// == Wallet ==
115+
crate::impl_client_v17__abandon_transaction!();
115116
crate::impl_client_v17__add_multisig_address!();
116117
crate::impl_client_v17__bump_fee!();
117118
crate::impl_client_v23__create_wallet!();

0 commit comments

Comments
 (0)