+// This file is Copyright its original authors, visible in version control
+// history.
+//
+// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
+// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// You may not use this file except in accordance with one or both of these
+// licenses.
+
//! Test that no series of bytes received over the wire/connections created/payments sent can
//! result in a crash. We do this by standing up a node and then reading bytes from input to denote
//! actions such as creating new inbound/outbound connections, bytes to be read from a connection,
use bitcoin::blockdata::opcodes;
use bitcoin::consensus::encode::deserialize;
use bitcoin::network::constants::Network;
-use bitcoin::util::hash::BitcoinHash;
use bitcoin::hashes::Hash as TraitImport;
use bitcoin::hashes::HashEngine as TraitImportEngine;
self.manager.block_connected(&header, self.height as u32, &txn[..], &txn_idxs[..]);
(*self.monitor).block_connected(&header, self.height as u32, &txn[..], &txn_idxs[..]);
if self.header_hashes.len() > self.height {
- self.header_hashes[self.height] = header.bitcoin_hash();
+ self.header_hashes[self.height] = header.block_hash();
} else {
assert_eq!(self.header_hashes.len(), self.height);
- self.header_hashes.push(header.bitcoin_hash());
+ self.header_hashes.push(header.block_hash());
}
self.max_height = cmp::max(self.height, self.max_height);
}
})
}
- fn get_onion_rand(&self) -> (SecretKey, [u8; 32]) {
- let ctr = self.counter.fetch_add(1, Ordering::Relaxed) as u8;
- (SecretKey::from_slice(&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, ctr]).unwrap(),
- [0; 32])
- }
-
- fn get_channel_id(&self) -> [u8; 32] {
+ fn get_secure_random_bytes(&self) -> [u8; 32] {
let ctr = self.counter.fetch_add(1, Ordering::Relaxed);
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
(ctr >> 8*7) as u8, (ctr >> 8*6) as u8, (ctr >> 8*5) as u8, (ctr >> 8*4) as u8, (ctr >> 8*3) as u8, (ctr >> 8*2) as u8, (ctr >> 8*1) as u8, 14, (ctr >> 8*0) as u8]