Skip to content

Commit c84e07d

Browse files
committed
Use the type alias of SignRawTransaction
Both `signrawtransactionwithkey` and `signrawtransactionwithwallet` use the type `SignRawTransaction` in types and model. These now have their own type aliases. Use the aliases in client and integration_test.
1 parent e0f1311 commit c84e07d

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

client/src/client_sync/v17/raw_transactions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ macro_rules! impl_client_v17__sign_raw_transaction_with_key {
213213
&self,
214214
tx: &bitcoin::Transaction,
215215
keys: &[bitcoin::PrivateKey],
216-
) -> Result<SignRawTransaction> {
216+
) -> Result<SignRawTransactionWithKey> {
217217
let hex = bitcoin::consensus::encode::serialize_hex(tx);
218218
let keys = keys.iter().map(|k| format!("{}", k)).collect::<Vec<String>>();
219219
self.call("signrawtransactionwithkey", &[hex.into(), into_json(keys)?])

client/src/client_sync/v17/wallet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ macro_rules! impl_client_v17__sign_raw_transaction_with_wallet {
660660
pub fn sign_raw_transaction_with_wallet(
661661
&self,
662662
tx: &bitcoin::Transaction,
663-
) -> Result<SignRawTransaction> {
663+
) -> Result<SignRawTransactionWithWallet> {
664664
let hex = bitcoin::consensus::encode::serialize_hex(tx);
665665
self.call("signrawtransactionwithwallet", &[into_json(hex)?])
666666
}

integration_test/tests/raw_transactions.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,9 @@ fn raw_transactions__test_mempool_accept__modelled() {
399399
let tx = create_a_raw_transaction(&node);
400400

401401
// Sign (but don't broadcast).
402-
let signed: SignRawTransaction =
402+
let signed: SignRawTransactionWithWallet =
403403
node.client.sign_raw_transaction_with_wallet(&tx).expect("signrawtransactionwithwallet");
404-
let signed_model: mtype::SignRawTransaction =
404+
let signed_model: mtype::SignRawTransactionWithWallet =
405405
signed.into_model().expect("SignRawTransaction into model");
406406
let signed_tx = signed_model.tx;
407407

@@ -474,10 +474,11 @@ fn create_sign_send(node: &Node) {
474474

475475
// wallet.rs expects this call to exist, if you change it then you'll need to update the test
476476
// `wallet__sign_raw_transaction_with_wallet__modelled`.
477-
let json: SignRawTransaction =
477+
let json: SignRawTransactionWithWallet =
478478
node.client.sign_raw_transaction_with_wallet(&tx).expect("signrawtransactionwithwallet");
479479

480-
let model: Result<mtype::SignRawTransaction, SignRawTransactionError> = json.into_model();
480+
let model: Result<mtype::SignRawTransactionWithWallet, SignRawTransactionError> =
481+
json.into_model();
481482
let sign_raw_transaction = model.unwrap();
482483

483484
// The proves we did everything correctly.
@@ -533,9 +534,10 @@ fn create_sign_with_key_send(node: &Node) {
533534
let model: mtype::DumpPrivKey = json.into_model().expect("DumpPrivKey");
534535
let key = model.0;
535536

536-
let json: SignRawTransaction =
537+
let json: SignRawTransactionWithKey =
537538
node.client.sign_raw_transaction_with_key(&tx, &[key]).expect("signrawtransactionwithkey");
538-
let model: Result<mtype::SignRawTransaction, SignRawTransactionError> = json.into_model();
539+
let model: Result<mtype::SignRawTransactionWithKey, SignRawTransactionError> =
540+
json.into_model();
539541
let sign_raw_transaction = model.unwrap();
540542

541543
// The proves we did everything correctly.
@@ -580,12 +582,13 @@ fn create_fund_sign_send(node: &Node) {
580582
let funded = json.transaction().unwrap();
581583

582584
// This method is from the wallet section.
583-
let json: SignRawTransaction = node
585+
let json: SignRawTransactionWithWallet = node
584586
.client
585587
.sign_raw_transaction_with_wallet(&funded)
586588
.expect("signrawtransactionwithwallet");
587589
// This proves we did everything correctly.
588-
let model: Result<mtype::SignRawTransaction, SignRawTransactionError> = json.into_model();
590+
let model: Result<mtype::SignRawTransactionWithWallet, SignRawTransactionError> =
591+
json.into_model();
589592
let sign_raw_transaction = model.unwrap();
590593
let _ =
591594
node.client.send_raw_transaction(&sign_raw_transaction.tx).expect("createrawtransaction");

0 commit comments

Comments
 (0)