use lightning::routing::utxo::UtxoLookup;
use lightning::routing::router::{InFlightHtlcs, PaymentParameters, Route, RouteParameters, Router};
use lightning::util::config::{ChannelConfig, UserConfig};
+use lightning::util::hash_tables::*;
use lightning::util::errors::APIError;
use lightning::util::test_channel_signer::{TestChannelSigner, EnforcementState};
use lightning::util::logger::Logger;
use bitcoin::secp256k1::schnorr;
use std::cell::RefCell;
-use hashbrown::{HashMap, hash_map};
use std::convert::TryInto;
use std::cmp;
use std::sync::{Arc, Mutex};
peers,
funding_txn: Vec::new(),
- txids_confirmed: HashMap::new(),
+ txids_confirmed: new_hash_map(),
header_hashes: vec![(genesis_block(Network::Bitcoin).block_hash(), 0)],
height: 0,
max_height: 0,
let mut txdata = Vec::with_capacity(all_txn.len());
for (idx, tx) in all_txn.iter().enumerate() {
let txid = tx.txid();
- match self.txids_confirmed.entry(txid) {
- hash_map::Entry::Vacant(e) => {
- e.insert(self.height);
- txdata.push((idx + 1, tx));
- },
- _ => {},
- }
+ self.txids_confirmed.entry(txid).or_insert_with(|| {
+ txdata.push((idx + 1, tx));
+ self.height
+ });
}
self.blocks_connected += 1;
node_secret: our_network_key.clone(),
inbound_payment_key: KeyMaterial(inbound_payment_key.try_into().unwrap()),
counter: AtomicU64::new(0),
- signer_state: RefCell::new(HashMap::new())
+ signer_state: RefCell::new(new_hash_map())
});
let network = Network::Bitcoin;
let best_block_timestamp = genesis_block(network).header.time;
let mut intercepted_htlcs: Vec<InterceptId> = Vec::new();
let mut payments_sent: u16 = 0;
let mut pending_funding_generation: Vec<(ChannelId, PublicKey, u64, ScriptBuf)> = Vec::new();
- let mut pending_funding_signatures = HashMap::new();
+ let mut pending_funding_signatures = new_hash_map();
loop {
match get_slice!(1)[0] {
},
// 15, 16, 17, 18 is above
19 => {
- let mut list = loss_detector.handler.get_peer_node_ids();
- list.sort_by_key(|v| v.0);
- if let Some((id, _)) = list.get(0) {
- loss_detector.handler.disconnect_by_node_id(*id);
+ let mut list = loss_detector.handler.list_peers();
+ list.sort_by_key(|v| v.counterparty_node_id);
+ if let Some(peer_details) = list.get(0) {
+ loss_detector.handler.disconnect_by_node_id(peer_details.counterparty_node_id);
}
},
20 => loss_detector.handler.disconnect_all_peers(),
// create the funding transaction (client should send funding_created now)
ext_from_hex("0a", &mut test);
+ // Two feerate requests to check the dust exposure on the initial commitment tx
+ ext_from_hex("00fd00fd", &mut test);
// inbound read from peer id 1 of len 18
ext_from_hex("030112", &mut test);
// end of update_add_htlc from 0 to 1 via client and mac
ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ab00000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test);
+ // Two feerate requests to check dust exposure
+ ext_from_hex("00fd00fd", &mut test);
+
// inbound read from peer id 0 of len 18
ext_from_hex("030012", &mut test);
// message header indicating message length 100
// process the now-pending HTLC forward
ext_from_hex("07", &mut test);
+ // Two feerate requests to check dust exposure
+ ext_from_hex("00fd00fd", &mut test);
// client now sends id 1 update_add_htlc and commitment_signed (CHECK 7: UpdateHTLCs event for node 03020000 with 1 HTLCs for channel 3f000000)
// we respond with commitment_signed then revoke_and_ack (a weird, but valid, order)
// end of update_add_htlc from 0 to 1 via client and mac
ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ab00000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test);
+ // Two feerate requests to check dust exposure
+ ext_from_hex("00fd00fd", &mut test);
+
// now respond to the update_fulfill_htlc+commitment_signed messages the client sent to peer 0
// inbound read from peer id 0 of len 18
ext_from_hex("030012", &mut test);
// process the now-pending HTLC forward
ext_from_hex("07", &mut test);
+
+ // Two feerate requests to check dust exposure
+ ext_from_hex("00fd00fd", &mut test);
+
// client now sends id 1 update_add_htlc and commitment_signed (CHECK 7 duplicate)
// we respond with revoke_and_ack, then commitment_signed, then update_fail_htlc
// end of update_add_htlc from 0 to 1 via client and mac
ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 5300000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test);
+ // Two feerate requests to check dust exposure
+ ext_from_hex("00fd00fd", &mut test);
+
// inbound read from peer id 0 of len 18
ext_from_hex("030012", &mut test);
// message header indicating message length 164
// process the now-pending HTLC forward
ext_from_hex("07", &mut test);
+ // Two feerate requests to check dust exposure
+ ext_from_hex("00fd00fd", &mut test);
// client now sends id 1 update_add_htlc and commitment_signed (CHECK 7 duplicate)
// connect a block with one transaction of len 125