Skip to content

Commit c426be7

Browse files
committed
Merge #342: Test utxoupdatepsbt and joinpsbts
475e449 Test joinpsbts (Jamil Lambert, PhD) e200658 Test utxoupdatepsbt (Jamil Lambert, PhD) 435f2e9 fix utxoupdatepsbt client macro (Jamil Lambert, PhD) Pull request description: `utxoupdatepsbt` and `joinpsbts` are implemented but untested. The client macro for `utxoupdatepsbt` had a typo and the incorrect return type. Neither RPC has any return changes up to v29. - Fix the typo and return type in `utxoupdatepsbt` client macro. - Test `utxoupdatepsbt` and update the types table. - Test `joinpsbts` and update the types table. ACKs for top commit: tcharding: ACK 475e449 Tree-SHA512: b07d1283f6b8c863c59b99ed47a801fab9906d1e5971daee518df0a18d7e4f4453ed0230522c4f1c1efd6a09df217fd3774dcc7fded4018ccfa04cd73531e9f9
2 parents 17e19ce + 475e449 commit c426be7

File tree

14 files changed

+59
-29
lines changed

14 files changed

+59
-29
lines changed

client/src/client_sync/v18/raw_transactions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ macro_rules! impl_client_v18__join_psbts {
3535
};
3636
}
3737

