Disable duplicate (proof of funds) balance check when sending offer.

Fix for blinded Particl offers.
Add fee to reverse offer balance check.
This commit is contained in:
tecnovert
2025-01-10 17:47:27 +02:00
parent 73ab5e7391
commit 681122bcca
5 changed files with 95 additions and 32 deletions

View File

@@ -261,9 +261,7 @@ class PARTInterfaceBlind(PARTInterface):
]
params = [inputs, outputs]
rv = self.rpc_wallet("createrawparttransaction", params)
tx_bytes = bytes.fromhex(rv["hex"])
return tx_bytes
return bytes.fromhex(rv["hex"])
def fundSCLockTx(self, tx_bytes: bytes, feerate: int, vkbv: bytes) -> bytes:
feerate_str = self.format_amount(feerate)
@@ -292,7 +290,7 @@ class PARTInterfaceBlind(PARTInterface):
"lockUnspents": True,
"feeRate": feerate_str,
}
rv = self.rpc(
rv = self.rpc_wallet(
"fundrawtransactionfrom", ["blind", tx_hex, {}, outputs_info, options]
)
return bytes.fromhex(rv["hex"])
@@ -1162,10 +1160,44 @@ class PARTInterfaceBlind(PARTInterface):
sub_fee: bool = False,
lock_unspents: bool = True,
) -> str:
txn = self.rpc_wallet(
"createrawtransaction", [[], {addr_to: self.format_amount(amount)}]
# Estimate lock tx size / fee
# self.createSCLockTx
vkbv = self.getNewRandomKey()
ephemeral_key = self.getNewRandomKey()
ephemeral_pubkey = self.getPubkey(ephemeral_key)
assert len(ephemeral_pubkey) == 33
nonce = self.getScriptLockTxNonce(vkbv)
inputs = []
outputs = [
{
"type": "blind",
"amount": self.format_amount(amount),
"address": addr_to,
"nonce": nonce.hex(),
"data": ephemeral_pubkey.hex(),
}
]
params = [inputs, outputs]
tx_hex = self.rpc_wallet("createrawparttransaction", params)["hex"]
# self.fundSCLockTx
tx_obj = self.rpc("decoderawtransaction", [tx_hex])
assert len(tx_obj["vout"]) == 1
txo = tx_obj["vout"][0]
blinded_info = self.rpc(
"rewindrangeproof", [txo["rangeproof"], txo["valueCommitment"], nonce.hex()]
)
outputs_info = {
0: {
"value": blinded_info["amount"],
"blind": blinded_info["blind"],
"nonce": nonce.hex(),
}
}
options = {
"lockUnspents": lock_unspents,
"conf_target": self._conf_target,
@@ -1174,7 +1206,9 @@ class PARTInterfaceBlind(PARTInterface):
options["subtractFeeFromOutputs"] = [
0,
]
return self.rpc_wallet("fundrawtransactionfrom", ["blind", txn, options])["hex"]
return self.rpc_wallet(
"fundrawtransactionfrom", ["blind", tx_hex, {}, outputs_info, options]
)["hex"]
class PARTInterfaceAnon(PARTInterface):