File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -114,9 +114,20 @@ impl RgbInvoiceBuilder {
114114 self . set_amount ( coins as u64 , cents as u64 , precision)
115115 }
116116
117- pub fn set_chain ( mut self , chain : impl Into < Chain > ) -> Self {
118- self . 0 . chain = Some ( chain. into ( ) ) ;
119- self
117+ pub fn set_chain ( mut self , chain : impl Into < Chain > ) -> Result < Self , Self > {
118+ let chain = chain. into ( ) ;
119+ match ( self . 0 . beneficiary . chain_info ( ) , chain) {
120+ ( None , _) => { }
121+ ( Some ( chain1) , chain2) if chain1 == chain2 => { }
122+ ( Some ( chain1) , chain2)
123+ if chain1. is_testnet ( ) &&
124+ chain2. is_testnet ( ) &&
125+ chain1 != Chain :: Regtest &&
126+ chain2 != Chain :: Regtest => { }
127+ _ => return Err ( self ) ,
128+ }
129+ self . 0 . chain = Some ( chain) ;
130+ Ok ( self )
120131 }
121132
122133 pub fn set_expiry_timestamp ( mut self , expiry : i64 ) -> Self {
You can’t perform that action at this time.
0 commit comments