Skip to content

Commit fe71f3e

Browse files
committed
refactor: rename plan and plan_mall to have into_ prefix
These functions consume `self`, therefore they should be prefixed with `into_`.
1 parent 2e4b89e commit fe71f3e

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

bitcoind-tests/tests/test_desc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ fn test_plan_satisfy(
475475

476476
let plan = definite_desc
477477
.clone()
478-
.plan(&assets)
478+
.into_plan(&assets)
479479
.expect("plan creation failed");
480480

481481
let mut unsigned_tx = Transaction {

src/descriptor/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ impl<Pk: MiniscriptKey + ToPublicKey> Descriptor<Pk> {
557557
///
558558
/// If the assets aren't sufficient for generating a Plan, the descriptor is returned
559559
#[allow(clippy::result_large_err)] // our "error type" is the original descriptor
560-
pub fn plan<P>(self, provider: &P) -> Result<Plan<Pk>, Self>
560+
pub fn into_plan<P>(self, provider: &P) -> Result<Plan<Pk>, Self>
561561
where
562562
P: AssetProvider<Pk>,
563563
{
@@ -586,7 +586,7 @@ impl<Pk: MiniscriptKey + ToPublicKey> Descriptor<Pk> {
586586
///
587587
/// If the assets aren't sufficient for generating a Plan, the descriptor is returned
588588
#[allow(clippy::result_large_err)] // our "error type" is the original descriptor
589-
pub fn plan_mall<P>(self, provider: &P) -> Result<Plan<Pk>, Self>
589+
pub fn into_plan_mall<P>(self, provider: &P) -> Result<Plan<Pk>, Self>
590590
where
591591
P: AssetProvider<Pk>,
592592
{

src/plan.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ mod test {
766766
assets = assets.add(hashes[hi]);
767767
}
768768

769-
let result = desc.clone().plan(&assets);
769+
let result = desc.clone().into_plan(&assets);
770770
assert_eq!(
771771
result.as_ref().ok().map(|plan| plan.satisfaction_weight()),
772772
expected,
@@ -1105,7 +1105,7 @@ mod test {
11051105
let mut psbt_input = bitcoin::psbt::Input::default();
11061106
let assets = Assets::new().add(internal_key);
11071107
desc.clone()
1108-
.plan(&assets)
1108+
.into_plan(&assets)
11091109
.unwrap()
11101110
.update_psbt_input(&mut psbt_input);
11111111
assert!(psbt_input.tap_internal_key.is_some(), "Internal key is missing");
@@ -1116,7 +1116,7 @@ mod test {
11161116
let mut psbt_input = bitcoin::psbt::Input::default();
11171117
let assets = Assets::new().add(first_branch);
11181118
desc.clone()
1119-
.plan(&assets)
1119+
.into_plan(&assets)
11201120
.unwrap()
11211121
.update_psbt_input(&mut psbt_input);
11221122
assert!(psbt_input.tap_internal_key.is_none(), "Internal key is present");
@@ -1126,7 +1126,7 @@ mod test {
11261126

11271127
let mut psbt_input = bitcoin::psbt::Input::default();
11281128
let assets = Assets::new().add(second_branch);
1129-
desc.plan(&assets)
1129+
desc.into_plan(&assets)
11301130
.unwrap()
11311131
.update_psbt_input(&mut psbt_input);
11321132
assert!(psbt_input.tap_internal_key.is_none(), "Internal key is present");
@@ -1149,7 +1149,7 @@ mod test {
11491149

11501150
let mut psbt_input = bitcoin::psbt::Input::default();
11511151
let assets = Assets::new().add(asset_key);
1152-
desc.plan(&assets)
1152+
desc.into_plan(&assets)
11531153
.unwrap()
11541154
.update_psbt_input(&mut psbt_input);
11551155
assert!(psbt_input.witness_script.is_some(), "Witness script missing");
@@ -1202,7 +1202,7 @@ mod test {
12021202
assets = assets.add(DescriptorPublicKey::from_str(&pk.to_string()).unwrap());
12031203
}
12041204

1205-
let plan = desc.plan(&assets).expect("plan should succeed");
1205+
let plan = desc.into_plan(&assets).expect("plan should succeed");
12061206

12071207
let (witness, script_sig) = plan.satisfy(&satisfier).expect("satisfy should succeed");
12081208
assert_eq!(witness.last().unwrap(), &exp_witness_script.into_bytes());

0 commit comments

Comments
 (0)