@@ -385,10 +385,10 @@ pub struct TestChainMonitor<'a> {
385385 pub chain_monitor : ChainMonitor <
386386 TestChannelSigner ,
387387 & ' a TestChainSource ,
388- & ' a dyn chaininterface:: BroadcasterInterface ,
388+ & ' a ( dyn chaininterface:: BroadcasterInterface + Sync ) ,
389389 & ' a TestFeeEstimator ,
390390 & ' a TestLogger ,
391- & ' a dyn Persist < TestChannelSigner > ,
391+ & ' a ( dyn Persist < TestChannelSigner > + Sync ) ,
392392 > ,
393393 pub keys_manager : & ' a TestKeysInterface ,
394394 /// If this is set to Some(), the next update_channel call (not watch_channel) must be a
@@ -402,8 +402,8 @@ pub struct TestChainMonitor<'a> {
402402impl < ' a > TestChainMonitor < ' a > {
403403 pub fn new (
404404 chain_source : Option < & ' a TestChainSource > ,
405- broadcaster : & ' a dyn chaininterface:: BroadcasterInterface , logger : & ' a TestLogger ,
406- fee_estimator : & ' a TestFeeEstimator , persister : & ' a dyn Persist < TestChannelSigner > ,
405+ broadcaster : & ' a ( dyn chaininterface:: BroadcasterInterface + Sync ) , logger : & ' a TestLogger ,
406+ fee_estimator : & ' a TestFeeEstimator , persister : & ' a ( dyn Persist < TestChannelSigner > + Sync ) ,
407407 keys_manager : & ' a TestKeysInterface ,
408408 ) -> Self {
409409 Self {
@@ -1739,19 +1739,17 @@ impl Drop for TestChainSource {
17391739
17401740pub struct TestScorer {
17411741 /// Stores a tuple of (scid, ChannelUsage)
1742- scorer_expectations : RefCell < Option < VecDeque < ( u64 , ChannelUsage ) > > > ,
1742+ scorer_expectations : Mutex < Option < VecDeque < ( u64 , ChannelUsage ) > > > ,
17431743}
17441744
17451745impl TestScorer {
17461746 pub fn new ( ) -> Self {
1747- Self { scorer_expectations : RefCell :: new ( None ) }
1747+ Self { scorer_expectations : Mutex :: new ( None ) }
17481748 }
17491749
17501750 pub fn expect_usage ( & self , scid : u64 , expectation : ChannelUsage ) {
1751- self . scorer_expectations
1752- . borrow_mut ( )
1753- . get_or_insert_with ( || VecDeque :: new ( ) )
1754- . push_back ( ( scid, expectation) ) ;
1751+ let mut expectations = self . scorer_expectations . lock ( ) . unwrap ( ) ;
1752+ expectations. get_or_insert_with ( || VecDeque :: new ( ) ) . push_back ( ( scid, expectation) ) ;
17551753 }
17561754}
17571755
@@ -1772,7 +1770,7 @@ impl ScoreLookUp for TestScorer {
17721770 Some ( scid) => scid,
17731771 None => return 0 ,
17741772 } ;
1775- if let Some ( scorer_expectations) = self . scorer_expectations . borrow_mut ( ) . as_mut ( ) {
1773+ if let Some ( scorer_expectations) = self . scorer_expectations . lock ( ) . unwrap ( ) . as_mut ( ) {
17761774 match scorer_expectations. pop_front ( ) {
17771775 Some ( ( scid, expectation) ) => {
17781776 assert_eq ! ( expectation, usage) ;
@@ -1810,7 +1808,7 @@ impl Drop for TestScorer {
18101808 return ;
18111809 }
18121810
1813- if let Some ( scorer_expectations) = self . scorer_expectations . borrow ( ) . as_ref ( ) {
1811+ if let Some ( scorer_expectations) = self . scorer_expectations . lock ( ) . unwrap ( ) . as_ref ( ) {
18141812 if !scorer_expectations. is_empty ( ) {
18151813 panic ! ( "Unsatisfied scorer expectations: {:?}" , scorer_expectations)
18161814 }
0 commit comments