mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-17 07:11:36 +02:00
Make payment proofs opt-in to fix #729
Default ProofArgs.suppress_proof to true. With it false, the receiver's `contract sign` unconditionally built an invoice promise, but the sender address is never plumbed through, so a bare send/receive failed with NoSenderAddressProvided (#729). The CLI never sets this field, so every default `contract sign --receive` hit the broken path; the basic tests passed only because they set suppress_proof = true by hand. Drop those workarounds from contract_srs/contract_rsr so they now exercise the default path, and opt the proof-using tests (contract_early_proofs_srs, contract_early_proofs_rsr, contract_accounts) into proofs explicitly.
This commit is contained in:
@@ -167,6 +167,8 @@ fn contract_accounts_impl(test_dir: &'static str) -> Result<(), libwallet::Error
|
||||
net_change: Some(5_000_000_000),
|
||||
..Default::default()
|
||||
};
|
||||
// Proofs are opt-in; enable and supply the sender address.
|
||||
args.proof_args.suppress_proof = false;
|
||||
args.proof_args.sender_address = sender_address;
|
||||
slate = api.contract_sign(m, &slate, args)?;
|
||||
recipient_address = Some(api.get_slatepack_address(mask2, 0)?.pub_key);
|
||||
|
||||
@@ -65,8 +65,9 @@ fn contract_early_proofs_rsr_test_impl(test_dir: &'static str) -> Result<(), lib
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
// Proofs are opt-in; enable and supply the sender address.
|
||||
args.setup_args.proof_args.suppress_proof = false;
|
||||
args.setup_args.proof_args.sender_address = sender_address;
|
||||
println!("SENDER ADDRESS: {:?}", sender_address);
|
||||
slate = api.contract_new(m, args)?;
|
||||
recipient_address = Some(api.get_slatepack_address(recv_mask, 0)?.pub_key);
|
||||
Ok(())
|
||||
|
||||
@@ -71,7 +71,8 @@ fn contract_early_proofs_srs_test_impl(test_dir: &'static str) -> Result<(), lib
|
||||
net_change: Some(5_000_000_000),
|
||||
..Default::default()
|
||||
};
|
||||
// Note sender address explicity added here
|
||||
// Proofs are opt-in; enable and supply the sender address.
|
||||
args.proof_args.suppress_proof = false;
|
||||
args.proof_args.sender_address = sender_address;
|
||||
slate = api.contract_sign(m, &slate, args)?;
|
||||
recipient_address = Some(api.get_slatepack_address(recv_mask, 0)?.pub_key);
|
||||
|
||||
@@ -52,7 +52,6 @@ fn contract_rsr_tx_impl(test_dir: &'static str) -> Result<(), libwallet::Error>
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
args.setup_args.proof_args.suppress_proof = true;
|
||||
slate = api.contract_new(m, args)?;
|
||||
Ok(())
|
||||
})?;
|
||||
@@ -74,8 +73,6 @@ fn contract_rsr_tx_impl(test_dir: &'static str) -> Result<(), libwallet::Error>
|
||||
let args = &mut ContractSetupArgsAPI {
|
||||
..Default::default()
|
||||
};
|
||||
// TODO: This possibly shouldn't be needed here if no proof?
|
||||
args.proof_args.suppress_proof = true;
|
||||
slate = api.contract_sign(m, &slate, args)?;
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
@@ -63,7 +63,6 @@ fn contract_srs_tx_impl(test_dir: &'static str) -> Result<(), libwallet::Error>
|
||||
net_change: Some(5_000_000_000),
|
||||
..Default::default()
|
||||
};
|
||||
args.proof_args.suppress_proof = true;
|
||||
slate = api.contract_sign(m, &slate, args)?;
|
||||
Ok(())
|
||||
})?;
|
||||
@@ -74,7 +73,6 @@ fn contract_srs_tx_impl(test_dir: &'static str) -> Result<(), libwallet::Error>
|
||||
let args = &mut ContractSetupArgsAPI {
|
||||
..Default::default()
|
||||
};
|
||||
args.proof_args.suppress_proof = true;
|
||||
slate = api.contract_sign(m, &slate, args)?;
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
@@ -112,7 +112,9 @@ pub struct ProofArgs {
|
||||
impl Default for ProofArgs {
|
||||
fn default() -> ProofArgs {
|
||||
ProofArgs {
|
||||
suppress_proof: false,
|
||||
// Proofs are opt-in (#729): a `false` default made the receiver build an
|
||||
// invoice promise with no sender address, failing with NoSenderAddressProvided.
|
||||
suppress_proof: true,
|
||||
proof_type: ProofType::Legacy,
|
||||
sender_address: None,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user