38-
/// Implements Bitcoin Core JSON-RPC API method `uxtoupdatepsbt`.
38+
/// Implements Bitcoin Core JSON-RPC API method `utxoupdatepsbt`.
3939
#[macro_export]
4040
macro_rules! impl_client_v18__utxo_update_psbt {
4141
() => {
4242
impl Client {
43-
pub fn utxo_update_psbt(&self, psbt: &bitcoin::Psbt) -> Result<JoinPsbts> {
43+
pub fn utxo_update_psbt(&self, psbt: &bitcoin::Psbt) -> Result<UtxoUpdatePsbt> {
4444
let psbt = format!("{}", psbt);
45-
self.call("uxtoupdatepsbt", &[psbt.into()])
45+
self.call("utxoupdatepsbt", &[psbt.into()])
4646
}
4747
}
4848
};

integration_test/tests/raw_transactions.rs

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,24 @@ fn raw_transactions__get_raw_transaction__modelled() {
309309

310310
}
311311

312+
#[test]
313+
#[cfg(not(feature = "v17"))]
314+
fn raw_transactions__join_psbts__modelled() {
315+
let node = Node::with_wallet(Wallet::Default, &[]);
316+
node.fund_wallet();
317+
318+
let psbt1 = create_a_psbt(&node);
319+
let psbt2 = create_a_psbt(&node);
320+
321+
let json: JoinPsbts = node
322+
.client
323+
.join_psbts(&[psbt1.clone(), psbt2.clone()])
324+
.expect("joinpsbts");
325+
let model: mtype::JoinPsbts = json.into_model().expect("JoinPsbts into model");
326+
327+
assert_eq!(model.0.inputs.len(), psbt1.inputs.len() + psbt2.inputs.len());
328+
}
329+
312330
#[test]
313331
fn raw_transactions__sign_raw_transaction__modelled() {
314332
let node = Node::with_wallet(Wallet::Default, &[]);
@@ -412,8 +430,20 @@ fn raw_transactions__test_mempool_accept__modelled() {
412430
}
413431

414432
#[test]
415-
#[cfg(not(feature = "v17"))] // utxoupdatepsbt was added in v0.18.
416-
fn raw_transactions__utxo_update_psbt() {}
433+
#[cfg(not(feature = "v17"))]
434+
fn raw_transactions__utxo_update_psbt__modelled() {
435+
let node = Node::with_wallet(Wallet::Default, &[]);
436+
node.fund_wallet();
437+
438+
let psbt = create_a_psbt(&node);
439+
let json: UtxoUpdatePsbt = node
440+
.client
441+
.utxo_update_psbt(&psbt)
442+
.expect("utxoupdatepsbt");
443+
let model: mtype::UtxoUpdatePsbt = json.into_model().expect("UtxoUpdatePsbt into model");
444+
445+
assert!(model.0.inputs.len() >= psbt.inputs.len());
446+
}
417447

418448
// Manipulates raw transactions.
419449
//

types/src/v18/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@
129129
//! | finalizepsbt | version + model | |
130130
//! | fundrawtransaction | version + model | |
131131
//! | getrawtransaction | version + model | Includes additional 'verbose' type |
132-
//! | joinpsbts | version + model | UNTESTED |
132+
//! | joinpsbts | version + model | |
133133
//! | sendrawtransaction | version + model | |
134134
//! | signrawtransactionwithkey | version + model | |
135135
//! | testmempoolaccept | version + model | |
136-
//! | utxoupdatepsbt | version + model | UNTESTED |
136+
//! | utxoupdatepsbt | version + model | |
137137
//!
138138
//! </details>
139139
//!

types/src/v19/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@
129129
//! | finalizepsbt | version + model | |
130130
//! | fundrawtransaction | version + model | |
131131
//! | getrawtransaction | version + model | Includes additional 'verbose' type |
132-
//! | joinpsbts | version + model | UNTESTED |
132+
//! | joinpsbts | version + model | |
133133
//! | sendrawtransaction | version + model | |
134134
//! | signrawtransactionwithkey | version + model | |
135135
//! | testmempoolaccept | version + model | |
136-
//! | utxoupdatepsbt | version + model | UNTESTED |
136+
//! | utxoupdatepsbt | version + model | |
137137
//!
138138
//! </details>
139139
//!

types/src/v20/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,11 @@
130130
//! | finalizepsbt | version + model | |
131131
//! | fundrawtransaction | version + model | |
132132
//! | getrawtransaction | version + model | Includes additional 'verbose' type |
133-
//! | joinpsbts | version + model | UNTESTED |
133+
//! | joinpsbts | version + model | |
134134
//! | sendrawtransaction | version + model | |
135135
//! | signrawtransactionwithkey | version + model | |
136136
//! | testmempoolaccept | version + model | |
137-
//! | utxoupdatepsbt | version + model | UNTESTED |
137+
//! | utxoupdatepsbt | version + model | |
138138
//!
139139
//! </details>
140140
//!

types/src/v21/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@
131131
//! | finalizepsbt | version + model | |
132132
//! | fundrawtransaction | version + model | |
133133
//! | getrawtransaction | version + model | Includes additional 'verbose' type |
134-
//! | joinpsbts | version + model | UNTESTED |
134+
//! | joinpsbts | version + model | |
135135
//! | sendrawtransaction | version + model | |
136136
//! | signrawtransactionwithkey | version + model | |
137137
//! | testmempoolaccept | version + model | |
138-
//! | utxoupdatepsbt | version + model | UNTESTED |
138+
//! | utxoupdatepsbt | version + model | |
139139
//!
140140
//! </details>
141141
//!

types/src/v22/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@
131131
//! | finalizepsbt | version + model | |
132132
//! | fundrawtransaction | version + model | |
133133
//! | getrawtransaction | version + model | Includes additional 'verbose' type |
134-
//! | joinpsbts | version + model | UNTESTED |
134+
//! | joinpsbts | version + model | |
135135
//! | sendrawtransaction | version + model | |
136136
//! | signrawtransactionwithkey | version + model | |
137137
//! | testmempoolaccept | version + model | |
138-
//! | utxoupdatepsbt | version + model | UNTESTED |
138+
//! | utxoupdatepsbt | version + model | |
139139
//!
140140
//! </details>
141141
//!

types/src/v23/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@
122122
//! | finalizepsbt | version + model | |
123123
//! | fundrawtransaction | version + model | |
124124
//! | getrawtransaction | version + model | Includes additional 'verbose' type |
125-
//! | joinpsbts | version + model | UNTESTED |
125+
//! | joinpsbts | version + model | |
126126
//! | sendrawtransaction | version + model | |
127127
//! | signrawtransactionwithkey | version + model | |
128128
//! | testmempoolaccept | version + model | |
129-
//! | utxoupdatepsbt | version + model | UNTESTED |
129+
//! | utxoupdatepsbt | version + model | |
130130
//!
131131
//! </details>
132132
//!

types/src/v24/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@
123123
//! | finalizepsbt | version + model | |
124124
//! | fundrawtransaction | version + model | |
125125
//! | getrawtransaction | version + model | Includes additional 'verbose' type |
126-
//! | joinpsbts | version + model | UNTESTED |
126+
//! | joinpsbts | version + model | |
127127
//! | sendrawtransaction | version + model | |
128128
//! | signrawtransactionwithkey | version + model | |
129129
//! | testmempoolaccept | version + model | |
130-
//! | utxoupdatepsbt | version + model | UNTESTED |
130+
//! | utxoupdatepsbt | version + model | |
131131
//!
132132
//! </details>
133133
//!

types/src/v25/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@
124124
//! | finalizepsbt | version + model | |
125125
//! | fundrawtransaction | version + model | |
126126
//! | getrawtransaction | version + model | Includes additional 'verbose' type |
127-
//! | joinpsbts | version + model | UNTESTED |
127+
//! | joinpsbts | version + model | |
128128
//! | sendrawtransaction | version + model | |
129129
//! | signrawtransactionwithkey | version + model | |
130130
//! | testmempoolaccept | version + model | |
131-
//! | utxoupdatepsbt | version + model | UNTESTED |
131+
//! | utxoupdatepsbt | version + model | |
132132
//!
133133
//! </details>
134134
//!

0 commit comments

Comments
 (0)