X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=rust-lightning;a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fonchaintx.rs;h=f4926471d1de4441338e3f64aab761959f5d452c;hp=f263ddf434b5d83f4c78be7b6bf72fca7fd56d8e;hb=HEAD;hpb=8b6434e946cc559a4c87349fecb97609c913682d diff --git a/lightning/src/ln/onchaintx.rs b/lightning/src/ln/onchaintx.rs index f263ddf4..f4926471 100644 --- a/lightning/src/ln/onchaintx.rs +++ b/lightning/src/ln/onchaintx.rs @@ -376,19 +376,19 @@ impl OnchainTxHandler { tx_weight += match inp { // number_of_witness_elements + sig_length + revocation_sig + pubkey_length + revocationpubkey + witness_script_length + witness_script &InputDescriptors::RevokedOfferedHTLC => { - 1 + 1 + 73 + 1 + 33 + 1 + 133 + 1 + 1 + 73 + 1 + 33 + 1 + 136 }, // number_of_witness_elements + sig_length + revocation_sig + pubkey_length + revocationpubkey + witness_script_length + witness_script &InputDescriptors::RevokedReceivedHTLC => { - 1 + 1 + 73 + 1 + 33 + 1 + 139 + 1 + 1 + 73 + 1 + 33 + 1 + 142 }, // number_of_witness_elements + sig_length + remotehtlc_sig + preimage_length + preimage + witness_script_length + witness_script &InputDescriptors::OfferedHTLC => { - 1 + 1 + 73 + 1 + 32 + 1 + 133 + 1 + 1 + 73 + 1 + 32 + 1 + 136 }, // number_of_witness_elements + sig_length + revocation_sig + pubkey_length + revocationpubkey + witness_script_length + witness_script &InputDescriptors::ReceivedHTLC => { - 1 + 1 + 73 + 1 + 1 + 1 + 139 + 1 + 1 + 73 + 1 + 1 + 1 + 142 }, // number_of_witness_elements + sig_length + revocation_sig + true_length + op_true + witness_script_length + witness_script &InputDescriptors::RevokedOutput => { @@ -421,12 +421,16 @@ impl OnchainTxHandler { { if cached_claim_datas.per_input_material.len() == 0 { return None } // But don't prune pending claiming request yet, we may have to resurrect HTLCs let mut inputs = Vec::new(); - for outp in cached_claim_datas.per_input_material.keys() { + for (outp, material) in cached_claim_datas.per_input_material.iter() { log_trace!(logger, "Outpoint {}:{}", outp.txid, outp.vout); inputs.push(TxIn { previous_output: *outp, script_sig: Script::new(), - sequence: 0xfffffffd, + sequence: match material { + &InputMaterial::Revoked { .. } => 1, // XXX: Depends on spec discussion + &InputMaterial::RemoteHTLC { .. } => 1, + &InputMaterial::LocalHTLC { .. } => 1, + }, witness: Vec::new(), }); }