populate_test_db accepts a coinbase param
				
					
				
			Allows user to ask for a test db populated with clean coins from coinbases. This is useful for testing the wallet behaviour when some inputs are coinbases.
This commit is contained in:
		
							parent
							
								
									bb55923a7d
								
							
						
					
					
						commit
						0e0d5a0e95
					
				| @ -486,15 +486,23 @@ impl ConfigurableDatabase for MemoryDatabase { | |||||||
| /// don't have `test` set.
 | /// don't have `test` set.
 | ||||||
| macro_rules! populate_test_db { | macro_rules! populate_test_db { | ||||||
|     ($db:expr, $tx_meta:expr, $current_height:expr$(,)?) => {{ |     ($db:expr, $tx_meta:expr, $current_height:expr$(,)?) => {{ | ||||||
|  |         $crate::populate_test_db!($db, $tx_meta, $current_height, (@coinbase false)) | ||||||
|  |     }}; | ||||||
|  |     ($db:expr, $tx_meta:expr, $current_height:expr, (@coinbase $is_coinbase:expr)$(,)?) => {{ | ||||||
|         use std::str::FromStr; |         use std::str::FromStr; | ||||||
|         use $crate::database::BatchOperations; |         use $crate::database::BatchOperations; | ||||||
|         let mut db = $db; |         let mut db = $db; | ||||||
|         let tx_meta = $tx_meta; |         let tx_meta = $tx_meta; | ||||||
|         let current_height: Option<u32> = $current_height; |         let current_height: Option<u32> = $current_height; | ||||||
|  |         let input = if $is_coinbase { | ||||||
|  |             vec![$crate::bitcoin::TxIn::default()] | ||||||
|  |         } else { | ||||||
|  |             vec![] | ||||||
|  |         }; | ||||||
|         let tx = $crate::bitcoin::Transaction { |         let tx = $crate::bitcoin::Transaction { | ||||||
|             version: 1, |             version: 1, | ||||||
|             lock_time: 0, |             lock_time: 0, | ||||||
|             input: vec![], |             input, | ||||||
|             output: tx_meta |             output: tx_meta | ||||||
|                 .output |                 .output | ||||||
|                 .iter() |                 .iter() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user