use util::byte_utils;
use util::events::Event;
+use prelude::*;
use std::collections::{HashMap, HashSet};
use core::{cmp, mem};
use std::io::Error;
for &(ref htlc, _, _) in holder_tx.htlc_outputs.iter() {
if let Some(transaction_output_index) = htlc.transaction_output_index {
- let htlc_output = HolderHTLCOutput::build(if !htlc.offered {
- if let Some(preimage) = self.payment_preimages.get(&htlc.payment_hash) {
- Some(preimage.clone())
+ let htlc_output = if htlc.offered {
+ HolderHTLCOutput::build_offered(htlc.amount_msat, htlc.cltv_expiry)
} else {
- // We can't build an HTLC-Success transaction without the preimage
- continue;
- }
- } else { None }, htlc.amount_msat);
+ let payment_preimage = if let Some(preimage) = self.payment_preimages.get(&htlc.payment_hash) {
+ preimage.clone()
+ } else {
+ // We can't build an HTLC-Success transaction without the preimage
+ continue;
+ };
+ HolderHTLCOutput::build_accepted(payment_preimage, htlc.amount_msat)
+ };
let htlc_package = PackageTemplate::build_package(holder_tx.txid, transaction_output_index, PackageSolvingData::HolderHTLCOutput(htlc_output), height, false, height);
claim_requests.push(htlc_package);
}
use bitcoin::secp256k1::Secp256k1;
use std::sync::{Arc, Mutex};
use chain::keysinterface::InMemorySigner;
+ use prelude::*;
#[test]
fn test_prune_preimages() {