File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed
Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -1051,7 +1051,7 @@ impl TransactionExt for Transaction {
10511051 /// Get the amount of btc that self sent to `dest`, if any
10521052 fn get_payment_amount_to ( & self , dest : Payload ) -> Option < u64 > {
10531053 self . output . iter ( ) . find_map ( |uxto| {
1054- let payload = Payload :: from_script ( & uxto. script_pubkey ) ?;
1054+ let payload = Payload :: from_script ( & uxto. script_pubkey ) . ok ( ) ?;
10551055 if payload == dest {
10561056 Some ( uxto. value )
10571057 } else {
@@ -1075,7 +1075,7 @@ impl TransactionExt for Transaction {
10751075 . iter ( )
10761076 . enumerate ( )
10771077 . filter ( |( _, x) | x. value > 0 )
1078- . filter_map ( |( idx, tx_out) | Some ( ( idx, Payload :: from_script ( & tx_out. script_pubkey ) ?) ) )
1078+ . filter_map ( |( idx, tx_out) | Some ( ( idx, Payload :: from_script ( & tx_out. script_pubkey ) . ok ( ) ?) ) )
10791079 . collect ( )
10801080 }
10811081
Original file line number Diff line number Diff line change @@ -212,7 +212,7 @@ impl Wallet {
212212 }
213213
214214 pub fn get_priv_key ( & self , script_pubkey : & Script ) -> Result < PrivateKey , Error > {
215- let address = Address :: from_script ( script_pubkey, self . network ) . ok_or ( Error :: InvalidAddress ) ?;
215+ let address = Address :: from_script ( script_pubkey, self . network ) ?;
216216 let key_store = self . key_store . read ( ) ?;
217217 let private_key = key_store. get ( & address) . ok_or ( Error :: NoPrivateKey ) ?;
218218 Ok ( * private_key)
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ impl PartialAddress for BtcAddress {
4949 Self :: P2WSHv0 ( hash) => Script :: new_v0_wsh ( & WScriptHash :: from_slice ( hash. as_bytes ( ) ) ?) ,
5050 } ;
5151
52- Payload :: from_script ( & script) . ok_or ( ConversionError :: InvalidPayload )
52+ Ok ( Payload :: from_script ( & script) ? )
5353 }
5454
5555 fn from_address ( address : Address ) -> Result < Self , ConversionError > {
You can’t perform that action at this time.
0 commit comments