Merge #1657: lianad: in update_spend_tx() work on the db_psbt
d637564a117947bd0493eba9bf61a1d84f893aa5 lianad: in update_spend_tx() work on the db_psbt instead of the imported one (pythcoiner) Pull request description: This PR partially fixes #1581. Previously the imported PSBT we taken as base and signature added from the PSBT stored in DB, this create issue when the imported PSBT is supplied by a signing device that trim the PSBT (in QRCode context for instance). This PR change the logic by taking the PSBT stored in DB as base and add signatures from the imported PSBT. ~~Note: the same logic change must be done on `liana-backend`~~ edit: review the logic on liana-backend, nothing seems to be change on this side, validated by a test by importing a psbt from krux trough Krux(QRCode) => SeedQReader => file => import ACKs for top commit: edouardparis: ACK d637564a117947bd0493eba9bf61a1d84f893aa5 Tree-SHA512: 2a14f2387f3ab74e93f4e5b67ff48011bea945bfa897e21f14be40bf40b52460c921c4dcb92899ce46f1aed6096ec8bd97b423341c1660dd3cd081146080572c
This commit is contained in:
commit
733c3a6071
@ -694,10 +694,9 @@ impl DaemonControl {
|
||||
|
||||
// If the transaction already exists in DB, merge the signatures for each input on a best
|
||||
// effort basis.
|
||||
// We work on the newly provided PSBT, in case its content was updated.
|
||||
let txid = tx.compute_txid();
|
||||
if let Some(db_psbt) = db_conn.spend_tx(&txid) {
|
||||
let db_tx = db_psbt.unsigned_tx;
|
||||
if let Some(mut db_psbt) = db_conn.spend_tx(&txid) {
|
||||
let db_tx = db_psbt.unsigned_tx.clone();
|
||||
for i in 0..db_tx.input.len() {
|
||||
if tx
|
||||
.input
|
||||
@ -707,24 +706,25 @@ impl DaemonControl {
|
||||
{
|
||||
continue;
|
||||
}
|
||||
let psbtin = match psbt.inputs.get_mut(i) {
|
||||
let psbtin = match psbt.inputs.get(i) {
|
||||
Some(psbtin) => psbtin,
|
||||
None => continue,
|
||||
};
|
||||
let db_psbtin = match db_psbt.inputs.get(i) {
|
||||
let db_psbtin = match db_psbt.inputs.get_mut(i) {
|
||||
Some(db_psbtin) => db_psbtin,
|
||||
None => continue,
|
||||
};
|
||||
psbtin
|
||||
db_psbtin
|
||||
.partial_sigs
|
||||
.extend(db_psbtin.partial_sigs.clone().into_iter());
|
||||
psbtin
|
||||
.extend(psbtin.partial_sigs.clone().into_iter());
|
||||
db_psbtin
|
||||
.tap_script_sigs
|
||||
.extend(db_psbtin.tap_script_sigs.clone().into_iter());
|
||||
if psbtin.tap_key_sig.is_none() {
|
||||
psbtin.tap_key_sig = db_psbtin.tap_key_sig;
|
||||
.extend(psbtin.tap_script_sigs.clone().into_iter());
|
||||
if db_psbtin.tap_key_sig.is_none() {
|
||||
db_psbtin.tap_key_sig = psbtin.tap_key_sig;
|
||||
}
|
||||
}
|
||||
psbt = db_psbt;
|
||||
} else {
|
||||
// If the transaction doesn't exist in DB already, sanity check its inputs.
|
||||
// FIXME: should we allow for external inputs?
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user