1313//! or payments to send/ways to handle events generated.
1414//! This test has been very useful, though due to its complexity good starting inputs are critical.
1515
16+ use bitcoin:: TxMerkleNode ;
1617use bitcoin:: blockdata:: block:: BlockHeader ;
18+ use bitcoin:: blockdata:: constants:: genesis_block;
1719use bitcoin:: blockdata:: transaction:: { Transaction , TxOut } ;
1820use bitcoin:: blockdata:: script:: { Builder , Script } ;
1921use bitcoin:: blockdata:: opcodes;
22+ use bitcoin:: blockdata:: locktime:: PackedLockTime ;
2023use bitcoin:: consensus:: encode:: deserialize;
2124use bitcoin:: network:: constants:: Network ;
22- use bitcoin:: blockdata:: constants:: genesis_block;
2325
2426use bitcoin:: hashes:: Hash as TraitImport ;
2527use bitcoin:: hashes:: HashEngine as TraitImportEngine ;
@@ -50,7 +52,7 @@ use lightning::util::ser::ReadableArgs;
5052use utils:: test_logger;
5153use utils:: test_persister:: TestPersister ;
5254
53- use bitcoin:: secp256k1:: { PublicKey , SecretKey } ;
55+ use bitcoin:: secp256k1:: { PublicKey , SecretKey , Scalar } ;
5456use bitcoin:: secp256k1:: ecdh:: SharedSecret ;
5557use bitcoin:: secp256k1:: ecdsa:: RecoverableSignature ;
5658use bitcoin:: secp256k1:: Secp256k1 ;
@@ -213,7 +215,7 @@ impl<'a> MoneyLossDetector<'a> {
213215 }
214216
215217 self . blocks_connected += 1 ;
216- let header = BlockHeader { version : 0x20000000 , prev_blockhash : self . header_hashes [ self . height ] . 0 , merkle_root : Default :: default ( ) , time : self . blocks_connected , bits : 42 , nonce : 42 } ;
218+ let header = BlockHeader { version : 0x20000000 , prev_blockhash : self . header_hashes [ self . height ] . 0 , merkle_root : TxMerkleNode :: all_zeros ( ) , time : self . blocks_connected , bits : 42 , nonce : 42 } ;
217219 self . height += 1 ;
218220 self . manager . transactions_confirmed ( & header, & txdata, self . height as u32 ) ;
219221 self . manager . best_block_updated ( & header, self . height as u32 ) ;
@@ -230,7 +232,7 @@ impl<'a> MoneyLossDetector<'a> {
230232
231233 fn disconnect_block ( & mut self ) {
232234 if self . height > 0 && ( self . max_height < 6 || self . height >= self . max_height - 6 ) {
233- let header = BlockHeader { version : 0x20000000 , prev_blockhash : self . header_hashes [ self . height - 1 ] . 0 , merkle_root : Default :: default ( ) , time : self . header_hashes [ self . height ] . 1 , bits : 42 , nonce : 42 } ;
235+ let header = BlockHeader { version : 0x20000000 , prev_blockhash : self . header_hashes [ self . height - 1 ] . 0 , merkle_root : TxMerkleNode :: all_zeros ( ) , time : self . header_hashes [ self . height ] . 1 , bits : 42 , nonce : 42 } ;
234236 self . manager . block_disconnected ( & header, self . height as u32 ) ;
235237 self . monitor . block_disconnected ( & header, self . height as u32 ) ;
236238 self . height -= 1 ;
@@ -273,7 +275,7 @@ impl KeysInterface for KeyProvider {
273275 fn ecdh ( & self , recipient : Recipient , other_key : & PublicKey , tweak : Option < & [ u8 ; 32 ] > ) -> Result < SharedSecret , ( ) > {
274276 let mut node_secret = self . get_node_secret ( recipient) ?;
275277 if let Some ( tweak) = tweak {
276- node_secret. mul_assign ( tweak) . map_err ( |_| ( ) ) ? ;
278+ node_secret = node_secret . mul_tweak ( & Scalar :: from_be_bytes ( * tweak) . unwrap ( ) ) . unwrap ( ) ;
277279 }
278280 Ok ( SharedSecret :: new ( other_key, & node_secret) )
279281 }
@@ -564,7 +566,7 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
564566 } ,
565567 10 => {
566568 ' outer_loop: for funding_generation in pending_funding_generation. drain ( ..) {
567- let mut tx = Transaction { version : 0 , lock_time : 0 , input : Vec :: new ( ) , output : vec ! [ TxOut {
569+ let mut tx = Transaction { version : 0 , lock_time : PackedLockTime :: ZERO , input : Vec :: new ( ) , output : vec ! [ TxOut {
568570 value: funding_generation. 2 , script_pubkey: funding_generation. 3 ,
569571 } ] } ;
570572 let funding_output = ' search_loop: loop {
0 commit comments