add sender nonce proofs

This commit is contained in:
wiesche
2026-09-06 08:58:14 +02:00
parent 4b27e3c560
commit 3f1d15fea0
16 changed files with 445 additions and 177 deletions
+8 -8
View File
@@ -17,7 +17,7 @@
use crate::keychain::Keychain;
use crate::libwallet::api_impl::foreign;
use crate::libwallet::api_impl::types::update_tx_slate_state;
use crate::libwallet::contract::proofs::InvoiceProof;
use crate::libwallet::contract::proofs::EarlyPaymentProof;
use crate::libwallet::contract::types::{ContractNewArgsAPI, ContractSetupArgsAPI};
use crate::libwallet::{
BlockFees, CbData, Error, NodeClient, NodeVersionInfo, Slate, VersionInfo, WalletInst,
@@ -49,8 +49,8 @@ pub enum ForeignCheckMiddlewareFn {
ContractSign,
/// finalize_tx
FinalizeTx,
/// verify_payment_proof_invoice
VerifyPaymentProofInvoice,
/// verify_payment_proof_early
VerifyPaymentProofEarly,
}
/// Main interface into all wallet API functions.
@@ -506,22 +506,22 @@ where
foreign::contract_sign(w, (&self.keychain_mask).as_ref(), args, slate)
}
/// Verify an invoice payment proof against the chain.
pub fn verify_payment_proof_invoice(
/// Verify an early payment proof against the chain
pub fn verify_payment_proof_early(
&self,
recipient_address: &DalekPublicKey,
proof: &InvoiceProof,
proof: &EarlyPaymentProof,
) -> Result<(), Error> {
let mut w_lock = self.wallet_inst.lock();
let w = w_lock.lc_provider()?.wallet_inst()?;
if let Some(m) = self.middleware.as_ref() {
m(
ForeignCheckMiddlewareFn::VerifyPaymentProofInvoice,
ForeignCheckMiddlewareFn::VerifyPaymentProofEarly,
w.w2n_client().get_version_info(),
None,
)?;
}
foreign::verify_payment_proof_invoice(w, recipient_address, proof)
foreign::verify_payment_proof_early(w, recipient_address, proof)
}
}
+5 -6
View File
@@ -23,7 +23,7 @@ use crate::keychain::{Identifier, Keychain};
use crate::libwallet::api_impl::owner_updater::{start_updater_log_thread, StatusMessage};
use crate::libwallet::api_impl::types::update_tx_slate_state;
use crate::libwallet::api_impl::{owner, owner_updater};
use crate::libwallet::contract::proofs::InvoiceProof;
use crate::libwallet::contract::proofs::EarlyPaymentProof;
use crate::libwallet::contract::types::{
ContractNewArgsAPI, ContractRevokeArgsAPI, ContractSetupArgsAPI, ContractView,
};
@@ -2576,15 +2576,14 @@ where
)
}
/// Retrieve the invoice payment proof for a stored transaction.
/// FUTURE: likely merge with retrieve_payment_proof above.
pub fn retrieve_payment_proof_invoice(
/// Retrieve an early payment proof for a stored transaction
pub fn retrieve_payment_proof_early(
&self,
keychain_mask: Option<&SecretKey>,
refresh_from_node: bool,
tx_id: Option<u32>,
tx_slate_id: Option<Uuid>,
) -> Result<InvoiceProof, Error> {
) -> Result<EarlyPaymentProof, Error> {
let tx = {
let t = self.status_tx.lock();
t.clone()
@@ -2593,7 +2592,7 @@ where
true => false,
false => refresh_from_node,
};
owner::retrieve_payment_proof_invoice(
owner::retrieve_payment_proof_early(
self.wallet_inst.clone(),
keychain_mask,
&tx,